summaryrefslogtreecommitdiff
path: root/Assets/ActionTool/Editor/ActionRootMotionEditor.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/ActionTool/Editor/ActionRootMotionEditor.cs')
-rw-r--r--Assets/ActionTool/Editor/ActionRootMotionEditor.cs83
1 files changed, 83 insertions, 0 deletions
diff --git a/Assets/ActionTool/Editor/ActionRootMotionEditor.cs b/Assets/ActionTool/Editor/ActionRootMotionEditor.cs
new file mode 100644
index 00000000..ff0dae62
--- /dev/null
+++ b/Assets/ActionTool/Editor/ActionRootMotionEditor.cs
@@ -0,0 +1,83 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEditor;
+
+namespace ActionTool
+{
+ public class ActionRootMotionEditor : EditorWindow
+ {
+ ActionEditorStyles styles;
+
+ public static bool IsRecord { get; private set; }
+
+ const float kToolbarControlMargin = 5;
+ const float kToolbarHeight = 50;
+ const float kToolbarControlSize = kToolbarHeight - kToolbarControlMargin * 2;
+ float m_ToolbarOffset = 0; // <= 0
+
+ Texture m_UITextureRecord;
+ Texture m_UITextureTakeRecord;
+
+ Texture2D tex;
+
+ private void OnEnable()
+ {
+ maxSize = new Vector2(300, 80);
+ minSize = maxSize;
+ this.titleContent = new GUIContent("RootMotion Editor");
+
+ m_UITextureRecord = (Texture)Resources.Load("button_control_record");
+ m_UITextureTakeRecord = (Texture)Resources.Load("button_control_takerecord");
+ tex = new Texture2D(1, 1, TextureFormat.RGBA32, false);
+ tex.SetPixel(0, 0, new Color(1f, 0, 0) * 0.8f);
+ tex.Apply();
+ }
+
+ private void OnDisable()
+ {
+
+ }
+
+ private void Update()
+ {
+
+ }
+
+ private void OnGUI()
+ {
+ if(ActionManager.animationData == null || ActionManager.animationData.overrideRootMotion == null)
+ {
+ this.Close();
+ return;
+ }
+ if (IsRecord)
+ {
+ GUI.DrawTexture(new Rect(0, 0, maxSize.x, maxSize.y), tex, ScaleMode.StretchToFill);
+ }
+ float x = m_ToolbarOffset, y = kToolbarControlMargin;
+ GUI_Record(ref x, ref y);
+ GUI_TakeRecord(ref x, ref y);
+ }
+
+ void GUI_Record(ref float x, ref float y)
+ {
+ x += kToolbarControlMargin;
+ Rect rect = new Rect(x, y, kToolbarControlSize, kToolbarControlSize);
+ IsRecord = GUI.Toggle(rect, IsRecord, m_UITextureRecord, GUI.skin.button);
+ x += kToolbarControlSize;
+ }
+
+ void GUI_TakeRecord(ref float x, ref float y)
+ {
+ x += kToolbarControlMargin;
+ Rect rect = new Rect(x, y, kToolbarControlSize, kToolbarControlSize);
+ if (GUI.Button(rect, m_UITextureTakeRecord))
+ {
+
+ }
+ x += kToolbarControlSize;
+ }
+
+ }
+} \ No newline at end of file