Skip to content

Commit

Permalink
feat(editor): Better display of preset-driven settings on helper
Browse files Browse the repository at this point in the history
When a LOD Generator Helper has customization disabled,
Properties driven by the specified preset are visible but greyed out.
  • Loading branch information
scoan-sd committed Jul 22, 2022
1 parent 5286646 commit 7bf06ba
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Editor/LODGeneratorHelperEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,31 @@ private void DrawGeneratedView()

private void DrawNotGeneratedView()
{
EditorGUI.BeginDisabledGroup(customizeSettingsProperty.boolValue == true);
EditorGUILayout.ObjectField(lodGeneratorPresetProperty, typeof(LODGeneratorPreset));
EditorGUI.EndDisabledGroup();

EditorGUILayout.PropertyField(customizeSettingsProperty);

EditorGUI.BeginDisabledGroup(customizeSettingsProperty.boolValue == false);
EditorGUILayout.PropertyField(fadeModeProperty);
EditorGUI.EndDisabledGroup();
var fadeMode = (LODFadeMode)fadeModeProperty.intValue;

bool hasCrossFade = (fadeMode == LODFadeMode.CrossFade || fadeMode == LODFadeMode.SpeedTree);

EditorGUI.BeginDisabledGroup(customizeSettingsProperty.boolValue == false);
if (hasCrossFade)
{
EditorGUILayout.PropertyField(animateCrossFadingProperty);
}
EditorGUI.EndDisabledGroup();

EditorGUILayout.PropertyField(autoCollectRenderersProperty);

EditorGUI.BeginDisabledGroup(customizeSettingsProperty.boolValue == false);
DrawSimplificationOptions();
EditorGUI.EndDisabledGroup();

bool newOverrideSaveAssetsPath = EditorGUILayout.Toggle(overrideSaveAssetsPathContent, overrideSaveAssetsPath);
if (newOverrideSaveAssetsPath != overrideSaveAssetsPath)
Expand Down Expand Up @@ -184,10 +195,12 @@ private void DrawNotGeneratedView()
DrawLevel(levelIndex, levelProperty, hasCrossFade);
}

EditorGUI.BeginDisabledGroup(customizeSettingsProperty.boolValue == false);
if (GUILayout.Button(createLevelButtonContent))
{
CreateLevel();
}
EditorGUI.EndDisabledGroup();

if (GUILayout.Button(generateLODButtonContent))
{
Expand Down Expand Up @@ -218,6 +231,7 @@ private void DrawSimplificationOptions()

private void DrawLevel(int index, SerializedProperty levelProperty, bool hasCrossFade)
{
EditorGUI.BeginDisabledGroup(customizeSettingsProperty.boolValue == false);
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
GUILayout.Label(string.Format("Level {0}", index + 1), EditorStyles.boldLabel);
Expand Down Expand Up @@ -285,6 +299,7 @@ private void DrawLevel(int index, SerializedProperty levelProperty, bool hasCros
renderersProperty.DeleteArrayElementAtIndex(rendererIndex);
}
}
EditorGUI.EndDisabledGroup();

bool autoCollectRenderers = autoCollectRenderersProperty.boolValue;
if (!autoCollectRenderers)
Expand Down

0 comments on commit 7bf06ba

Please sign in to comment.