Skip to content

Commit 7bf06ba

Browse files
committed
feat(editor): Better display of preset-driven settings on helper
When a LOD Generator Helper has customization disabled, Properties driven by the specified preset are visible but greyed out.
1 parent 5286646 commit 7bf06ba

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Editor/LODGeneratorHelperEditor.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,20 +134,31 @@ private void DrawGeneratedView()
134134

135135
private void DrawNotGeneratedView()
136136
{
137+
EditorGUI.BeginDisabledGroup(customizeSettingsProperty.boolValue == true);
137138
EditorGUILayout.ObjectField(lodGeneratorPresetProperty, typeof(LODGeneratorPreset));
139+
EditorGUI.EndDisabledGroup();
140+
138141
EditorGUILayout.PropertyField(customizeSettingsProperty);
139142

143+
EditorGUI.BeginDisabledGroup(customizeSettingsProperty.boolValue == false);
140144
EditorGUILayout.PropertyField(fadeModeProperty);
145+
EditorGUI.EndDisabledGroup();
141146
var fadeMode = (LODFadeMode)fadeModeProperty.intValue;
142147

143148
bool hasCrossFade = (fadeMode == LODFadeMode.CrossFade || fadeMode == LODFadeMode.SpeedTree);
149+
150+
EditorGUI.BeginDisabledGroup(customizeSettingsProperty.boolValue == false);
144151
if (hasCrossFade)
145152
{
146153
EditorGUILayout.PropertyField(animateCrossFadingProperty);
147154
}
155+
EditorGUI.EndDisabledGroup();
148156

149157
EditorGUILayout.PropertyField(autoCollectRenderersProperty);
158+
159+
EditorGUI.BeginDisabledGroup(customizeSettingsProperty.boolValue == false);
150160
DrawSimplificationOptions();
161+
EditorGUI.EndDisabledGroup();
151162

152163
bool newOverrideSaveAssetsPath = EditorGUILayout.Toggle(overrideSaveAssetsPathContent, overrideSaveAssetsPath);
153164
if (newOverrideSaveAssetsPath != overrideSaveAssetsPath)
@@ -184,10 +195,12 @@ private void DrawNotGeneratedView()
184195
DrawLevel(levelIndex, levelProperty, hasCrossFade);
185196
}
186197

198+
EditorGUI.BeginDisabledGroup(customizeSettingsProperty.boolValue == false);
187199
if (GUILayout.Button(createLevelButtonContent))
188200
{
189201
CreateLevel();
190202
}
203+
EditorGUI.EndDisabledGroup();
191204

192205
if (GUILayout.Button(generateLODButtonContent))
193206
{
@@ -218,6 +231,7 @@ private void DrawSimplificationOptions()
218231

219232
private void DrawLevel(int index, SerializedProperty levelProperty, bool hasCrossFade)
220233
{
234+
EditorGUI.BeginDisabledGroup(customizeSettingsProperty.boolValue == false);
221235
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
222236
EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
223237
GUILayout.Label(string.Format("Level {0}", index + 1), EditorStyles.boldLabel);
@@ -285,6 +299,7 @@ private void DrawLevel(int index, SerializedProperty levelProperty, bool hasCros
285299
renderersProperty.DeleteArrayElementAtIndex(rendererIndex);
286300
}
287301
}
302+
EditorGUI.EndDisabledGroup();
288303

289304
bool autoCollectRenderers = autoCollectRenderersProperty.boolValue;
290305
if (!autoCollectRenderers)

0 commit comments

Comments
 (0)