in Assets/MixedRealityToolkit.SDK/Inspectors/UX/Interactable/ThemeInspector.cs [1025:1148]
public static void RenderThemeStates(SerializedProperty settings, State[] states, int margin)
{
GUIStyle box = InspectorUIUtility.Box(margin);
EditorGUILayout.BeginVertical(box);
for (int n = 0; n < states.Length; n++)
{
InspectorUIUtility.DrawLabel(states[n].Name, 12, InspectorUIUtility.ColorTint50);
EditorGUI.indentLevel = indentOnSectionStart + 1;
for (int j = 0; j < settings.arraySize; j++)
{
SerializedProperty settingsItem = settings.GetArrayElementAtIndex(j);
SerializedProperty properties = settingsItem.FindPropertyRelative("Properties");
for (int i = 0; i < properties.arraySize; i++)
{
SerializedProperty propertyItem = properties.GetArrayElementAtIndex(i);
SerializedProperty name = propertyItem.FindPropertyRelative("Name");
SerializedProperty type = propertyItem.FindPropertyRelative("Type");
SerializedProperty values = propertyItem.FindPropertyRelative("Values");
SerializedProperty shaderNames = propertyItem.FindPropertyRelative("ShaderOptionNames");
SerializedProperty propId = propertyItem.FindPropertyRelative("PropId");
string shaderPropName = "Shader";
if (shaderNames.arraySize > propId.intValue)
{
SerializedProperty propName = shaderNames.GetArrayElementAtIndex(propId.intValue);
shaderPropName = propName.stringValue.Substring(1);
}
if (n >= values.arraySize)
{
// the state values for this theme were not created yet
continue;
}
SerializedProperty item = values.GetArrayElementAtIndex(n);
SerializedProperty floatValue = item.FindPropertyRelative("Float");
SerializedProperty vector2Value = item.FindPropertyRelative("Vector2");
SerializedProperty stringValue = item.FindPropertyRelative("String");
switch ((InteractableThemePropertyValueTypes)type.intValue)
{
case InteractableThemePropertyValueTypes.Float:
floatValue.floatValue = EditorGUILayout.FloatField(new GUIContent(name.stringValue, ""), floatValue.floatValue);
break;
case InteractableThemePropertyValueTypes.Int:
SerializedProperty intValue = item.FindPropertyRelative("Int");
intValue.intValue = EditorGUILayout.IntField(new GUIContent(name.stringValue, ""), intValue.intValue);
break;
case InteractableThemePropertyValueTypes.Color:
SerializedProperty colorValue = item.FindPropertyRelative("Color");
colorValue.colorValue = EditorGUILayout.ColorField(new GUIContent(shaderPropName, shaderPropName), colorValue.colorValue);
break;
case InteractableThemePropertyValueTypes.ShaderFloat:
floatValue.floatValue = EditorGUILayout.FloatField(new GUIContent(shaderPropName, shaderPropName), floatValue.floatValue);
break;
case InteractableThemePropertyValueTypes.shaderRange:
vector2Value.vector2Value = EditorGUILayout.Vector2Field(new GUIContent(shaderPropName, shaderPropName), vector2Value.vector2Value);
break;
case InteractableThemePropertyValueTypes.Vector2:
vector2Value.vector2Value = EditorGUILayout.Vector2Field(new GUIContent(name.stringValue, ""), vector2Value.vector2Value);
break;
case InteractableThemePropertyValueTypes.Vector3:
SerializedProperty vector3Value = item.FindPropertyRelative("Vector3");
vector3Value.vector3Value = EditorGUILayout.Vector3Field(new GUIContent(name.stringValue, ""), vector3Value.vector3Value);
break;
case InteractableThemePropertyValueTypes.Vector4:
SerializedProperty vector4Value = item.FindPropertyRelative("Vector4");
vector4Value.vector4Value = EditorGUILayout.Vector4Field(new GUIContent(name.stringValue, ""), vector4Value.vector4Value);
break;
case InteractableThemePropertyValueTypes.Quaternion:
SerializedProperty quaternionValue = item.FindPropertyRelative("Quaternion");
Vector4 vect4 = new Vector4(quaternionValue.quaternionValue.x, quaternionValue.quaternionValue.y, quaternionValue.quaternionValue.z, quaternionValue.quaternionValue.w);
vect4 = EditorGUILayout.Vector4Field(new GUIContent(name.stringValue, ""), vect4);
quaternionValue.quaternionValue = new Quaternion(vect4.x, vect4.y, vect4.z, vect4.w);
break;
case InteractableThemePropertyValueTypes.Texture:
SerializedProperty texture = item.FindPropertyRelative("Texture");
EditorGUILayout.PropertyField(texture, new GUIContent(name.stringValue, ""), false);
break;
case InteractableThemePropertyValueTypes.Material:
SerializedProperty material = item.FindPropertyRelative("Material");
EditorGUILayout.PropertyField(material, new GUIContent(name.stringValue, ""), false);
break;
case InteractableThemePropertyValueTypes.AudioClip:
SerializedProperty audio = item.FindPropertyRelative("AudioClip");
EditorGUILayout.PropertyField(audio, new GUIContent(name.stringValue, ""), false);
break;
case InteractableThemePropertyValueTypes.Animaiton:
SerializedProperty animation = item.FindPropertyRelative("Animation");
EditorGUILayout.PropertyField(animation, new GUIContent(name.stringValue, ""), false);
break;
case InteractableThemePropertyValueTypes.GameObject:
SerializedProperty gameObjectValue = item.FindPropertyRelative("GameObject");
EditorGUILayout.PropertyField(gameObjectValue, new GUIContent(name.stringValue, ""), false);
break;
case InteractableThemePropertyValueTypes.String:
stringValue.stringValue = EditorGUILayout.TextField(new GUIContent(name.stringValue, ""), stringValue.stringValue);
break;
case InteractableThemePropertyValueTypes.Bool:
SerializedProperty boolValue = item.FindPropertyRelative("Bool");
boolValue.boolValue = EditorGUILayout.Toggle(new GUIContent(name.stringValue, ""), boolValue.boolValue);
break;
case InteractableThemePropertyValueTypes.AnimatorTrigger:
stringValue.stringValue = EditorGUILayout.TextField(new GUIContent(name.stringValue, ""), stringValue.stringValue);
break;
default:
break;
}
}
}
EditorGUI.indentLevel = indentOnSectionStart;
}
GUILayout.Space(5);
EditorGUILayout.EndVertical();
GUILayout.Space(5);
}