Skip to content

Commit 762822b

Browse files
committed
Merge branch 'master' into 2021.2-update
2 parents 142008a + 438d6a9 commit 762822b

File tree

2 files changed

+52
-44
lines changed

2 files changed

+52
-44
lines changed

RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/EditModeGUI/EditModeToolWindow.Editor.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ public class EditModeToolWindowEditor : Editor
1010
public override void OnInspectorGUI()
1111
{
1212
if (EditorApplication.isPlayingOrWillChangePlaymode)
13+
{
14+
Selection.activeObject = null;
1315
return;
16+
}
1417
RealtimeCSG.EditModeSelectionGUI.OnInspectorGUI(this, this.targets);
1518
}
1619
}

RealtimeCSG/Assets/Plugins/RealtimeCSG/Editor/Scripts/View/GUI/SceneViewBottomBarGUI/SceneViewBottomBar.GUI.cs

Lines changed: 49 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,13 @@ public static void ShowGUI(SceneView sceneView, bool haveOffset = true)
2424
Rect bottomBarRect;
2525
if (haveOffset)
2626
{
27+
#if UNITY_2021_2_OR_NEWER
28+
bottomBarRect = new Rect(0, height - (CSG_GUIStyleUtility.BottomToolBarHeight + 27),
29+
width, CSG_GUIStyleUtility.BottomToolBarHeight);
30+
#else
2731
bottomBarRect = new Rect(0, height - (CSG_GUIStyleUtility.BottomToolBarHeight + 18),
2832
width, CSG_GUIStyleUtility.BottomToolBarHeight);
33+
#endif
2934
} else
3035
bottomBarRect = new Rect(0, height - (CSG_GUIStyleUtility.BottomToolBarHeight + 1), width, CSG_GUIStyleUtility.BottomToolBarHeight);
3136

@@ -97,7 +102,7 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
97102
currentRect.x = layoutX;
98103
layoutX += currentRect.width;
99104

100-
#region "Grid" button
105+
#region "Grid" button
101106
if (showGrid)
102107
{
103108
showGrid = GUI.Toggle(currentRect, showGrid, skin.gridIconOn, EditorStyles.toolbarButton);
@@ -107,7 +112,7 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
107112
}
108113
//(x:6.00, y:0.00, width:27.00, height:18.00)
109114
TooltipUtility.SetToolTip(showGridTooltip, currentRect);
110-
#endregion
115+
#endregion
111116

112117
if (viewWidth >= 800)
113118
layoutX += 6; //(x:33.00, y:0.00, width:6.00, height:6.00)
@@ -117,7 +122,7 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
117122
if (lockAxisX)
118123
GUI.backgroundColor = lockedBackgroundColor;
119124

120-
#region "X" lock button
125+
#region "X" lock button
121126
currentRect.width = 17;
122127
currentRect.y = 0;
123128
currentRect.height = layoutHeight - currentRect.y;
@@ -132,9 +137,9 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
132137
else
133138
TooltipUtility.SetToolTip(xTooltipOff, currentRect);
134139
GUI.backgroundColor = prevBackgroundColor;
135-
#endregion
140+
#endregion
136141

137-
#region "Y" lock button
142+
#region "Y" lock button
138143
currentRect.x = layoutX;
139144
layoutX += currentRect.width;
140145

@@ -147,9 +152,9 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
147152
else
148153
TooltipUtility.SetToolTip(yTooltipOff, currentRect);
149154
GUI.backgroundColor = prevBackgroundColor;
150-
#endregion
155+
#endregion
151156

152-
#region "Z" lock button
157+
#region "Z" lock button
153158
currentRect.x = layoutX;
154159
layoutX += currentRect.width;
155160

@@ -162,14 +167,14 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
162167
else
163168
TooltipUtility.SetToolTip(zTooltipOff, currentRect);
164169
GUI.backgroundColor = prevBackgroundColor;
165-
#endregion
170+
#endregion
166171
}
167172
modified = GUI.changed || modified;
168173

169174
if (viewWidth >= 800)
170175
layoutX += 6; // (x:91.00, y:0.00, width:6.00, height:6.00)
171176

