@@ -24,8 +24,13 @@ public static void ShowGUI(SceneView sceneView, bool haveOffset = true)
24
24
Rect bottomBarRect ;
25
25
if ( haveOffset )
26
26
{
27
+ #if UNITY_2021_2_OR_NEWER
28
+ bottomBarRect = new Rect ( 0 , height - ( CSG_GUIStyleUtility . BottomToolBarHeight + 27 ) ,
29
+ width , CSG_GUIStyleUtility . BottomToolBarHeight ) ;
30
+ #else
27
31
bottomBarRect = new Rect ( 0 , height - ( CSG_GUIStyleUtility . BottomToolBarHeight + 18 ) ,
28
32
width , CSG_GUIStyleUtility . BottomToolBarHeight ) ;
33
+ #endif
29
34
} else
30
35
bottomBarRect = new Rect ( 0 , height - ( CSG_GUIStyleUtility . BottomToolBarHeight + 1 ) , width , CSG_GUIStyleUtility . BottomToolBarHeight ) ;
31
36
@@ -97,7 +102,7 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
97
102
currentRect . x = layoutX ;
98
103
layoutX += currentRect . width ;
99
104
100
- #region "Grid" button
105
+ #region "Grid" button
101
106
if ( showGrid )
102
107
{
103
108
showGrid = GUI . Toggle ( currentRect , showGrid , skin . gridIconOn , EditorStyles . toolbarButton ) ;
@@ -107,7 +112,7 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
107
112
}
108
113
//(x:6.00, y:0.00, width:27.00, height:18.00)
109
114
TooltipUtility . SetToolTip ( showGridTooltip , currentRect ) ;
110
- #endregion
115
+ #endregion
111
116
112
117
if ( viewWidth >= 800 )
113
118
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)
117
122
if ( lockAxisX )
118
123
GUI . backgroundColor = lockedBackgroundColor ;
119
124
120
- #region "X" lock button
125
+ #region "X" lock button
121
126
currentRect . width = 17 ;
122
127
currentRect . y = 0 ;
123
128
currentRect . height = layoutHeight - currentRect . y ;
@@ -132,9 +137,9 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
132
137
else
133
138
TooltipUtility . SetToolTip ( xTooltipOff , currentRect ) ;
134
139
GUI . backgroundColor = prevBackgroundColor ;
135
- #endregion
140
+ #endregion
136
141
137
- #region "Y" lock button
142
+ #region "Y" lock button
138
143
currentRect . x = layoutX ;
139
144
layoutX += currentRect . width ;
140
145
@@ -147,9 +152,9 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
147
152
else
148
153
TooltipUtility . SetToolTip ( yTooltipOff , currentRect ) ;
149
154
GUI . backgroundColor = prevBackgroundColor ;
150
- #endregion
155
+ #endregion
151
156
152
- #region "Z" lock button
157
+ #region "Z" lock button
153
158
currentRect . x = layoutX ;
154
159
layoutX += currentRect . width ;
155
160
@@ -162,14 +167,14 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
162
167
else
163
168
TooltipUtility . SetToolTip ( zTooltipOff , currentRect ) ;
164
169
GUI . backgroundColor = prevBackgroundColor ;
165
- #endregion
170
+ #endregion
166
171
}
167
172
modified = GUI . changed || modified ;
168
173
169
174
if ( viewWidth >= 800 )
170
175
layoutX += 6 ; // (x:91.00, y:0.00, width:6.00, height:6.00)
171
176
172
- #region "SnapMode" button
177
+ #region "SnapMode" button
173
178
GUI . changed = false ;
174
179
{
175
180
currentRect . width = 27 ;
@@ -219,13 +224,13 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
219
224
}
220
225
}
221
226
modified = GUI . changed || modified ;
222
- #endregion
227
+ #endregion
223
228
224
229
if ( viewWidth >= 460 )
225
230
{
226
231
if ( snapMode != SnapMode . None )
227
232
{
228
- #region "Position" label
233
+ #region "Position" label
229
234
if ( viewWidth >= 500 )
230
235
{
231
236
if ( viewWidth >= 865 )
@@ -256,11 +261,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
256
261
TooltipUtility . SetToolTip ( positionTooltip , currentRect ) ;
257
262
}
258
263
}
259
- #endregion
264
+ #endregion
260
265
261
266
layoutX += 2 ;
262
267
263
- #region "Position" field
268
+ #region "Position" field
264
269
if ( uniformGrid || viewWidth < 515 )
265
270
{
266
271
EditorGUI . showMixedValue = ! ( moveSnapVector . x == moveSnapVector . y && moveSnapVector . x == moveSnapVector . z ) ;
@@ -316,11 +321,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
316
321
}
317
322
modified = GUI . changed || modified ;
318
323
}
319
- #endregion
324
+ #endregion
320
325
321
326
layoutX ++ ;
322
327
323
- #region "Position" Unit
328
+ #region "Position" Unit
324
329
DistanceUnit nextUnit = Units . CycleToNextUnit ( distanceUnit ) ;
325
330
GUIContent unitText = Units . GetUnitGUIContent ( distanceUnit ) ;
326
331
@@ -336,11 +341,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
336
341
distanceUnit = nextUnit ;
337
342
modified = true ;
338
343
}
339
- #endregion
344
+ #endregion
340
345
341
346
layoutX += 2 ;
342
347
343
- #region "Position" +/-
348
+ #region "Position" +/-
344
349
if ( viewWidth >= 700 )
345
350
{
346
351
currentRect . width = 19 ;
@@ -365,11 +370,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
365
370
//(x:429.00, y:2.00, width:17.00, height:15.00)
366
371
TooltipUtility . SetToolTip ( positionMinnusTooltip , currentRect ) ;
367
372
}
368
- #endregion
373
+ #endregion
369
374
370
375
layoutX += 2 ;
371
376
372
- #region "Angle" label
377
+ #region "Angle" label
373
378
if ( viewWidth >= 750 )
374
379
{
375
380
if ( viewWidth >= 865 )
@@ -397,11 +402,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
397
402
}
398
403
TooltipUtility . SetToolTip ( angleTooltip , currentRect ) ;
399
404
}
400
- #endregion
405
+ #endregion
401
406
402
407
layoutX += 2 ;
403
408
404
- #region "Angle" field
409
+ #region "Angle" field
405
410
GUI . changed = false ;
406
411
{
407
412
currentRect . width = 70 ;
@@ -417,11 +422,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
417
422
TooltipUtility . SetToolTip ( angleTooltip , currentRect ) ;
418
423
}
419
424
modified = GUI . changed || modified ;
420
- #endregion
425
+ #endregion
421
426
422
427
layoutX ++ ;
423
428
424
- #region "Angle" Unit
429
+ #region "Angle" Unit
425
430
if ( viewWidth >= 370 )
426
431
{
427
432
currentRect . width = 14 ;
@@ -433,11 +438,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
433
438
434
439
GUI . Label ( currentRect , angleUnitLabel , miniTextStyle ) ;
435
440
}
436
- #endregion
441
+ #endregion
437
442
438
443
layoutX += 2 ;
439
444
440
- #region "Angle" +/-
445
+ #region "Angle" +/-
441
446
if ( viewWidth >= 700 )
442
447
{
443
448
currentRect . width = 19 ;
@@ -463,11 +468,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
463
468
//(x:592.00, y:2.00, width:17.00, height:15.00)
464
469
TooltipUtility . SetToolTip ( angleMinnusTooltip , currentRect ) ;
465
470
}
466
- #endregion
471
+ #endregion
467
472
468
473
layoutX += 2 ;
469
474
470
- #region "Scale" label
475
+ #region "Scale" label
471
476
if ( viewWidth >= 750 )
472
477
{
473
478
if ( viewWidth >= 865 )
@@ -495,11 +500,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
495
500
}
496
501
TooltipUtility . SetToolTip ( scaleTooltip , currentRect ) ;
497
502
}
498
- #endregion
503
+ #endregion
499
504
500
505
layoutX += 2 ;
501
506
502
- #region "Scale" field
507
+ #region "Scale" field
503
508
GUI . changed = false ;
504
509
{
505
510
currentRect . width = 70 ;
@@ -515,11 +520,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
515
520
TooltipUtility . SetToolTip ( scaleTooltip , currentRect ) ;
516
521
}
517
522
modified = GUI . changed || modified ;
518
- #endregion
523
+ #endregion
519
524
520
525
layoutX ++ ;
521
526
522
- #region "Scale" Unit
527
+ #region "Scale" Unit
523
528
if ( viewWidth >= 370 )
524
529
{
525
530
currentRect . width = 15 ;
@@ -532,11 +537,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
532
537
GUI . Label ( currentRect , scaleUnitLabel , miniTextStyle ) ;
533
538
//(x:722.00, y:2.00, width:15.00, height:16.00)
534
539
}
535
- #endregion
540
+ #endregion
536
541
537
542
layoutX += 2 ;
538
543
539
- #region "Scale" +/-
544
+ #region "Scale" +/-
540
545
if ( viewWidth >= 700 )
541
546
{
542
547
currentRect . width = 19 ;
@@ -562,7 +567,7 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
562
567
//(x:760.00, y:2.00, width:17.00, height:15.00)
563
568
TooltipUtility . SetToolTip ( scaleMinnusTooltip , currentRect ) ;
564
569
}
565
- #endregion
570
+ #endregion
566
571
}
567
572
}
568
573
@@ -572,7 +577,7 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
572
577
layoutX = viewWidth ;
573
578
574
579
575
- #region "Rebuild"
580
+ #region "Rebuild"
576
581
currentRect . width = 27 ;
577
582
currentRect . y = 0 ;
578
583
currentRect . height = layoutHeight - currentRect . y ;
@@ -626,12 +631,12 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
626
631
}
627
632
//(x:1442.00, y:0.00, width:27.00, height:18.00)
628
633
TooltipUtility . SetToolTip ( rebuildTooltip , currentRect ) ;
629
- #endregion
634
+ #endregion
630
635
631
636
if ( viewWidth >= 800 )
632
637
layoutX -= 6 ; //(x:1436.00, y:0.00, width:6.00, height:6.00)
633
638
634
- #region "Helper Surface Flags" Mask
639
+ #region "Helper Surface Flags" Mask
635
640
if ( viewWidth >= 250 )
636
641
{
637
642
GUI . changed = false ;
@@ -658,9 +663,9 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
658
663
modified = true ;
659
664
}
660
665
}
661
- #endregion
666
+ #endregion
662
667
663
- #region "Show wireframe" button
668
+ #region "Show wireframe" button
664
669
GUI . changed = false ;
665
670
currentRect . width = 26 ;
666
671
currentRect . y = 0 ;
@@ -684,13 +689,13 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
684
689
wireframeModified = true ;
685
690
modified = true ;
686
691
}
687
- #endregion
692
+ #endregion
688
693
689
694
690
695
691
696
692
697
693
- #region Capture mouse clicks in empty space
698
+ #region Capture mouse clicks in empty space
694
699
var mousePoint = Event . current . mousePosition ;
695
700
int controlID = GUIUtility . GetControlID ( BottomBarEditorOverlayHash , FocusType . Passive , barSize ) ;
696
701
switch ( Event . current . GetTypeForControl ( controlID ) )
@@ -701,11 +706,11 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
701
706
case EventType . MouseDrag : { if ( GUIUtility . hotControl == controlID ) { Event . current . Use ( ) ; } break ; }
702
707
case EventType . ScrollWheel : { if ( barSize . Contains ( mousePoint ) ) { Event . current . Use ( ) ; } break ; }
703
708
}
704
- #endregion
709
+ #endregion
705
710
706
711
707
712
708
- #region Store modified values
713
+ #region Store modified values
709
714
rotationSnap = Mathf . Max ( 1.0f , Mathf . Abs ( ( 360 + ( rotationSnap % 360 ) ) ) % 360 ) ;
710
715
moveSnapVector . x = Mathf . Max ( 1.0f / 1024.0f , moveSnapVector . x ) ;
711
716
moveSnapVector . y = Mathf . Max ( 1.0f / 1024.0f , moveSnapVector . y ) ;
@@ -743,7 +748,7 @@ static void OnBottomBarGUI(SceneView sceneView, Rect barSize)
743
748
RealtimeCSG . CSGSettings . Save ( ) ;
744
749
CSG_EditorGUIUtility . RepaintAll ( ) ;
745
750
}
746
- #endregion
751
+ #endregion
747
752
}
748
753
749
754
}
0 commit comments