Skip to content

Commit

Permalink
feat(editor): Property display order on LODGeneratorHelper
Browse files Browse the repository at this point in the history
Properties not driven by a preset are listed first.
This way, there's only a single block of greyed-out properties when customization is disabled.
  • Loading branch information
scoan-sd committed Jul 23, 2022
1 parent e721567 commit e3e14f1
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions Editor/LODGeneratorHelperEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,27 @@ private void DrawGeneratedView()

private void DrawNotGeneratedView()
{
EditorGUILayout.PropertyField(autoCollectRenderersProperty);

bool newOverrideSaveAssetsPath = EditorGUILayout.Toggle(overrideSaveAssetsPathContent, overrideSaveAssetsPath);
if (newOverrideSaveAssetsPath != overrideSaveAssetsPath)
{
overrideSaveAssetsPath = newOverrideSaveAssetsPath;
saveAssetsPathProperty.stringValue = string.Empty;
serializedObject.ApplyModifiedProperties();
GUIUtility.ExitGUI();
}

if (overrideSaveAssetsPath)
{
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(saveAssetsPathProperty);
if (EditorGUI.EndChangeCheck())
{
saveAssetsPathProperty.stringValue = IOUtils.MakeSafeRelativePath(saveAssetsPathProperty.stringValue);
}
}

EditorGUI.BeginDisabledGroup(customizeSettingsProperty.boolValue == true);
{
EditorGUILayout.ObjectField(lodGeneratorPresetProperty, typeof(LODGeneratorPreset));
Expand All @@ -160,31 +181,10 @@ private void DrawNotGeneratedView()
}
EditorGUI.EndDisabledGroup();

EditorGUILayout.PropertyField(autoCollectRenderersProperty);

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

bool newOverrideSaveAssetsPath = EditorGUILayout.Toggle(overrideSaveAssetsPathContent, overrideSaveAssetsPath);
if (newOverrideSaveAssetsPath != overrideSaveAssetsPath)
{
overrideSaveAssetsPath = newOverrideSaveAssetsPath;
saveAssetsPathProperty.stringValue = string.Empty;
serializedObject.ApplyModifiedProperties();
GUIUtility.ExitGUI();
}

if (overrideSaveAssetsPath)
{
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(saveAssetsPathProperty);
if (EditorGUI.EndChangeCheck())
{
saveAssetsPathProperty.stringValue = IOUtils.MakeSafeRelativePath(saveAssetsPathProperty.stringValue);
}
}

if (settingsExpanded == null || settingsExpanded.Length != levelsProperty.arraySize)
{
var newSettingsExpanded = new bool[levelsProperty.arraySize];
Expand Down

0 comments on commit e3e14f1

Please sign in to comment.