172-
#region "SnapMode" button
177+
#region "SnapMode" button
173178
GUI.changed = false;
174179
{
175180
currentRect.width = 27;
@@ -219,13 +224,13 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
219224
}
220225
}
221226
modified = GUI.changed || modified;
222-
#endregion
227+
#endregion
223228

224229
if (viewWidth >= 460)
225230
{
226231
if (snapMode != SnapMode.None)
227232
{
228-
#region "Position" label
233+
#region "Position" label
229234
if (viewWidth >= 500)
230235
{
231236
if (viewWidth >= 865)
@@ -256,11 +261,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
256261
TooltipUtility.SetToolTip(positionTooltip, currentRect);
257262
}
258263
}
259-
#endregion
264+
#endregion
260265

261266
layoutX += 2;
262267

263-
#region "Position" field
268+
#region "Position" field
264269
if (uniformGrid || viewWidth < 515)
265270
{
266271
EditorGUI.showMixedValue = !(moveSnapVector.x == moveSnapVector.y && moveSnapVector.x == moveSnapVector.z);
@@ -316,11 +321,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
316321
}
317322
modified = GUI.changed || modified;
318323
}
319-
#endregion
324+
#endregion
320325

321326
layoutX++;
322327

323-
#region "Position" Unit
328+
#region "Position" Unit
324329
DistanceUnit nextUnit = Units.CycleToNextUnit(distanceUnit);
325330
GUIContent unitText = Units.GetUnitGUIContent(distanceUnit);
326331

@@ -336,11 +341,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
336341
distanceUnit = nextUnit;
337342
modified = true;
338343
}
339-
#endregion
344+
#endregion
340345

341346
layoutX += 2;
342347

343-
#region "Position" +/-
348+
#region "Position" +/-
344349
if (viewWidth >= 700)
345350
{
346351
currentRect.width = 19;
@@ -365,11 +370,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
365370
//(x:429.00, y:2.00, width:17.00, height:15.00)
366371
TooltipUtility.SetToolTip(positionMinnusTooltip, currentRect);
367372
}
368-
#endregion
373+
#endregion
369374

370375
layoutX += 2;
371376

372-
#region "Angle" label
377+
#region "Angle" label
373378
if (viewWidth >= 750)
374379
{
375380
if (viewWidth >= 865)
@@ -397,11 +402,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
397402
}
398403
TooltipUtility.SetToolTip(angleTooltip, currentRect);
399404
}
400-
#endregion
405+
#endregion
401406

402407
layoutX += 2;
403408

404-
#region "Angle" field
409+
#region "Angle" field
405410
GUI.changed = false;
406411
{
407412
currentRect.width = 70;
@@ -417,11 +422,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
417422
TooltipUtility.SetToolTip(angleTooltip, currentRect);
418423
}
419424
modified = GUI.changed || modified;
420-
#endregion
425+
#endregion
421426

422427
layoutX++;
423428

424-
#region "Angle" Unit
429+
#region "Angle" Unit
425430
if (viewWidth >= 370)
426431
{
427432
currentRect.width = 14;
@@ -433,11 +438,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
433438

434439
GUI.Label(currentRect, angleUnitLabel, miniTextStyle);
435440
}
436-
#endregion
441+
#endregion
437442

438443
layoutX += 2;
439444

440-
#region "Angle" +/-
445+
#region "Angle" +/-
441446
if (viewWidth >= 700)
442447
{
443448
currentRect.width = 19;
@@ -463,11 +468,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
463468
//(x:592.00, y:2.00, width:17.00, height:15.00)
464469
TooltipUtility.SetToolTip(angleMinnusTooltip, currentRect);
465470
}
466-
#endregion
471+
#endregion
467472

468473
layoutX += 2;
469474

470-
#region "Scale" label
475+
#region "Scale" label
471476
if (viewWidth >= 750)
472477
{
473478
if (viewWidth >= 865)
@@ -495,11 +500,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
495500
}
496501
TooltipUtility.SetToolTip(scaleTooltip, currentRect);
497502
}
498-
#endregion
503+
#endregion
499504

