@@ -9,6 +9,14 @@ namespace UnityEditor
99{
1010 internal class AnnotationWindow : EditorWindow
1111 {
12+ private static SavedBool s_ShowTerrainDebugWarnings = new SavedBool ( "Terrain.ShowDebugWarnings" , true ) ;
13+
14+ public static bool ShowTerrainDebugWarnings
15+ {
16+ get => s_ShowTerrainDebugWarnings . value ;
17+ set => s_ShowTerrainDebugWarnings . value = value ;
18+ }
19+
1220 class Styles
1321 {
1422 public GUIStyle toggle = "Toggle" ;
@@ -45,6 +53,7 @@ private enum EnabledState
4553 }
4654
4755 const float kWindowWidth = 270 ;
56+ const float kLabelWidth = 150 ;
4857 const float scrollBarWidth = 14 ;
4958 const float listElementHeight = 18 ;
5059 float iconSize = 16 ;
@@ -70,6 +79,7 @@ private enum EnabledState
7079 GUIContent iconToggleContent = EditorGUIUtility . TrTextContent ( "" , "Show/Hide Icon" ) ;
7180 GUIContent iconSelectContent = EditorGUIUtility . TrTextContent ( "" , "Select Icon" ) ;
7281 GUIContent icon3dGizmoContent = EditorGUIUtility . TrTextContent ( "3D Icons" ) ;
82+ GUIContent terrainDebugWarnings = EditorGUIUtility . TrTextContent ( "Terrain Debug Warnings" ) ;
7383 GUIContent showOutlineContent = EditorGUIUtility . TrTextContent ( "Selection Outline" ) ;
7484 GUIContent showWireframeContent = EditorGUIUtility . TrTextContent ( "Selection Wire" ) ;
7585 GUIContent fadeGizmosContent = EditorGUIUtility . TrTextContent ( "Fade Gizmos" , "Fade out and stop rendering gizmos that are small on screen" ) ;
@@ -118,7 +128,7 @@ static public void IconChanged()
118128
119129 float GetTopSectionHeight ( )
120130 {
121- const int numberOfControls = 4 ;
131+ const int numberOfControls = 5 ;
122132 return EditorGUI . kSingleLineHeight * numberOfControls + EditorGUI . kControlVerticalSpacing * ( numberOfControls - 1 ) + EditorStyles . inspectorBig . padding . bottom ;
123133 }
124134
@@ -298,8 +308,7 @@ void DrawTopSection(float topSectionHeight)
298308 float margin = 11 ;
299309 float curY = topmargin ;
300310
301-
302- float labelWidth = m_Styles . listHeaderStyle . CalcSize ( showOutlineContent ) . x + GUI . skin . toggle . CalcSize ( GUIContent . none ) . x + 1 ;
311+ float labelWidth = m_Styles . listHeaderStyle . CalcSize ( terrainDebugWarnings ) . x + GUI . skin . toggle . CalcSize ( GUIContent . none ) . x + 1 ;
303312 float rowHeight = 18 ;
304313
305314 // 3D icons toggle & slider
@@ -337,14 +346,21 @@ void DrawTopSection(float topSectionHeight)
337346 }
338347 curY += rowHeight ;
339348
340- // Selection outline/wire
341349 using ( new EditorGUI . DisabledScope ( m_IsGameView ) )
342350 {
351+ // Selection outline/wire
343352 toggleRect = new Rect ( margin , curY , labelWidth , rowHeight ) ;
344353 AnnotationUtility . showSelectionOutline = GUI . Toggle ( toggleRect , AnnotationUtility . showSelectionOutline , showOutlineContent ) ;
345354
346355 toggleRect . y += rowHeight ;
347356 AnnotationUtility . showSelectionWire = GUI . Toggle ( toggleRect , AnnotationUtility . showSelectionWire , showWireframeContent ) ;
357+
358+ // TODO: Change to Debug Errors & Debug Warnings
359+ toggleRect . y += rowHeight ;
360+ EditorGUI . BeginChangeCheck ( ) ;
361+ s_ShowTerrainDebugWarnings . value = GUI . Toggle ( toggleRect , s_ShowTerrainDebugWarnings . value , terrainDebugWarnings ) ;
362+ if ( EditorGUI . EndChangeCheck ( ) )
363+ SceneView . RepaintAll ( ) ;
348364 }
349365 }
350366
0 commit comments