public CurveControlPointRenderer(CurveEditor.Styles style) { this.m_UnselectedPointRenderer = new ControlPointRenderer(style.pointIcon); this.m_SelectedPointRenderer = new ControlPointRenderer(style.pointIconSelected); this.m_SelectedPointOverlayRenderer = new ControlPointRenderer(style.pointIconSelectedOverlay); this.m_SemiSelectedPointOverlayRenderer = new ControlPointRenderer(style.pointIconSemiSelectedOverlay); }
internal CurveSelection(int curveID, CurveEditor host, int keyIndex, CurveSelection.SelectionType t) { this.m_CurveID = curveID; this.m_Host = host; this.m_Key = keyIndex; this.type = t; }
internal CurveSelection(int curveID, CurveEditor host, int keyIndex) { this.m_Key = -1; this.m_CurveID = curveID; this.m_Host = host; this.m_Key = keyIndex; this.type = SelectionType.Key; }
public static CurveSelection AnimationWindowKeyframeToCurveSelection(AnimationWindowKeyframe keyframe, CurveEditor curveEditor) { foreach (CurveWrapper wrapper in curveEditor.animationCurves) { if ((wrapper.binding == keyframe.curve.binding) && (keyframe.GetIndex() >= 0)) { return new CurveSelection(wrapper.id, curveEditor, keyframe.GetIndex()); } } return null; }
public void EventLineGUI(Rect rect, AnimationSelection selection, AnimationWindowState state, CurveEditor curveEditor) { AnimationClip activeAnimationClip = state.m_ActiveAnimationClip; GameObject rootGameObject = state.m_RootGameObject; GUI.BeginGroup(rect); Color color = GUI.color; Rect rect2 = new Rect(0f, 0f, rect.width, rect.height); float time = (float)Mathf.RoundToInt(state.PixelToTime(Event.current.mousePosition.x, rect) * state.frameRate) / state.frameRate; if (activeAnimationClip != null) { AnimationEvent[] animationEvents = AnimationUtility.GetAnimationEvents(activeAnimationClip); Texture image = EditorGUIUtility.IconContent("Animation.EventMarker").image; Rect[] array = new Rect[animationEvents.Length]; Rect[] array2 = new Rect[animationEvents.Length]; int num = 1; int num2 = 0; for (int i = 0; i < animationEvents.Length; i++) { AnimationEvent animationEvent = animationEvents[i]; if (num2 == 0) { num = 1; while (i + num < animationEvents.Length && animationEvents[i + num].time == animationEvent.time) { num++; } num2 = num; } num2--; float num3 = Mathf.Floor(state.FrameToPixel(animationEvent.time * activeAnimationClip.frameRate, rect)); int num4 = 0; if (num > 1) { float num5 = (float)Mathf.Min((num - 1) * (image.width - 1), (int)(state.FrameDeltaToPixel(rect) - (float)(image.width * 2))); num4 = Mathf.FloorToInt(Mathf.Max(0f, num5 - (float)((image.width - 1) * num2))); } Rect rect3 = new Rect(num3 + (float)num4 - (float)(image.width / 2), (rect.height - 10f) * (float)(num2 - num + 1) / (float)Mathf.Max(1, num - 1), (float)image.width, (float)image.height); array[i] = rect3; array2[i] = rect3; } if (this.m_DirtyTooltip) { if (this.m_HoverEvent >= 0 && this.m_HoverEvent < array.Length) { this.m_InstantTooltipText = AnimationEventPopup.FormatEvent(rootGameObject, animationEvents[this.m_HoverEvent]); this.m_InstantTooltipPoint = new Vector2(array[this.m_HoverEvent].xMin + (float)((int)(array[this.m_HoverEvent].width / 2f)) + rect.x - 30f, rect.yMax); } this.m_DirtyTooltip = false; } if (this.m_EventsSelected == null || this.m_EventsSelected.Length != animationEvents.Length) { this.m_EventsSelected = new bool[animationEvents.Length]; AnimationEventPopup.ClosePopup(); } Vector2 zero = Vector2.zero; int num6; float num7; float num8; HighLevelEvent highLevelEvent = EditorGUIExt.MultiSelection(rect, array2, new GUIContent(image), array, ref this.m_EventsSelected, null, out num6, out zero, out num7, out num8, GUIStyleX.none); if (highLevelEvent != HighLevelEvent.None) { switch (highLevelEvent) { case HighLevelEvent.DoubleClick: if (num6 != -1) { AnimationEventPopup.Edit(rootGameObject, selection.clip, num6, this.m_Owner); } else { this.EventLineContextMenuAdd(new AnimationEventTimeLine.EventLineContextMenuObject(rootGameObject, activeAnimationClip, time, -1)); } break; case HighLevelEvent.ContextClick: { GenericMenu genericMenu = new GenericMenu(); AnimationEventTimeLine.EventLineContextMenuObject userData = new AnimationEventTimeLine.EventLineContextMenuObject(rootGameObject, activeAnimationClip, animationEvents[num6].time, num6); genericMenu.AddItem(new GUIContent("Edit Animation Event"), false, new GenericMenu.MenuFunction2(this.EventLineContextMenuEdit), userData); genericMenu.AddItem(new GUIContent("Add Animation Event"), false, new GenericMenu.MenuFunction2(this.EventLineContextMenuAdd), userData); genericMenu.AddItem(new GUIContent("Delete Animation Event"), false, new GenericMenu.MenuFunction2(this.EventLineContextMenuDelete), userData); genericMenu.ShowAsContext(); this.m_InstantTooltipText = null; this.m_DirtyTooltip = true; state.Repaint(); break; } case HighLevelEvent.BeginDrag: this.m_EventsAtMouseDown = animationEvents; this.m_EventTimes = new float[animationEvents.Length]; for (int j = 0; j < animationEvents.Length; j++) { this.m_EventTimes[j] = animationEvents[j].time; } break; case HighLevelEvent.Drag: { for (int k = animationEvents.Length - 1; k >= 0; k--) { if (this.m_EventsSelected[k]) { AnimationEvent animationEvent2 = this.m_EventsAtMouseDown[k]; animationEvent2.time = this.m_EventTimes[k] + zero.x * state.PixelDeltaToTime(rect); animationEvent2.time = Mathf.Max(0f, animationEvent2.time); animationEvent2.time = (float)Mathf.RoundToInt(animationEvent2.time * activeAnimationClip.frameRate) / activeAnimationClip.frameRate; this.m_EventsAtMouseDown[k] = animationEvent2; } } int[] array3 = new int[this.m_EventsSelected.Length]; for (int l = 0; l < array3.Length; l++) { array3[l] = l; } Array.Sort(this.m_EventsAtMouseDown, array3, new AnimationEventTimeLine.EventComparer()); bool[] array4 = (bool[])this.m_EventsSelected.Clone(); float[] array5 = (float[])this.m_EventTimes.Clone(); for (int m = 0; m < array3.Length; m++) { this.m_EventsSelected[m] = array4[array3[m]]; this.m_EventTimes[m] = array5[array3[m]]; } Undo.RegisterCompleteObjectUndo(activeAnimationClip, "Move Event"); AnimationUtility.SetAnimationEvents(activeAnimationClip, this.m_EventsAtMouseDown); this.m_DirtyTooltip = true; break; } case HighLevelEvent.Delete: this.DeleteEvents(activeAnimationClip, this.m_EventsSelected); break; case HighLevelEvent.SelectionChanged: curveEditor.SelectNone(); if (num6 != -1) { AnimationEventPopup.UpdateSelection(rootGameObject, selection.clip, num6, this.m_Owner); } break; } } this.CheckRectsOnMouseMove(rect, animationEvents, array); } if (Event.current.type == EventType.ContextClick && rect2.Contains(Event.current.mousePosition) && selection.EnsureClipPresence()) { Event.current.Use(); GenericMenu genericMenu2 = new GenericMenu(); genericMenu2.AddItem(new GUIContent("Add Animation Event"), false, new GenericMenu.MenuFunction2(this.EventLineContextMenuAdd), new AnimationEventTimeLine.EventLineContextMenuObject(rootGameObject, activeAnimationClip, time, -1)); genericMenu2.ShowAsContext(); } GUI.color = color; GUI.EndGroup(); }
private void OnEnable() { this.m_AudioClip = base.serializedObject.FindProperty("m_audioClip"); this.m_PlayOnAwake = base.serializedObject.FindProperty("m_PlayOnAwake"); this.m_Volume = base.serializedObject.FindProperty("m_Volume"); this.m_Pitch = base.serializedObject.FindProperty("m_Pitch"); this.m_Loop = base.serializedObject.FindProperty("Loop"); this.m_Mute = base.serializedObject.FindProperty("Mute"); this.m_Spatialize = base.serializedObject.FindProperty("Spatialize"); this.m_Priority = base.serializedObject.FindProperty("Priority"); this.m_DopplerLevel = base.serializedObject.FindProperty("DopplerLevel"); this.m_MinDistance = base.serializedObject.FindProperty("MinDistance"); this.m_MaxDistance = base.serializedObject.FindProperty("MaxDistance"); this.m_Pan2D = base.serializedObject.FindProperty("Pan2D"); this.m_RolloffMode = base.serializedObject.FindProperty("rolloffMode"); this.m_BypassEffects = base.serializedObject.FindProperty("BypassEffects"); this.m_BypassListenerEffects = base.serializedObject.FindProperty("BypassListenerEffects"); this.m_BypassReverbZones = base.serializedObject.FindProperty("BypassReverbZones"); this.m_OutputAudioMixerGroup = base.serializedObject.FindProperty("OutputAudioMixerGroup"); this.m_AudioCurves = new AudioCurveWrapper[] { new AudioCurveWrapper(AudioCurveType.Volume, "Volume", 0, kRolloffCurveColor, base.serializedObject.FindProperty("rolloffCustomCurve"), 0f, 1f), new AudioCurveWrapper(AudioCurveType.SpatialBlend, "Spatial Blend", 1, kSpatialCurveColor, base.serializedObject.FindProperty("panLevelCustomCurve"), 0f, 1f), new AudioCurveWrapper(AudioCurveType.Spread, "Spread", 2, kSpreadCurveColor, base.serializedObject.FindProperty("spreadCustomCurve"), 0f, 1f), new AudioCurveWrapper(AudioCurveType.Lowpass, "Low-Pass", 3, kLowPassCurveColor, null, 0f, 1f), new AudioCurveWrapper(AudioCurveType.ReverbZoneMix, "Reverb Zone Mix", 4, kReverbZoneMixCurveColor, base.serializedObject.FindProperty("reverbZoneMixCustomCurve"), 0f, 1.1f) }; m_CurveEditorSettings.hRangeMin = 0f; m_CurveEditorSettings.vRangeMin = 0f; m_CurveEditorSettings.vRangeMax = 1.1f; m_CurveEditorSettings.hRangeMax = 1f; m_CurveEditorSettings.vSlider = false; m_CurveEditorSettings.hSlider = false; TickStyle style = new TickStyle { color = new Color(0f, 0f, 0f, 0.15f), distLabel = 30 }; m_CurveEditorSettings.hTickStyle = style; TickStyle style2 = new TickStyle { color = new Color(0f, 0f, 0f, 0.15f), distLabel = 20 }; m_CurveEditorSettings.vTickStyle = style2; this.m_CurveEditor = new CurveEditor(new Rect(0f, 0f, 1000f, 100f), new CurveWrapper[0], false); this.m_CurveEditor.settings = m_CurveEditorSettings; this.m_CurveEditor.margin = 25f; this.m_CurveEditor.SetShownHRangeInsideMargins(0f, 1f); this.m_CurveEditor.SetShownVRangeInsideMargins(0f, 1.1f); this.m_CurveEditor.ignoreScrollWheelUntilClicked = true; this.m_LastListenerPosition = AudioUtil.GetListenerPos(); EditorApplication.update = (EditorApplication.CallbackFunction) Delegate.Combine(EditorApplication.update, new EditorApplication.CallbackFunction(this.Update)); Undo.undoRedoPerformed = (Undo.UndoRedoCallback) Delegate.Combine(Undo.undoRedoPerformed, new Undo.UndoRedoCallback(this.UndoRedoPerformed)); this.m_Expanded3D = EditorPrefs.GetBool("AudioSourceExpanded3D", this.m_Expanded3D); }
public void Awake() { if (this.state == null) { this.state = new AnimationWindowState(); this.state.m_ShowCurveEditor = false; this.state.m_AnimationWindow = this; } this.state.timeArea = null; base.minSize = new Vector2(400f, 200f); this.m_HorizontalSplitter = new SplitterState(new float[] { 250f, 10000f }, new int[] { 250, 150 }, null); this.m_HorizontalSplitter.realSizes[0] = 300; base.wantsMouseMove = true; AnimationWindow.m_Selected = new AnimationSelection[0]; if (this.m_ExpandedFoldouts == null) { this.m_ExpandedFoldouts = new SerializedStringTable(); } if (this.m_ChosenAnimated == null) { this.m_ChosenAnimated = new SerializedStringTable(); } if (this.m_ChosenClip == null) { this.m_ChosenClip = new SerializedStringTable(); } this.m_CurveEditor = new CurveEditor(new Rect(base.position.x, base.position.y, 500f, 200f), new CurveWrapper[0], false); this.SetGridColors(); this.m_CurveEditor.m_TimeUpdater = this; this.m_CurveEditor.m_DefaultBounds = new Bounds(new Vector3(1f, 1f, 0f), new Vector3(2f, 1000f, 0f)); this.m_CurveEditor.SetShownHRangeInsideMargins(0f, 2f); this.m_CurveEditor.hTicks.SetTickModulosForFrameRate(this.state.frameRate); this.InitAllViews(); this.InitSelection(); }
public static CurveSelection AnimationWindowKeyframeToCurveSelection(AnimationWindowKeyframe keyframe, CurveEditor curveEditor) { foreach (CurveWrapper animationCurve in curveEditor.animationCurves) { if (animationCurve.binding == keyframe.curve.binding && keyframe.GetIndex() >= 0) return new CurveSelection(animationCurve.id, curveEditor, keyframe.GetIndex()); } return (CurveSelection) null; }
public override void Initialize(TimeArea timeArea) { base.Initialize(timeArea); this.m_CurveEditor = timeArea as CurveEditor; if (this.m_HBarLeft == null) { this.m_HBarLeft = new AreaManipulator(base.styles.rectangleToolHBarLeft, MouseCursor.ResizeHorizontal); this.m_HBarLeft.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_HBarLeft.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartScale(RectangleTool.ToolCoord.Right, RectangleTool.ToolCoord.Left, new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), DragMode.ScaleHorizontal, base.rippleTimeClutch); return true; } return false; }); this.m_HBarLeft.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_HBarLeft.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate)); return true; }); this.m_HBarLeft.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_HBarLeft.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return true; }); } if (this.m_HBarRight == null) { this.m_HBarRight = new AreaManipulator(base.styles.rectangleToolHBarRight, MouseCursor.ResizeHorizontal); this.m_HBarRight.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_HBarRight.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartScale(RectangleTool.ToolCoord.Left, RectangleTool.ToolCoord.Right, new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), DragMode.ScaleHorizontal, base.rippleTimeClutch); return true; } return false; }); this.m_HBarRight.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_HBarRight.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate)); return true; }); this.m_HBarRight.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_HBarRight.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return true; }); } if (this.m_HBar == null) { this.m_HBar = new AreaManipulator(base.styles.rectangleToolHBar, MouseCursor.MoveArrow); this.m_HBar.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_HBar.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartMove(new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), DragMode.MoveHorizontal, base.rippleTimeClutch); return true; } return false; }); this.m_HBar.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_HBar.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnMove(new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f)); return true; }); this.m_HBar.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_HBar.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnEndMove(); return true; }); } if (this.m_VBarBottom == null) { this.m_VBarBottom = new AreaManipulator(base.styles.rectangleToolVBarBottom, MouseCursor.ResizeVertical); this.m_VBarBottom.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_VBarBottom.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartScale(RectangleTool.ToolCoord.Top, RectangleTool.ToolCoord.Bottom, new Vector2(0f, base.PixelToValue(evt.mousePosition.y)), DragMode.ScaleVertical, false); return true; } return false; }); this.m_VBarBottom.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_VBarBottom.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnScaleValue(base.PixelToValue(evt.mousePosition.y)); return true; }); this.m_VBarBottom.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_VBarBottom.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return true; }); } if (this.m_VBarTop == null) { this.m_VBarTop = new AreaManipulator(base.styles.rectangleToolVBarTop, MouseCursor.ResizeVertical); this.m_VBarTop.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_VBarTop.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartScale(RectangleTool.ToolCoord.Bottom, RectangleTool.ToolCoord.Top, new Vector2(0f, base.PixelToValue(evt.mousePosition.y)), DragMode.ScaleVertical, false); return true; } return false; }); this.m_VBarTop.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_VBarTop.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnScaleValue(base.PixelToValue(evt.mousePosition.y)); return true; }); this.m_VBarTop.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_VBarTop.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return true; }); } if (this.m_VBar == null) { this.m_VBar = new AreaManipulator(base.styles.rectangleToolVBar, MouseCursor.MoveArrow); this.m_VBar.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_VBar.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartMove(new Vector2(0f, base.PixelToValue(evt.mousePosition.y)), DragMode.MoveVertical, false); return true; } return false; }); this.m_VBar.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_VBar.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnMove(new Vector2(0f, base.PixelToValue(evt.mousePosition.y))); return true; }); this.m_VBar.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_VBar.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnEndMove(); return true; }); } if (this.m_SelectionBox == null) { this.m_SelectionBox = new AreaManipulator(base.styles.rectangleToolSelection, MouseCursor.MoveArrow); this.m_SelectionBox.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_SelectionBox.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { bool flag = evt.shift || EditorGUI.actionKey; if ((!(Mathf.Approximately(this.selectionBounds.size.x, 0f) && Mathf.Approximately(this.selectionBounds.size.y, 0f)) && !flag) && (this.hasSelection && manipulator.rect.Contains(evt.mousePosition))) { this.OnStartMove(new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), base.PixelToValue(evt.mousePosition.y)), !base.rippleTimeClutch ? DragMode.MoveBothAxis : DragMode.MoveHorizontal, base.rippleTimeClutch); return true; } return false; }); this.m_SelectionBox.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_SelectionBox.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnMove(new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), base.PixelToValue(evt.mousePosition.y))); return true; }); this.m_SelectionBox.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_SelectionBox.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnEndMove(); return true; }); } if (this.m_SelectionScaleLeft == null) { this.m_SelectionScaleLeft = new AreaManipulator(base.styles.rectangleToolScaleLeft, MouseCursor.ResizeHorizontal); this.m_SelectionScaleLeft.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_SelectionScaleLeft.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartScale(RectangleTool.ToolCoord.Right, RectangleTool.ToolCoord.Left, new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), DragMode.ScaleHorizontal, base.rippleTimeClutch); return true; } return false; }); this.m_SelectionScaleLeft.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_SelectionScaleLeft.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate)); return true; }); this.m_SelectionScaleLeft.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_SelectionScaleLeft.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return true; }); } if (this.m_SelectionScaleRight == null) { this.m_SelectionScaleRight = new AreaManipulator(base.styles.rectangleToolScaleRight, MouseCursor.ResizeHorizontal); this.m_SelectionScaleRight.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_SelectionScaleRight.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartScale(RectangleTool.ToolCoord.Left, RectangleTool.ToolCoord.Right, new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), DragMode.ScaleHorizontal, base.rippleTimeClutch); return true; } return false; }); this.m_SelectionScaleRight.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_SelectionScaleRight.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate)); return true; }); this.m_SelectionScaleRight.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_SelectionScaleRight.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return true; }); } if (this.m_SelectionScaleBottom == null) { this.m_SelectionScaleBottom = new AreaManipulator(base.styles.rectangleToolScaleBottom, MouseCursor.ResizeVertical); this.m_SelectionScaleBottom.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_SelectionScaleBottom.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartScale(RectangleTool.ToolCoord.Top, RectangleTool.ToolCoord.Bottom, new Vector2(0f, base.PixelToValue(evt.mousePosition.y)), DragMode.ScaleVertical, false); return true; } return false; }); this.m_SelectionScaleBottom.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_SelectionScaleBottom.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnScaleValue(base.PixelToValue(evt.mousePosition.y)); return true; }); this.m_SelectionScaleBottom.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_SelectionScaleBottom.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return true; }); } if (this.m_SelectionScaleTop == null) { this.m_SelectionScaleTop = new AreaManipulator(base.styles.rectangleToolScaleTop, MouseCursor.ResizeVertical); this.m_SelectionScaleTop.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(this.m_SelectionScaleTop.onStartDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartScale(RectangleTool.ToolCoord.Bottom, RectangleTool.ToolCoord.Top, new Vector2(0f, base.PixelToValue(evt.mousePosition.y)), DragMode.ScaleVertical, false); return true; } return false; }); this.m_SelectionScaleTop.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(this.m_SelectionScaleTop.onDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnScaleValue(base.PixelToValue(evt.mousePosition.y)); return true; }); this.m_SelectionScaleTop.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(this.m_SelectionScaleTop.onEndDrag, delegate (AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return true; }); } }
private void Init(CurveEditorSettings settings) { this.m_CurveEditor = new CurveEditor(this.GetCurveEditorRect(), this.GetCurveWrapperArray(), true); this.m_CurveEditor.curvesUpdated = new CurveEditor.CallbackFunction(this.UpdateCurve); this.m_CurveEditor.scaleWithWindow = true; this.m_CurveEditor.margin = 40f; if (settings != null) { this.m_CurveEditor.settings = settings; } this.m_CurveEditor.settings.hTickLabelOffset = 10f; this.m_CurveEditor.settings.rectangleToolFlags = CurveEditorSettings.RectangleToolFlags.MiniRectangleTool; this.m_CurveEditor.settings.undoRedoSelection = true; this.m_CurveEditor.settings.showWrapperPopups = true; bool horizontally = true; bool vertically = true; if ((this.m_CurveEditor.settings.hRangeMin != float.NegativeInfinity) && (this.m_CurveEditor.settings.hRangeMax != float.PositiveInfinity)) { this.m_CurveEditor.SetShownHRangeInsideMargins(this.m_CurveEditor.settings.hRangeMin, this.m_CurveEditor.settings.hRangeMax); horizontally = false; } if ((this.m_CurveEditor.settings.vRangeMin != float.NegativeInfinity) && (this.m_CurveEditor.settings.vRangeMax != float.PositiveInfinity)) { this.m_CurveEditor.SetShownVRangeInsideMargins(this.m_CurveEditor.settings.vRangeMin, this.m_CurveEditor.settings.vRangeMax); vertically = false; } this.m_CurveEditor.FrameSelected(horizontally, vertically); }
private void InitializeCurveEditor() { this.m_CurveEditor = new CurveEditor(new Rect(0.0f, 0.0f, this.contentWidth, 100f), new CurveWrapper[0], false); CurveEditorSettings curveEditorSettings = new CurveEditorSettings(); curveEditorSettings.hTickStyle.distMin = 30; curveEditorSettings.hTickStyle.distFull = 80; curveEditorSettings.hTickStyle.distLabel = 0; if (EditorGUIUtility.isProSkin) { curveEditorSettings.vTickStyle.color = new Color(1f, 1f, 1f, curveEditorSettings.vTickStyle.color.a); curveEditorSettings.vTickStyle.labelColor = new Color(1f, 1f, 1f, curveEditorSettings.vTickStyle.labelColor.a); } curveEditorSettings.vTickStyle.distMin = 15; curveEditorSettings.vTickStyle.distFull = 40; curveEditorSettings.vTickStyle.distLabel = 30; curveEditorSettings.vTickStyle.stubs = true; curveEditorSettings.hRangeMin = 0.0f; curveEditorSettings.hRangeLocked = false; curveEditorSettings.vRangeLocked = false; curveEditorSettings.hSlider = true; curveEditorSettings.vSlider = true; this.m_CurveEditor.shownArea = new Rect(1f, 1f, 1f, 1f); this.m_CurveEditor.settings = curveEditorSettings; this.m_CurveEditor.m_PlayHead = (IPlayHead) this.m_State; }
public void OnEnable(SerializedObject serializedObject) { this.m_WidthMultiplier = serializedObject.FindProperty("m_Parameters.widthMultiplier"); this.m_WidthCurve = serializedObject.FindProperty("m_Parameters.widthCurve"); this.m_Settings.hRangeMin = 0f; this.m_Settings.vRangeMin = 0f; this.m_Settings.vRangeMax = 1f; this.m_Settings.hRangeMax = 1f; this.m_Settings.vSlider = false; this.m_Settings.hSlider = false; TickStyle style = new TickStyle { tickColor = { color = new Color(0f, 0f, 0f, 0.15f) }, distLabel = 30 }; this.m_Settings.hTickStyle = style; TickStyle style2 = new TickStyle { tickColor = { color = new Color(0f, 0f, 0f, 0.15f) }, distLabel = 20 }; this.m_Settings.vTickStyle = style2; this.m_Settings.undoRedoSelection = true; this.m_Editor = new CurveEditor(new Rect(0f, 0f, 1000f, 100f), new CurveWrapper[0], false); this.m_Editor.settings = this.m_Settings; this.m_Editor.margin = 25f; this.m_Editor.SetShownHRangeInsideMargins(0f, 1f); this.m_Editor.SetShownVRangeInsideMargins(0f, 1f); this.m_Editor.ignoreScrollWheelUntilClicked = true; Undo.undoRedoPerformed = (Undo.UndoRedoCallback) Delegate.Combine(Undo.undoRedoPerformed, new Undo.UndoRedoCallback(this.UndoRedoPerformed)); }
private void InitializeCurveEditor() { this.m_CurveEditor = new CurveEditor(new Rect(0f, 0f, this.contentWidth, 100f), new CurveWrapper[0], false); CurveEditorSettings settings = new CurveEditorSettings { hTickStyle = { distMin = 30, distFull = 80, distLabel = 0 } }; if (EditorGUIUtility.isProSkin) { settings.vTickStyle.color = new Color(1f, 1f, 1f, settings.vTickStyle.color.a); settings.vTickStyle.labelColor = new Color(1f, 1f, 1f, settings.vTickStyle.labelColor.a); } settings.vTickStyle.distMin = 15; settings.vTickStyle.distFull = 40; settings.vTickStyle.distLabel = 30; settings.vTickStyle.stubs = true; settings.hRangeMin = 0f; settings.hRangeLocked = false; settings.vRangeLocked = false; settings.hSlider = true; settings.vSlider = true; this.m_CurveEditor.shownArea = new Rect(1f, 1f, 1f, 1f); this.m_CurveEditor.settings = settings; this.m_CurveEditor.m_PlayHead = this.m_State; }
private void Init(CurveEditorSettings settings) { this.m_CurveEditor = new CurveEditor(this.GetCurveEditorRect(), this.GetCurveWrapperArray(), true); this.m_CurveEditor.curvesUpdated = new CurveEditor.CallbackFunction(this.UpdateCurve); this.m_CurveEditor.scaleWithWindow = true; this.m_CurveEditor.margin = 40f; if (settings != null) this.m_CurveEditor.settings = settings; this.m_CurveEditor.settings.hTickLabelOffset = 10f; bool horizontally = true; bool vertically = true; if ((double) this.m_CurveEditor.settings.hRangeMin != double.NegativeInfinity && (double) this.m_CurveEditor.settings.hRangeMax != double.PositiveInfinity) { this.m_CurveEditor.SetShownHRangeInsideMargins(this.m_CurveEditor.settings.hRangeMin, this.m_CurveEditor.settings.hRangeMax); horizontally = false; } if ((double) this.m_CurveEditor.settings.vRangeMin != double.NegativeInfinity && (double) this.m_CurveEditor.settings.vRangeMax != double.PositiveInfinity) { this.m_CurveEditor.SetShownVRangeInsideMargins(this.m_CurveEditor.settings.vRangeMin, this.m_CurveEditor.settings.vRangeMax); vertically = false; } this.m_CurveEditor.FrameSelected(horizontally, vertically); }