500505
layoutX += 2;
501506

502-
#region "Scale" field
507+
#region "Scale" field
503508
GUI.changed = false;
504509
{
505510
currentRect.width = 70;
@@ -515,11 +520,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
515520
TooltipUtility.SetToolTip(scaleTooltip, currentRect);
516521
}
517522
modified = GUI.changed || modified;
518-
#endregion
523+
#endregion
519524

520525
layoutX ++;
521526

522-
#region "Scale" Unit
527+
#region "Scale" Unit
523528
if (viewWidth >= 370)
524529
{
525530
currentRect.width = 15;
@@ -532,11 +537,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
532537
GUI.Label(currentRect, scaleUnitLabel, miniTextStyle);
533538
//(x:722.00, y:2.00, width:15.00, height:16.00)
534539
}
535-
#endregion
540+
#endregion
536541

537542
layoutX += 2;
538543

539-
#region "Scale" +/-
544+
#region "Scale" +/-
540545
if (viewWidth >= 700)
541546
{
542547
currentRect.width = 19;
@@ -562,7 +567,7 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
562567
//(x:760.00, y:2.00, width:17.00, height:15.00)
563568
TooltipUtility.SetToolTip(scaleMinnusTooltip, currentRect);
564569
}
565-
#endregion
570+
#endregion
566571
}
567572
}
568573

@@ -572,7 +577,7 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
572577
layoutX = viewWidth;
573578

574579

575-
#region "Rebuild"
580+
#region "Rebuild"
576581
currentRect.width = 27;
577582
currentRect.y = 0;
578583
currentRect.height = layoutHeight - currentRect.y;
@@ -626,12 +631,12 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
626631
}
627632
//(x:1442.00, y:0.00, width:27.00, height:18.00)
628633
TooltipUtility.SetToolTip(rebuildTooltip, currentRect);
629-
#endregion
634+
#endregion
630635

631636
if (viewWidth >= 800)
632637
layoutX -= 6; //(x:1436.00, y:0.00, width:6.00, height:6.00)
633638

634-
#region "Helper Surface Flags" Mask
639+
#region "Helper Surface Flags" Mask
635640
if (viewWidth >= 250)
636641
{
637642
GUI.changed = false;
@@ -658,9 +663,9 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
658663
modified = true;
659664
}
660665
}
661-
#endregion
666+
#endregion
662667

663-
#region "Show wireframe" button
668+
#region "Show wireframe" button
664669
GUI.changed = false;
665670
currentRect.width = 26;
666671
currentRect.y = 0;
@@ -684,13 +689,13 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
684689
wireframeModified = true;
685690
modified = true;
686691
}
687-
#endregion
692+
#endregion
688693

689694

690695

691696

692697

693-
#region Capture mouse clicks in empty space
698+
#region Capture mouse clicks in empty space
694699
var mousePoint = Event.current.mousePosition;
695700
int controlID = GUIUtility.GetControlID(BottomBarEditorOverlayHash, FocusType.Passive, barSize);
696701
switch (Event.current.GetTypeForControl(controlID))
@@ -701,11 +706,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
701706
case EventType.MouseDrag: { if (GUIUtility.hotControl == controlID) { Event.current.Use(); } break; }
702707
case EventType.ScrollWheel: { if (barSize.Contains(mousePoint)) { Event.current.Use(); } break; }
703708
}
704-
#endregion
709+
#endregion
705710

706711

707712

708-
#region Store modified values
713+
#region Store modified values
709714
rotationSnap = Mathf.Max(1.0f, Mathf.Abs((360 + (rotationSnap % 360))) % 360);
710715
moveSnapVector.x = Mathf.Max(1.0f / 1024.0f, moveSnapVector.x);
711716
moveSnapVector.y = Mathf.Max(1.0f / 1024.0f, moveSnapVector.y);
@@ -743,7 +748,7 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
743748
RealtimeCSG.CSGSettings.Save();
744749
CSG_EditorGUIUtility.RepaintAll();
745750
}
746-
#endregion
751+
#endregion
747752
}
748753

749754
}

0 commit comments

Comments
 (0)