Skip to content

Commit fd7576b

Browse files
committed
improve UI
1 parent 064dea7 commit fd7576b

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed

AlembicImporter/Assets/UTJ/Alembic/Editor/Importer/AlembicImporterEditor.cs

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,23 @@ public override void OnInspectorGUI()
1919
EditorGUILayout.LabelField("Scene", EditorStyles.boldLabel);
2020
{
2121
EditorGUI.indentLevel++;
22-
EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "scaleFactor"));
23-
EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "swapHandedness"));
24-
EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "interpolateSamples"));
22+
EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "scaleFactor"),
23+
new GUIContent("Scale Factor", "How much to scale the models compared to what is in the source file."));
24+
EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "swapHandedness"),
25+
new GUIContent("Swap Handedness", "Swap X coordinate"));
26+
EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "interpolateSamples"),
27+
new GUIContent("Interpolate Samples", "Interpolate transforms and vertices (if topology is constant)."));
2528
EditorGUILayout.Separator();
2629

27-
EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "importVisibility"));
30+
EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "importVisibility"),
31+
new GUIContent("Import Visibility", "Import visibility animation."));
2832
//EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "importXform"));
29-
EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "importCameras"));
30-
EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "importMeshes"));
31-
EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "importPoints"));
33+
EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "importCameras"),
34+
new GUIContent("Import Cameras", ""));
35+
EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "importMeshes"),
36+
new GUIContent("Import Meshes", ""));
37+
EditorGUILayout.PropertyField(serializedObject.FindProperty(pathSettings + "importPoints"),
38+
new GUIContent("Import Points", ""));
3239
EditorGUILayout.Separator();
3340

3441
// time range
@@ -91,7 +98,8 @@ public override void OnInspectorGUI()
9198
EditorGUILayout.LabelField("Cameras", EditorStyles.boldLabel);
9299
{
93100
EditorGUI.indentLevel++;
94-
DisplayEnumProperty(serializedObject.FindProperty(pathSettings + "cameraAspectRatio"), Enum.GetNames(typeof(aiAspectRatioMode)));
101+
DisplayEnumProperty(serializedObject.FindProperty(pathSettings + "cameraAspectRatio"), Enum.GetNames(typeof(aiAspectRatioMode)),
102+
new GUIContent("Aspect Ratio", ""));
95103
EditorGUI.indentLevel--;
96104
}
97105
EditorGUILayout.Separator();
@@ -106,17 +114,24 @@ public override void OnInspectorGUI()
106114
base.ApplyRevertGUI();
107115
}
108116

109-
static void DisplayEnumProperty(SerializedProperty normalsMode,string[] displayNames)
117+
static void DisplayEnumProperty(SerializedProperty prop, string[] displayNames, GUIContent guicontent = null)
110118
{
119+
if (guicontent == null)
120+
guicontent = new GUIContent(prop.displayName);
121+
111122
var rect = EditorGUILayout.GetControlRect();
112-
EditorGUI.BeginProperty(rect, new GUIContent(normalsMode.displayName), normalsMode);
113-
EditorGUI.showMixedValue = normalsMode.hasMultipleDifferentValues;
123+
EditorGUI.BeginProperty(rect, guicontent, prop);
124+
EditorGUI.showMixedValue = prop.hasMultipleDifferentValues;
114125
EditorGUI.BeginChangeCheck();
115-
var normalsModeNew = EditorGUI.Popup(rect, normalsMode.displayName, normalsMode.intValue, displayNames.Select(ObjectNames.NicifyVariableName).ToArray());
126+
127+
GUIContent[] options = new GUIContent[displayNames.Length];
128+
for (int i = 0; i < options.Length; ++i)
129+
options[i] = new GUIContent(ObjectNames.NicifyVariableName(displayNames[i]), "");
130+
131+
var normalsModeNew = EditorGUI.Popup(rect, guicontent, prop.intValue, options);
116132
if (EditorGUI.EndChangeCheck())
117-
{
118-
normalsMode.intValue = normalsModeNew;
119-
}
133+
prop.intValue = normalsModeNew;
134+
120135
EditorGUI.showMixedValue = false;
121136
EditorGUI.EndProperty();
122137
}

0 commit comments

Comments
 (0)