From 754ceacd8ab62e7094f1827ae45ea16a502725ad Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 6 Aug 2021 19:02:03 +0800 Subject: *curve --- Assets/ActionTool/Editor/ActionPreviewEditor.cs | 53 ++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 6 deletions(-) (limited to 'Assets/ActionTool/Editor/ActionPreviewEditor.cs') diff --git a/Assets/ActionTool/Editor/ActionPreviewEditor.cs b/Assets/ActionTool/Editor/ActionPreviewEditor.cs index dc855fad..32731deb 100644 --- a/Assets/ActionTool/Editor/ActionPreviewEditor.cs +++ b/Assets/ActionTool/Editor/ActionPreviewEditor.cs @@ -102,7 +102,10 @@ namespace ActionTool float y = kToolbarHeight + 5; GUI_Detail(ref y); + GUI_Toggle(ref y); + GUI_Curves(ref y); GUI_Curve(ref y); + y += 5; GUI_Setting(ref y); GUI_TimeLineView(ref y); } @@ -293,19 +296,57 @@ namespace ActionTool float x = 5; GUI.Label(new Rect(x, y, 105, 15), "Speed Curve:", styles.textMiddle); x += 105; - animData.curve = EditorGUI.CurveField(new Rect(x, y, 210, 15), animData.curve); + animData.speedCurve = EditorGUI.CurveField(new Rect(x, y, 210, 15), animData.speedCurve); ui.DrawVerticalLineFast(x + 210 * ActionManager.actionData.curAnimTimeNormal, y , y + 15, Color.red); - y += 20; + y += 15; } - void GUI_Setting(ref float y) + void GUI_Toggle(ref float y) + { + AnimationData animData = ActionManager.animationData; + if (animData == null) + return; + var toggles = animData.toggles; + float x = 5; + GUI.Label(new Rect(x, y, 105, 15), "Toggles:", styles.textMiddle); + x += 105; + GUI.Label(new Rect(x, y, 10, 15), (toggles != null ? toggles.Count : 0).ToString(), styles.textMiddleBold); + //if(toggles != null && toggles.Count > 0) + //{ + x += 20; + if(GUI.Button(new Rect(x, y, 50, 15), "Edit")) + { + EditorWindow.GetWindow(true); + } + //} + y += 15; + } + void GUI_Curves(ref float y) + { + AnimationData animData = ActionManager.animationData; + if (animData == null) + return; + var curves = animData.curves; + float x = 5; + GUI.Label(new Rect(x, y, 105, 15), "Curves:", styles.textMiddle); + x += 105; + GUI.Label(new Rect(x, y, 10, 15), (curves != null ? curves.Count : 0).ToString(), styles.textMiddleBold); + x += 20; + if (GUI.Button(new Rect(x, y, 50, 15), "Edit")) + { + EditorWindow.GetWindow(true); + } + y += 15; + } + + void GUI_Setting(ref float y) { ActionData action = ActionManager.actionData; float x = 5; action.applyRootMotion = GUI.Toggle(new Rect(x, y, 120, 15), action.applyRootMotion, "Apply RootMotion", styles.toggleSmallBold); x += 130; - action.applyCurve = GUI.Toggle(new Rect(x, y, 120, 15), action.applyCurve, "Apply Curve", styles.toggleSmallBold); + action.applyCurve = GUI.Toggle(new Rect(x, y, 120, 15), action.applyCurve, "Apply SpeedCurve", styles.toggleSmallBold); y += 20; } @@ -735,7 +776,7 @@ namespace ActionTool ActionData action = ActionManager.actionData; Vector2 position = Event.current.mousePosition; - Rect eventRegion = new Rect(kTimeLineViewXOffset, m_GridY, action.totalFrame * kFrameWidth, UnitTimeline.kMaxEventsPerFrame * kFrameHeight); + Rect eventRegion = new Rect(kTimeLineViewXOffset, m_GridY, action.totalFrame * kFrameWidth, TimelineEventProxy.kMaxEventsPerFrame * kFrameHeight); if (!eventRegion.Contains(position)) return; @@ -743,7 +784,7 @@ namespace ActionTool int frame = (int)(pos.x / kFrameWidth); GenericMenu eventMenu = new GenericMenu(); - foreach(var name in Enum.GetNames(typeof(UnitTimeline.EEventType))) + foreach(var name in Enum.GetNames(typeof(TimelineEventProxy.EEventType))) { GUIContent item = null; string shortName = name.Replace("Event", ""); -- cgit v1.1-26-g67d0