VertexAnimation/Editor/Scripts/ModelBaker/Editor/VA_ModelBakerEditor.cs

77 lines
2.4 KiB
C#
Raw Normal View History

using UnityEngine;
using UnityEditor;
namespace TAO.VertexAnimation.Editor
{
2021-01-18 13:01:47 +01:00
[CustomEditor(typeof(VA_ModelBaker))]
public class VA_ModelBakerEditor : UnityEditor.Editor
{
private VA_ModelBaker modelBaker = null;
2021-01-18 13:01:47 +01:00
void OnEnable()
{
modelBaker = target as VA_ModelBaker;
}
2021-01-18 13:01:47 +01:00
public override void OnInspectorGUI()
{
serializedObject.Update();
2021-01-18 13:01:47 +01:00
InputGUI();
EditorGUILayoutUtils.HorizontalLine(color: Color.gray);
BakeGUI();
2021-01-18 13:01:47 +01:00
serializedObject.ApplyModifiedProperties();
}
2021-01-18 13:01:47 +01:00
private void InputGUI()
{
EditorGUILayout.PropertyField(serializedObject.FindProperty("model"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("animationClips"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("fps"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("textureWidth"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("applyRootMotion"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("includeInactive"));
2021-01-18 13:01:47 +01:00
}
2021-01-18 13:01:47 +01:00
private void BakeGUI()
{
2021-01-18 22:59:57 +01:00
EditorGUILayout.PropertyField(serializedObject.FindProperty("lodSettings").FindPropertyRelative("lodSettings"));
2021-02-18 18:29:40 +01:00
EditorGUILayout.PropertyField(serializedObject.FindProperty("applyAnimationBounds"));
2021-01-18 22:59:57 +01:00
EditorGUILayout.PropertyField(serializedObject.FindProperty("generateAnimationBook"));
2021-01-18 22:59:57 +01:00
using (new EditorGUILayout.HorizontalScope())
2021-01-18 13:01:47 +01:00
{
2021-01-18 22:59:57 +01:00
EditorGUILayout.PropertyField(serializedObject.FindProperty("generatePrefab"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("materialShader"), new GUIContent(""));
2021-01-18 13:01:47 +01:00
}
2021-02-09 17:21:42 +01:00
EditorGUILayout.PropertyField(serializedObject.FindProperty("useNormalA"), new GUIContent("Use Normal (A)"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("useInterpolation"));
2021-01-18 13:01:47 +01:00
if (GUILayout.Button("Bake", GUILayout.Height(32)))
{
modelBaker.Bake();
}
using (new EditorGUILayout.HorizontalScope())
2021-01-18 13:01:47 +01:00
{
if (GUILayout.Button("Delete Unused Animations", EditorStyles.miniButtonLeft))
2021-01-18 13:01:47 +01:00
{
if (EditorUtility.DisplayDialog("Delete Unused Animations", "Deleting assets will loose references within the project.", "Ok", "Cancel"))
{
modelBaker.DeleteUnusedAnimations();
}
2021-01-18 13:01:47 +01:00
}
if (GUILayout.Button("Delete", EditorStyles.miniButtonRight))
{
if (EditorUtility.DisplayDialog("Delete Assets", "Deleting assets will loose references within the project.", "Ok", "Cancel"))
{
modelBaker.DeleteSavedAssets();
}
}
2021-01-18 13:01:47 +01:00
}
}
}
}