From 7a73788fec18aa8648a4ff7d1d86760b22908513 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 2 Sep 2021 16:50:41 +0800 Subject: *misc --- Assets/ActionTool/Editor/ActionPreviewEditor.cs | 28 ++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'Assets/ActionTool/Editor/ActionPreviewEditor.cs') diff --git a/Assets/ActionTool/Editor/ActionPreviewEditor.cs b/Assets/ActionTool/Editor/ActionPreviewEditor.cs index 271c66da..1e4204c2 100644 --- a/Assets/ActionTool/Editor/ActionPreviewEditor.cs +++ b/Assets/ActionTool/Editor/ActionPreviewEditor.cs @@ -80,6 +80,9 @@ namespace ActionTool void Update() { ActionManager.UpdateFrame(); + + if(ActionManager.RootMotionEditor != null) + ActionManager.RootMotionEditor.Repaint(); } private void OnDisable() @@ -284,7 +287,7 @@ namespace ActionTool y += 15; GUI.Label(new Rect(xl, y, 105, 15), "RootMotion:", styles.textMiddle); - if(actionData.rootMotion != null && (animationData == null || animationData.overrideRootMotion == null)) + if(actionData.rootMotion != null && (animationData == null || animationData.overrideRootMotion == false)) { width = styles.textMiddleBold.CalcSize(new GUIContent(ActionManager.actionData.rootMotionPath)).x; GUI.Label(new Rect(xr, y, width, 15), ActionManager.actionData.rootMotionPath, styles.textMiddleBold); @@ -303,7 +306,7 @@ namespace ActionTool } } } - else if(animationData != null && animationData.overrideRootMotion != null) + else if(animationData != null && animationData.overrideRootMotion == true) { width = styles.textMiddle.CalcSize(new GUIContent("Override")).x; GUI.Label(new Rect(xr, y, width, 15), "Override", styles.textMiddle); @@ -548,7 +551,7 @@ namespace ActionTool void GUI_RM() { var animData = ActionManager.animationData; - if (animData == null || animData.overrideRootMotion == null) + if (animData == null || animData.overrideRootMotion == false) return; float y = m_GridY + (ActionManager.MaxEventsPerFrame + 1) * kFrameHeight; Rect rect = new Rect(kTimeLineViewXOffset - 17, y - 1, 17, kFrameHeight); @@ -559,13 +562,28 @@ namespace ActionTool Rect lb = rect; lb.y += 3; GUI.Label(lb, "RM", styles.textBoldSmall); - + // + var rmData = animData.rootMotionOverrideData; + if (rmData == null) + return; + for(int i = 0; i < rmData.positions.Count; ++i) + { + var posData = rmData.positions[i]; + if (posData == null) + continue; + int frame = posData.frame; + Vector2 pos = new Vector2(kTimeLineViewXOffset + frame * kFrameWidth, y); + if(GUI.Button(new Rect(pos.x - 1, pos.y + 3, kFrameWidth + 1, kFrameWidth), "", styles.keyButton)) + { + ActionManager.actionData.SetCurrentAnimTime(frame); + } + } } void GUI_Boxes() { var animData = ActionManager.animationData; - bool hasRM = animData != null && animData.overrideRootMotion != null; + bool hasRM = animData != null && animData.overrideRootMotion == true; float y = m_GridY + (ActionManager.MaxEventsPerFrame + 1 + (hasRM ? 1:0)) * kFrameHeight; if (animData == null) return; -- cgit v1.1-26-g67d0