From 776b3a1b6a766f8e0cdb1d941fff4c8fbef24ada Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 13 Sep 2021 17:47:40 +0800 Subject: +anim --- Assets/ActionTool/ActionToolGizmos.cs | 11 ++++- Assets/ActionTool/Editor/ActionEditorStyles.cs | 13 ++++- Assets/ActionTool/Editor/ActionManager.cs | 1 + Assets/ActionTool/Editor/ActionNoteEditor.cs | 18 +++++++ Assets/ActionTool/Editor/ActionNoteEditor.cs.meta | 11 +++++ Assets/ActionTool/Editor/ActionPreviewEditor.cs | 59 +++++++++++++---------- 6 files changed, 84 insertions(+), 29 deletions(-) create mode 100644 Assets/ActionTool/Editor/ActionNoteEditor.cs create mode 100644 Assets/ActionTool/Editor/ActionNoteEditor.cs.meta (limited to 'Assets/ActionTool') diff --git a/Assets/ActionTool/ActionToolGizmos.cs b/Assets/ActionTool/ActionToolGizmos.cs index 58069527..938d2c51 100644 --- a/Assets/ActionTool/ActionToolGizmos.cs +++ b/Assets/ActionTool/ActionToolGizmos.cs @@ -29,6 +29,13 @@ namespace ActionTool bool m_IsShowRootMotion; + GameObject m_UnitRoot; + + public void Initialize(GameObject unitRoot) + { + m_UnitRoot = unitRoot; + } + public void SetAnimationData(AnimationData data) { m_AnimationData = data; @@ -56,7 +63,7 @@ namespace ActionTool void DrawRoot() { Gizmos.color = Color.yellow; - Gizmos.DrawCube(transform.position, new Vector3(0.1f, 0.1f, 0.1f)); + Gizmos.DrawCube(m_UnitRoot.transform.position, new Vector3(0.1f, 0.1f, 0.1f)); } void DrawAxis() @@ -96,7 +103,7 @@ namespace ActionTool pos.y += info.size.y / 2; break; } - pos += transform.position; + pos += m_UnitRoot.transform.position; Gizmos.color = color * 0.5f; Gizmos.DrawCube(pos, info.size); } diff --git a/Assets/ActionTool/Editor/ActionEditorStyles.cs b/Assets/ActionTool/Editor/ActionEditorStyles.cs index 4b002537..08993560 100644 --- a/Assets/ActionTool/Editor/ActionEditorStyles.cs +++ b/Assets/ActionTool/Editor/ActionEditorStyles.cs @@ -27,6 +27,8 @@ namespace ActionTool public GUIStyle starButton; public GUIStyle starButton2; + public GUIStyle infoButton; + public Texture2D selectIcon; public Texture2D keyFrameIcon; public Texture2D addFileIcon; @@ -60,7 +62,7 @@ namespace ActionTool addFileIcon = EditorGUIUtility.FindTexture("d_Collab.FileAdded"); saveFileIcon = EditorGUIUtility.FindTexture("d_Collab.FileUpdated"); deleteIcon = EditorGUIUtility.FindTexture("d_P4_DeletedLocal"); - infoIcon = EditorGUIUtility.FindTexture("console.infoicon"); + infoIcon = EditorGUIUtility.FindTexture("UnityEditor.InspectorWindow"); keyIcon = EditorGUIUtility.FindTexture("d_animationkeyframe"); starIcon = EditorGUIUtility.FindTexture("Favorite"); starIcon2 = EditorGUIUtility.FindTexture("Favorite Icon"); @@ -138,7 +140,14 @@ namespace ActionTool s.hover.background = starIcon2; s.focused.background = starIcon2; }); - InitStyle(out toggleSmallBold, GUI.skin.toggle, s => { + InitStyle(out infoButton, GUI.skin.button, s => + { + s.normal.background = infoIcon; + s.active.background = infoIcon; + s.hover.background = infoIcon; + s.focused.background = infoIcon; + }); + InitStyle(out toggleSmallBold, GUI.skin.toggle, s => { s.fontSize = 10; //s.fontStyle = FontStyle.Bold; }); diff --git a/Assets/ActionTool/Editor/ActionManager.cs b/Assets/ActionTool/Editor/ActionManager.cs index cb0d5d71..d9279745 100644 --- a/Assets/ActionTool/Editor/ActionManager.cs +++ b/Assets/ActionTool/Editor/ActionManager.cs @@ -276,6 +276,7 @@ namespace ActionTool s_Animator.applyRootMotion = false; s_Gizmos = s_RootActionTool.AddComponent(); + s_Gizmos.Initialize(unitRoot); Settings = AssetDatabase.LoadAssetAtPath(s_SettingPath); } diff --git a/Assets/ActionTool/Editor/ActionNoteEditor.cs b/Assets/ActionTool/Editor/ActionNoteEditor.cs new file mode 100644 index 00000000..fcc4e08a --- /dev/null +++ b/Assets/ActionTool/Editor/ActionNoteEditor.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ActionNoteEditor : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/ActionTool/Editor/ActionNoteEditor.cs.meta b/Assets/ActionTool/Editor/ActionNoteEditor.cs.meta new file mode 100644 index 00000000..a47cc903 --- /dev/null +++ b/Assets/ActionTool/Editor/ActionNoteEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 48a105c4026c65b428a22db4c350c5ef +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ActionTool/Editor/ActionPreviewEditor.cs b/Assets/ActionTool/Editor/ActionPreviewEditor.cs index a305ad72..eb3c95ba 100644 --- a/Assets/ActionTool/Editor/ActionPreviewEditor.cs +++ b/Assets/ActionTool/Editor/ActionPreviewEditor.cs @@ -261,6 +261,15 @@ namespace ActionTool "FrameRate: " + ActionManager.curClip.frameRate ); } + if (animationData) + { + Color bgColor = GUI.backgroundColor; + GUI.backgroundColor = animationData.note != null && animationData.note != "" ? bgColor : Color.gray; + if (GUI.Button(new Rect(xr + width + 10 + 50 + 10, y, 16, 14), "", styles.infoButton)) + { + } + GUI.backgroundColor = bgColor; + } y += 15; GUI.Label(new Rect(xl, y, 105, 15), "AnimationData:", styles.textMiddle); @@ -795,31 +804,31 @@ namespace ActionTool x += kToolbarControlSize; } - void GUI_Toolbar_Detail(ref float x, ref float y) - { - x += kToolbarControlMargin + 20; - Rect rect = new Rect(x, y, kToolbarControlSize, kToolbarControlSize); - GUI.enabled = !m_IsLeftOrRightButtonClicked && ActionManager.colliderData != null; - if (GUI.Button(rect, new GUIContent(styles.infoIcon, "Detail"))) - { - ActionManager.EditCollider(); - } - GUI.enabled = true; - x += kToolbarControlSize; - } - - void GUI_Toolbar_Delete(ref float x, ref float y) - { - x += kToolbarControlMargin; - Rect rect = new Rect(x, y, kToolbarControlSize, kToolbarControlSize); - GUI.enabled = !m_IsLeftOrRightButtonClicked && ActionManager.colliderData != null; - if (GUI.Button(rect, new GUIContent(styles.deleteIcon, "Delete this collider"))) - { - ActionManager.DeleteCurBox(); - } - GUI.enabled = true; - x += kToolbarControlSize; - } + //void GUI_Toolbar_Detail(ref float x, ref float y) + //{ + // x += kToolbarControlMargin + 20; + // Rect rect = new Rect(x, y, kToolbarControlSize, kToolbarControlSize); + // GUI.enabled = !m_IsLeftOrRightButtonClicked && ActionManager.colliderData != null; + // if (GUI.Button(rect, new GUIContent(styles.infoIcon, "Detail"))) + // { + // ActionManager.EditCollider(); + // } + // GUI.enabled = true; + // x += kToolbarControlSize; + //} + + //void GUI_Toolbar_Delete(ref float x, ref float y) + //{ + // x += kToolbarControlMargin; + // Rect rect = new Rect(x, y, kToolbarControlSize, kToolbarControlSize); + // GUI.enabled = !m_IsLeftOrRightButtonClicked && ActionManager.colliderData != null; + // if (GUI.Button(rect, new GUIContent(styles.deleteIcon, "Delete this collider"))) + // { + // ActionManager.DeleteCurBox(); + // } + // GUI.enabled = true; + // x += kToolbarControlSize; + //} void GUI_Toolbar_NewAnimationData(ref float x, ref float y) { -- cgit v1.1-26-g67d0