From aaea0c7f800a39f5e43e36e18837b174d344afdf Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 8 Sep 2021 23:46:05 +0800 Subject: +action data --- Assets/ActionTool/Editor/ActionPreviewEditor.cs | 29 ++++++++++-- .../ActionTool/Editor/AnimationPropertyEditor.cs | 54 ++++++++++++++++++++++ .../Editor/AnimationPropertyEditor.cs.meta | 11 +++++ 3 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 Assets/ActionTool/Editor/AnimationPropertyEditor.cs create mode 100644 Assets/ActionTool/Editor/AnimationPropertyEditor.cs.meta (limited to 'Assets/ActionTool') diff --git a/Assets/ActionTool/Editor/ActionPreviewEditor.cs b/Assets/ActionTool/Editor/ActionPreviewEditor.cs index c9358f98..a52a87ff 100644 --- a/Assets/ActionTool/Editor/ActionPreviewEditor.cs +++ b/Assets/ActionTool/Editor/ActionPreviewEditor.cs @@ -113,6 +113,7 @@ namespace ActionTool float y = kToolbarHeight + 5; GUI_Detail(ref y); + GUI_Properties(ref y); GUI_Parameters(ref y); GUI_Toggle(ref y); GUI_Curves(ref y); @@ -341,12 +342,14 @@ namespace ActionTool { float xl = 5, xr = xl + 105; GUI.Label(new Rect(xl, y, 105, 15), "Playback Frame:", styles.textMiddle); - GUI.Label(new Rect(xr, y, 510, 15), ActionManager.actionData.curAnimFrame.ToString("f2"), styles.textMiddleBold); + GUI.Label(new Rect(xr, y, 110, 15), ActionManager.actionData.curAnimFrame.ToString("f2"), styles.textMiddleBold); GUI.Label(new Rect(xl + 150, y, 105, 15), "Normalized Time:", styles.textMiddle); - GUI.Label(new Rect(xr + 150, y, 510, 15), ActionManager.actionData.curAnimTimeNormal.ToString("f2"), styles.textMiddleBold); + GUI.Label(new Rect(xr + 150, y, 110, 15), ActionManager.actionData.curAnimTimeNormal.ToString("f2"), styles.textMiddleBold); GUI.Label(new Rect(xl + 150 * 2, y, 105, 15), "Event Frame:", styles.textMiddle); - GUI.Label(new Rect(xr + 150 + 125, y, 510, 15), ((int)ActionManager.actionData.curAnimFrame).ToString(), styles.textMiddleBold); - y += 15; + GUI.Label(new Rect(xr + 150 + 125, y, 110, 15), ((int)ActionManager.actionData.curAnimFrame).ToString(), styles.textMiddleBold); + GUI.Label(new Rect(xl + 150 + 130 + 130, y, 105, 15), "Time:", styles.textMiddle); + GUI.Label(new Rect(xr + 150 + 130 + 70 , y, 510, 15), ((int)ActionManager.actionData.curAnimFrame).ToString(), styles.textMiddleBold); + y += 15; } @@ -364,6 +367,24 @@ namespace ActionTool y += 15; } + void GUI_Properties(ref float y) + { + AnimationData animData = ActionManager.animationData; + if (animData == null) + return; + var properties = animData.properties; + float x = 5; + GUI.Label(new Rect(x, y, 105, 15), "Properties:", styles.textMiddle); + x += 105; + GUI.Label(new Rect(x, y, 10, 15), (properties != null ? properties.Count : 0).ToString(), styles.textMiddleBold); + x += 20; + if (GUI.Button(new Rect(x, y, 50, 15), "Edit")) + { + EditorWindow.GetWindow(true); + } + y += 15; + } + void GUI_Parameters(ref float y) { AnimationData animData = ActionManager.animationData; diff --git a/Assets/ActionTool/Editor/AnimationPropertyEditor.cs b/Assets/ActionTool/Editor/AnimationPropertyEditor.cs new file mode 100644 index 00000000..59786bf9 --- /dev/null +++ b/Assets/ActionTool/Editor/AnimationPropertyEditor.cs @@ -0,0 +1,54 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace ActionTool +{ + + [CustomPropertyDrawer(typeof(PropertyDictionary))] + public class PropertyDictionaryDrawer : SerializableDictionaryPropertyDrawer { } + + public class AnimationPropertyEditor : EditorWindow + { + + SerializedObject obj; + + private void OnEnable() + { + titleContent = new GUIContent("Properties"); + minSize = new Vector2(300, 200); + maxSize = new Vector2(300, 2000); + } + + private void OnDisable() + { + } + + private void Update() + { + } + + private void OnGUI() + { + AnimationData animData = ActionManager.animationData; + if (animData == null) + { + this.Close(); + return; + } + + if (obj == null || obj.targetObject != animData) + { + obj = new SerializedObject(animData); + } + + var curves = obj.FindProperty("properties"); + EditorGUILayout.PropertyField(curves, true); + if (obj.ApplyModifiedProperties()) + { + } + } + } + +} diff --git a/Assets/ActionTool/Editor/AnimationPropertyEditor.cs.meta b/Assets/ActionTool/Editor/AnimationPropertyEditor.cs.meta new file mode 100644 index 00000000..efdc8fad --- /dev/null +++ b/Assets/ActionTool/Editor/AnimationPropertyEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ac9aacf41a77d2d4b8dbda78defdf534 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: -- cgit v1.1-26-g67d0