public void Init() { if (this.m_AddedCurves != null) return; this.m_AddedCurves = new List<ParticleSystemCurveEditor.CurveData>(); this.m_Colors = new Color[6] { new Color(1f, 0.6196079f, 0.1294118f), new Color(0.8745098f, 0.2117647f, 0.5803922f), new Color(0.0f, 0.6862745f, 1f), new Color(1f, 0.9215686f, 0.0f), new Color(0.1960784f, 1f, 0.2666667f), new Color(0.9803922f, 0.0f, 0.0f) }; this.m_AvailableColors = new List<Color>((IEnumerable<Color>) this.m_Colors); ParticleSystemCurveEditor.m_CurveEditorSettings.useFocusColors = true; ParticleSystemCurveEditor.m_CurveEditorSettings.showAxisLabels = false; ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMin = 0.0f; ParticleSystemCurveEditor.m_CurveEditorSettings.vRangeMin = 0.0f; ParticleSystemCurveEditor.m_CurveEditorSettings.vRangeMax = 1f; ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMax = 1f; ParticleSystemCurveEditor.m_CurveEditorSettings.vSlider = false; ParticleSystemCurveEditor.m_CurveEditorSettings.hSlider = false; ParticleSystemCurveEditor.m_CurveEditorSettings.wrapColor = new Color(0.0f, 0.0f, 0.0f, 0.0f); ParticleSystemCurveEditor.m_CurveEditorSettings.hTickLabelOffset = 5f; ParticleSystemCurveEditor.m_CurveEditorSettings.allowDraggingCurvesAndRegions = true; ParticleSystemCurveEditor.m_CurveEditorSettings.allowDeleteLastKeyInCurve = false; ParticleSystemCurveEditor.m_CurveEditorSettings.hTickStyle = new TickStyle() { color = new Color(0.0f, 0.0f, 0.0f, 0.2f), distLabel = 30, stubs = false, centerLabel = true }; ParticleSystemCurveEditor.m_CurveEditorSettings.vTickStyle = new TickStyle() { color = new Color(0.0f, 0.0f, 0.0f, 0.2f), distLabel = 20, stubs = false, centerLabel = true }; this.m_CurveEditor = new CurveEditor(new Rect(0.0f, 0.0f, 1000f, 100f), this.CreateCurveWrapperArray(), false); this.m_CurveEditor.settings = ParticleSystemCurveEditor.m_CurveEditorSettings; this.m_CurveEditor.leftmargin = 40f; CurveEditor curveEditor = this.m_CurveEditor; float num1 = 25f; this.m_CurveEditor.bottommargin = num1; float num2 = num1; this.m_CurveEditor.topmargin = num2; double num3 = (double) num2; curveEditor.rightmargin = (float) num3; this.m_CurveEditor.SetShownHRangeInsideMargins(ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMin, ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMax); this.m_CurveEditor.SetShownVRangeInsideMargins(ParticleSystemCurveEditor.m_CurveEditorSettings.vRangeMin, ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMax); this.m_CurveEditor.ignoreScrollWheelUntilClicked = false; Undo.undoRedoPerformed += new Undo.UndoRedoCallback(this.UndoRedoPerformed); }
public void OnDisable() { AnimEditor.s_AnimationWindows.Remove(this); if (this.m_CurveEditor != null) { CurveEditor expr_1D = this.m_CurveEditor; expr_1D.curvesUpdated = (CurveEditor.CallbackFunction)Delegate.Remove(expr_1D.curvesUpdated, new CurveEditor.CallbackFunction(this.SaveChangedCurvesFromCurveEditor)); } AnimationWindowState expr_44 = this.m_State; expr_44.onClipSelectionChanged = (Action)Delegate.Remove(expr_44.onClipSelectionChanged, new Action(this.OnClipSelectionChange)); this.m_State.OnDisable(); }
public BindingSelector(EditorWindow window, CurveEditor curveEditor) { m_Window = window as TimelineWindow; m_CurveEditor = curveEditor; m_DopeLines = new ReorderableList(m_StringList, typeof(string), false, false, false, false); m_DopeLines.drawElementBackgroundCallback = null; m_DopeLines.showDefaultBackground = false; m_DopeLines.index = 0; m_DopeLines.headerHeight = 0; m_DopeLines.elementHeight = 20; m_DopeLines.draggable = false; }
public override bool Setup() { using (CurveEditor editor = new CurveEditor(_data.Curve)) { if (editor.ShowDialog() == DialogResult.OK) { DimmingCurve = editor.Curve; _CreateOutputs(); return(true); } } return(false); }
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); }
internal CurveTrackTreeView(CurveEditor curveEditor) { this._CurveEditor = curveEditor; RowDefinitions.Add(25, Skill.Framework.UI.GridUnitType.Pixel); RowDefinitions.Add(1, Skill.Framework.UI.GridUnitType.Star); _Toolbar = new Grid(); _Toolbar.ColumnDefinitions.Add(30, GridUnitType.Pixel); _Toolbar.ColumnDefinitions.Add(1, GridUnitType.Star); _Toolbar.ColumnDefinitions.Add(30, GridUnitType.Pixel); // create header _Title = new Skill.Framework.UI.Label() { Row = 0, Column = 1 }; _Title.Text = "Curves"; _Toolbar.Controls.Add(_Title); _BtnClear = new Button() { Row = 0, Column = 0 }; _BtnClear.Content.tooltip = "Remove all curves"; _Toolbar.Controls.Add(_BtnClear); _BtnAddKey = new Button() { Row = 0, Column = 2, IsEnabled = false }; _BtnAddKey.Content.tooltip = "Add key to Selected"; _Toolbar.Controls.Add(_BtnAddKey); Controls.Add(_Toolbar); _TreeView = new TreeView() { Row = 1, UserData = this, HandleScrollWheel = true }; _TreeView.DisableFocusable(); Controls.Add(_TreeView); _BtnClear.Click += _BtnClear_Click; _BtnAddKey.Click += _BtnAddKey_Click; _CurveEditor.Changed += _CurveEditor_Changed; _TreeView.SelectedItemChanged += _TreeView_SelectedItemChanged; }
public void OnDisable() { AnimEditor.s_AnimationWindows.Remove(this); if (this.m_CurveEditor != null) { CurveEditor expr_1F = this.m_CurveEditor; expr_1F.curvesUpdated = (CurveEditor.CallbackFunction)Delegate.Remove(expr_1F.curvesUpdated, new CurveEditor.CallbackFunction(this.SaveChangedCurvesFromCurveEditor)); this.m_CurveEditor.OnDisable(); } if (this.m_DopeSheet != null) { this.m_DopeSheet.OnDisable(); } this.m_State.OnDisable(); }
// Returns true if a valid normalizationRect is returned (ranges are bounded) static bool GetNormalizationRect(out Rect normalizationRect, CurveEditor curveEditor) { normalizationRect = new Rect(); if (curveEditor.settings.hasUnboundedRanges) { return(false); } normalizationRect = new Rect( curveEditor.settings.hRangeMin, curveEditor.settings.vRangeMin, curveEditor.settings.hRangeMax - curveEditor.settings.hRangeMin, curveEditor.settings.vRangeMax - curveEditor.settings.vRangeMin); return(true); }
public ClipCurveEditor(CurveDataSource dataSource, TimelineWindow parentWindow, TrackAsset hostTrack) { m_DataSource = dataSource; m_CurveEditor = new CurveEditor(new Rect(0, 0, 1000, 100), new CurveWrapper[0], false); s_CurveEditorSettings.hSlider = false; s_CurveEditorSettings.vSlider = false; s_CurveEditorSettings.hRangeLocked = false; s_CurveEditorSettings.vRangeLocked = false; s_CurveEditorSettings.scaleWithWindow = true; s_CurveEditorSettings.hRangeMin = 0.0f; s_CurveEditorSettings.showAxisLabels = true; s_CurveEditorSettings.allowDeleteLastKeyInCurve = true; s_CurveEditorSettings.rectangleToolFlags = CurveEditorSettings.RectangleToolFlags.NoRectangleTool; s_CurveEditorSettings.vTickStyle = new TickStyle { tickColor = { color = DirectorStyles.Instance.customSkin.colorInlineCurveVerticalLines }, distLabel = 20, stubs = true }; s_CurveEditorSettings.hTickStyle = new TickStyle { // hide horizontal lines by giving them a transparent color tickColor = { color = new Color(0.0f, 0.0f, 0.0f, 0.0f) }, distLabel = 0 }; m_CurveEditor.settings = s_CurveEditorSettings; m_ViewModel = TimelineWindowViewPrefs.GetTrackViewModelData(hostTrack); if (isNewSelection) { m_CurveEditor.shownArea = new Rect(1, 1, 1, 1); } else { m_CurveEditor.shownAreaInsideMargins = m_ViewModel.inlineCurvesShownAreaInsideMargins; } m_CurveEditor.ignoreScrollWheelUntilClicked = true; m_CurveEditor.curvesUpdated = OnCurvesUpdated; m_BindingHierarchy = new BindingSelector(parentWindow, m_CurveEditor, m_ViewModel.inlineCurvesState); }
public void OnDisable() { AnimEditor.s_AnimationWindows.Remove(this); if (this.m_CurveEditor != null) { CurveEditor expr_1F = this.m_CurveEditor; expr_1F.curvesUpdated = (CurveEditor.CallbackFunction)Delegate.Remove(expr_1F.curvesUpdated, new CurveEditor.CallbackFunction(this.SaveChangedCurvesFromCurveEditor)); this.m_CurveEditor.OnDisable(); } if (this.m_DopeSheet != null) { this.m_DopeSheet.OnDisable(); } this.m_State.OnDisable(); EditorApplication.globalEventHandler = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.globalEventHandler, new EditorApplication.CallbackFunction(this.HandleGlobalHotkeys)); }
public void Init() { if (this.m_AddedCurves == null) { this.m_AddedCurves = new List<CurveData>(); this.m_Colors = new Color[] { new Color(1f, 0.6196079f, 0.1294118f), new Color(0.8745098f, 0.2117647f, 0.5803922f), new Color(0f, 0.6862745f, 1f), new Color(1f, 0.9215686f, 0f), new Color(0.1960784f, 1f, 0.2666667f), new Color(0.9803922f, 0f, 0f) }; this.m_AvailableColors = new List<Color>(this.m_Colors); m_CurveEditorSettings.useFocusColors = true; m_CurveEditorSettings.showAxisLabels = false; m_CurveEditorSettings.hRangeMin = 0f; m_CurveEditorSettings.vRangeMin = 0f; m_CurveEditorSettings.vRangeMax = 1f; m_CurveEditorSettings.hRangeMax = 1f; m_CurveEditorSettings.vSlider = false; m_CurveEditorSettings.hSlider = false; m_CurveEditorSettings.showWrapperPopups = true; m_CurveEditorSettings.rectangleToolFlags = CurveEditorSettings.RectangleToolFlags.MiniRectangleTool; m_CurveEditorSettings.hTickLabelOffset = 5f; m_CurveEditorSettings.allowDraggingCurvesAndRegions = true; m_CurveEditorSettings.allowDeleteLastKeyInCurve = false; TickStyle style = new TickStyle { tickColor = { color = new Color(0f, 0f, 0f, 0.2f) }, distLabel = 30, stubs = false, centerLabel = true }; m_CurveEditorSettings.hTickStyle = style; TickStyle style2 = new TickStyle { tickColor = { color = new Color(0f, 0f, 0f, 0.2f) }, distLabel = 20, stubs = false, centerLabel = true }; m_CurveEditorSettings.vTickStyle = style2; this.m_CurveEditor = new CurveEditor(new Rect(0f, 0f, 1000f, 100f), this.CreateCurveWrapperArray(), false); this.m_CurveEditor.settings = m_CurveEditorSettings; this.m_CurveEditor.leftmargin = 40f; float num = 25f; this.m_CurveEditor.bottommargin = num; this.m_CurveEditor.topmargin = num; this.m_CurveEditor.rightmargin = num; this.m_CurveEditor.SetShownHRangeInsideMargins(m_CurveEditorSettings.hRangeMin, m_CurveEditorSettings.hRangeMax); this.m_CurveEditor.SetShownVRangeInsideMargins(m_CurveEditorSettings.vRangeMin, m_CurveEditorSettings.hRangeMax); this.m_CurveEditor.ignoreScrollWheelUntilClicked = false; Undo.undoRedoPerformed = (Undo.UndoRedoCallback) Delegate.Combine(Undo.undoRedoPerformed, new Undo.UndoRedoCallback(this.UndoRedoPerformed)); } }
public ClipInspectorCurveEditor() { var curveEditorSettings = new CurveEditorSettings { allowDeleteLastKeyInCurve = false, allowDraggingCurvesAndRegions = true, hTickLabelOffset = 0.1f, showAxisLabels = true, useFocusColors = false, wrapColor = new EditorGUIUtility.SkinnedColor(Color.black), hSlider = false, hRangeMin = 0.0f, vRangeMin = 0.0F, vRangeMax = 1.0f, hRangeMax = 1.0F, vSlider = false, hRangeLocked = false, vRangeLocked = false, undoRedoSelection = true, hTickStyle = new TickStyle { tickColor = new EditorGUIUtility.SkinnedColor(new Color(0.0f, 0.0f, 0.0f, 0.2f)), distLabel = 30, stubs = false, centerLabel = true }, vTickStyle = new TickStyle { tickColor = new EditorGUIUtility.SkinnedColor(new Color(1.0f, 0.0f, 0.0f, 0.2f)), distLabel = 20, stubs = false, centerLabel = true } }; m_CurveEditor = new CurveEditor(new Rect(0, 0, 1000, 100), new CurveWrapper[0], true) { settings = curveEditorSettings, ignoreScrollWheelUntilClicked = true }; }
private void ContentOnGUI() { CurveEditor.MaxHeight = MaxHeight; CurveEditor.Duration = PropertyTimeline.Sequence.Duration; if (IsExpanded) { CurveEditor.OnGUI(); } else { CurveEditor.OnCollapsedGUI(); } if (Event.current.type == EventType.Repaint) { ContentBackgroundRect = GUILayoutUtility.GetLastRect(); } }
// Called by OnEnable to make sure the CurveEditor is not null, // and by Show so we get a fresh CurveEditor when the user clicks a new curve. void Init(CurveEditorSettings settings) { m_CurveEditor = new CurveEditor(GetCurveEditorRect(), GetCurveWrapperArray(), true); m_CurveEditor.curvesUpdated = UpdateCurve; m_CurveEditor.scaleWithWindow = true; m_CurveEditor.margin = 40; if (settings != null) { m_CurveEditor.settings = settings; } m_CurveEditor.settings.hTickLabelOffset = 10; m_CurveEditor.settings.rectangleToolFlags = CurveEditorSettings.RectangleToolFlags.MiniRectangleTool; // As there is no guarantee animation curve changes are recorded in undo redo, we can't really // handle curve selection in undo redo either. m_CurveEditor.settings.undoRedoSelection = false; m_CurveEditor.settings.showWrapperPopups = true; // For each of horizontal and vertical axis, if we have a finite range for that axis, use that range, // otherwise use framing logic to determine shown range for that axis. bool frameH = true; bool frameV = true; if (m_CurveEditor.settings.hRangeMin != Mathf.NegativeInfinity && m_CurveEditor.settings.hRangeMax != Mathf.Infinity) { m_CurveEditor.SetShownHRangeInsideMargins(m_CurveEditor.settings.hRangeMin, m_CurveEditor.settings.hRangeMax); frameH = false; } if (m_CurveEditor.settings.vRangeMin != Mathf.NegativeInfinity && m_CurveEditor.settings.vRangeMax != Mathf.Infinity) { m_CurveEditor.SetShownVRangeInsideMargins(m_CurveEditor.settings.vRangeMin, m_CurveEditor.settings.vRangeMax); frameV = false; } m_CurveEditor.FrameSelected(frameH, frameV); titleContent = EditorGUIUtility.TrTextContent("Curve"); // deal with window size minSize = new Vector2(240, 240 + kPresetsHeight); maxSize = new Vector2(10000, 10000); }
/// <inheritdoc /> public override void OnLoaded() { base.OnLoaded(); var upperLeft = GetBox(0).BottomLeft; var upperRight = GetBox(1).BottomRight; float curveMargin = 20.0f; _curve = new CurveEditor <T> { MaxKeyframes = 7, Bounds = new Rectangle(upperLeft + new Vector2(curveMargin, 10.0f), upperRight.X - upperLeft.X - curveMargin * 2.0f, 140.0f), Parent = this }; _curve.Edited += OnCurveEdited; _curve.UnlockChildrenRecursive(); _curve.PerformLayout(); UpdateCurveKeyframes(); }
private UndoPropertyModification[] PostProcess(UndoPropertyModification[] modifications) { if (PropertyTimeline && PropertyTimeline.Sequence && PropertyTimeline.Sequence.IsPlaying) { return(modifications); } if (!AnimationHelper.IsInAnimationMode) { return(modifications); } if (!USPreferenceWindow.AutoKeyframing) { return(modifications); } if (USWindow.IsScrubbing) { return(modifications); } try { var propertyModifications = ExtractRecordableModifications(modifications); foreach (var modifiedProperty in propertyModifications) { var modifiedCurves = modifiedProperty.GetModifiedCurvesAtTime(PropertyTimeline.Sequence.RunningTime); foreach (var modifiedCurve in modifiedCurves) { CurveEditor.AddKeyframeAtTime(modifiedCurve); } } } catch (Exception e) { Debug.Log(e); } return(modifications); }
void DisplayCurve(int index) { if (index < m_ResponseCurves.Length) { object curve = m_ResponseCurves[index].field.GetValue(m_ResponseCurves[index].behaviour); if (curve != null) { m_SelectedCurve = index; if (m_ActiveCurveEditor == null) { m_ActiveCurveEditor = new CurveEditor(position, curve as AnimationCurve); } else { m_ActiveCurveEditor.animationCurve = curve as AnimationCurve; } return; } } m_SelectedCurve = -1; m_ActiveCurveEditor = null; }
public ClipInspectorCurveEditor() { CurveEditorSettings curveEditorSettings = new CurveEditorSettings(); curveEditorSettings.allowDeleteLastKeyInCurve = false; curveEditorSettings.allowDraggingCurvesAndRegions = true; curveEditorSettings.hTickLabelOffset = 0.1f; curveEditorSettings.showAxisLabels = true; curveEditorSettings.useFocusColors = false; curveEditorSettings.wrapColor = new EditorGUIUtility.SkinnedColor(Color.get_black()); curveEditorSettings.set_hSlider(false); curveEditorSettings.set_hRangeMin(0f); curveEditorSettings.set_vRangeMin(0f); curveEditorSettings.set_vRangeMax(1f); curveEditorSettings.set_hRangeMax(1f); curveEditorSettings.set_vSlider(false); curveEditorSettings.set_hRangeLocked(false); curveEditorSettings.set_vRangeLocked(false); curveEditorSettings.set_hTickStyle(new TickStyle { tickColor = new EditorGUIUtility.SkinnedColor(new Color(0f, 0f, 0f, 0.2f)), distLabel = 30, stubs = false, centerLabel = true }); curveEditorSettings.set_vTickStyle(new TickStyle { tickColor = new EditorGUIUtility.SkinnedColor(new Color(1f, 0f, 0f, 0.2f)), distLabel = 20, stubs = false, centerLabel = true }); CurveEditorSettings settings = curveEditorSettings; CurveEditor curveEditor = new CurveEditor(new Rect(0f, 0f, 1000f, 100f), new CurveWrapper[0], true); curveEditor.set_settings(settings); curveEditor.set_ignoreScrollWheelUntilClicked(true); this.m_CurveEditor = curveEditor; }
public void OnEnable(SerializedObject serializedObject) { m_WidthMultiplier = serializedObject.FindProperty("m_Parameters.widthMultiplier"); m_WidthCurve = serializedObject.FindProperty("m_Parameters.widthCurve"); m_Settings.hRangeMin = 0.0f; m_Settings.vRangeMin = 0.0f; m_Settings.vRangeMax = 1.0f; m_Settings.hRangeMax = 1.0f; m_Settings.vSlider = false; m_Settings.hSlider = false; m_Settings.rectangleToolFlags = CurveEditorSettings.RectangleToolFlags.MiniRectangleTool; m_Settings.allowDeleteLastKeyInCurve = false; TickStyle hTS = new TickStyle(); hTS.tickColor.color = new Color(0.0f, 0.0f, 0.0f, 0.15f); hTS.distLabel = 30; hTS.stubs = false; m_Settings.hTickStyle = hTS; TickStyle vTS = new TickStyle(); vTS.tickColor.color = new Color(0.0f, 0.0f, 0.0f, 0.15f); vTS.distLabel = 20; vTS.stubs = false; m_Settings.vTickStyle = vTS; m_Settings.undoRedoSelection = true; m_Editor = new CurveEditor(new Rect(0, 0, 1000, 100), new CurveWrapper[0], false); m_Editor.settings = m_Settings; m_Editor.margin = 25; m_Editor.leftmargin = 35; m_Editor.SetShownHRangeInsideMargins(0.0f, 1.0f); m_Editor.SetShownVRangeInsideMargins(0.0f, 1.0f); m_Editor.ignoreScrollWheelUntilClicked = true; Undo.undoRedoPerformed += UndoRedoPerformed; }
public void OnDisable() { AnimEditor.s_AnimationWindows.Remove(this); if (this.m_CurveEditor != null) { CurveEditor expr_1F = this.m_CurveEditor; expr_1F.curvesUpdated = (CurveEditor.CallbackFunction)Delegate.Remove(expr_1F.curvesUpdated, new CurveEditor.CallbackFunction(this.SaveChangedCurvesFromCurveEditor)); this.m_CurveEditor.OnDisable(); } if (this.m_DopeSheet != null) { this.m_DopeSheet.OnDisable(); } AnimationWindowSelection expr_6D = this.m_State.selection; expr_6D.onSelectionChanged = (Action)Delegate.Remove(expr_6D.onSelectionChanged, new Action(this.OnSelectionChanged)); AnimationWindowState expr_94 = this.m_State; expr_94.onStartLiveEdit = (Action)Delegate.Remove(expr_94.onStartLiveEdit, new Action(this.OnStartLiveEdit)); AnimationWindowState expr_BB = this.m_State; expr_BB.onEndLiveEdit = (Action)Delegate.Remove(expr_BB.onEndLiveEdit, new Action(this.OnEndLiveEdit)); this.m_State.OnDisable(); }
public static Keyframe[] NormalizeKeys(Keyframe[] sourceKeys, NormalizationMode normalization, CurveEditor curveEditor) { Rect normalizationRect; if (!GetNormalizationRect(out normalizationRect, curveEditor)) { // No normalization rect, just return a copy of the source keyframes normalization = NormalizationMode.None; } return(CopyAndScaleCurveKeys(sourceKeys, normalizationRect, normalization)); }
public void Init() { if (this.m_AddedCurves != null) { return; } this.m_AddedCurves = new List <ParticleSystemCurveEditor.CurveData>(); this.m_Colors = new Color[6] { new Color(1f, 0.6196079f, 0.1294118f), new Color(0.8745098f, 0.2117647f, 0.5803922f), new Color(0.0f, 0.6862745f, 1f), new Color(1f, 0.9215686f, 0.0f), new Color(0.1960784f, 1f, 0.2666667f), new Color(0.9803922f, 0.0f, 0.0f) }; this.m_AvailableColors = new List <Color>((IEnumerable <Color>) this.m_Colors); ParticleSystemCurveEditor.m_CurveEditorSettings.useFocusColors = true; ParticleSystemCurveEditor.m_CurveEditorSettings.showAxisLabels = false; ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMin = 0.0f; ParticleSystemCurveEditor.m_CurveEditorSettings.vRangeMin = 0.0f; ParticleSystemCurveEditor.m_CurveEditorSettings.vRangeMax = 1f; ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMax = 1f; ParticleSystemCurveEditor.m_CurveEditorSettings.vSlider = false; ParticleSystemCurveEditor.m_CurveEditorSettings.hSlider = false; ParticleSystemCurveEditor.m_CurveEditorSettings.wrapColor = new Color(0.0f, 0.0f, 0.0f, 0.0f); ParticleSystemCurveEditor.m_CurveEditorSettings.hTickLabelOffset = 5f; ParticleSystemCurveEditor.m_CurveEditorSettings.allowDraggingCurvesAndRegions = true; ParticleSystemCurveEditor.m_CurveEditorSettings.allowDeleteLastKeyInCurve = false; ParticleSystemCurveEditor.m_CurveEditorSettings.hTickStyle = new TickStyle() { color = new Color(0.0f, 0.0f, 0.0f, 0.2f), distLabel = 30, stubs = false, centerLabel = true }; ParticleSystemCurveEditor.m_CurveEditorSettings.vTickStyle = new TickStyle() { color = new Color(0.0f, 0.0f, 0.0f, 0.2f), distLabel = 20, stubs = false, centerLabel = true }; this.m_CurveEditor = new CurveEditor(new Rect(0.0f, 0.0f, 1000f, 100f), this.CreateCurveWrapperArray(), false); this.m_CurveEditor.settings = ParticleSystemCurveEditor.m_CurveEditorSettings; this.m_CurveEditor.leftmargin = 40f; CurveEditor curveEditor = this.m_CurveEditor; float num1 = 25f; this.m_CurveEditor.bottommargin = num1; float num2 = num1; this.m_CurveEditor.topmargin = num2; double num3 = (double)num2; curveEditor.rightmargin = (float)num3; this.m_CurveEditor.SetShownHRangeInsideMargins(ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMin, ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMax); this.m_CurveEditor.SetShownVRangeInsideMargins(ParticleSystemCurveEditor.m_CurveEditorSettings.vRangeMin, ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMax); this.m_CurveEditor.ignoreScrollWheelUntilClicked = false; Undo.undoRedoPerformed += new Undo.UndoRedoCallback(this.UndoRedoPerformed); }
void DisplayCurve(int index) { if (index < m_ResponseCurves.Length) { object curve = m_ResponseCurves[index].field.GetValue(m_ResponseCurves[index].behaviour); if (curve != null) { m_SelectedCurve = index; if (m_ActiveCurveEditor == null) m_ActiveCurveEditor = new CurveEditor(position, curve as AnimationCurve); else m_ActiveCurveEditor.animationCurve = curve as AnimationCurve; return; } } m_SelectedCurve = -1; m_ActiveCurveEditor = 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); }); } }
/// <inheritdoc /> public override void OnDestroy() { _curve = null; base.OnDestroy(); }
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); AreaManipulator expr_3D = this.m_HBarLeft; expr_3D.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(expr_3D.onStartDrag, new AnimationWindowManipulator.OnStartDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { bool result; 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), CurveEditorRectangleTool.DragMode.ScaleHorizontal, base.rippleTimeClutch); result = true; } else { result = false; } return(result); })); AreaManipulator expr_64 = this.m_HBarLeft; expr_64.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(expr_64.onDrag, new AnimationWindowManipulator.OnDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate)); return(true); })); AreaManipulator expr_8B = this.m_HBarLeft; expr_8B.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(expr_8B.onEndDrag, new AnimationWindowManipulator.OnEndDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return(true); })); } if (this.m_HBarRight == null) { this.m_HBarRight = new AreaManipulator(base.styles.rectangleToolHBarRight, MouseCursor.ResizeHorizontal); AreaManipulator expr_D6 = this.m_HBarRight; expr_D6.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(expr_D6.onStartDrag, new AnimationWindowManipulator.OnStartDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { bool result; 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), CurveEditorRectangleTool.DragMode.ScaleHorizontal, base.rippleTimeClutch); result = true; } else { result = false; } return(result); })); AreaManipulator expr_FD = this.m_HBarRight; expr_FD.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(expr_FD.onDrag, new AnimationWindowManipulator.OnDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate)); return(true); })); AreaManipulator expr_124 = this.m_HBarRight; expr_124.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(expr_124.onEndDrag, new AnimationWindowManipulator.OnEndDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return(true); })); } if (this.m_HBar == null) { this.m_HBar = new AreaManipulator(base.styles.rectangleToolHBar, MouseCursor.MoveArrow); AreaManipulator expr_16F = this.m_HBar; expr_16F.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(expr_16F.onStartDrag, new AnimationWindowManipulator.OnStartDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { bool result; if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartMove(new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f), CurveEditorRectangleTool.DragMode.MoveHorizontal, base.rippleTimeClutch); result = true; } else { result = false; } return(result); })); AreaManipulator expr_196 = this.m_HBar; expr_196.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(expr_196.onDrag, new AnimationWindowManipulator.OnDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnMove(new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), 0f)); return(true); })); AreaManipulator expr_1BD = this.m_HBar; expr_1BD.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(expr_1BD.onEndDrag, new AnimationWindowManipulator.OnEndDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnEndMove(); return(true); })); } if (this.m_VBarBottom == null) { this.m_VBarBottom = new AreaManipulator(base.styles.rectangleToolVBarBottom, MouseCursor.ResizeVertical); AreaManipulator expr_208 = this.m_VBarBottom; expr_208.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(expr_208.onStartDrag, new AnimationWindowManipulator.OnStartDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { bool result; if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartScale(RectangleTool.ToolCoord.Top, RectangleTool.ToolCoord.Bottom, new Vector2(0f, base.PixelToValue(evt.mousePosition.y)), CurveEditorRectangleTool.DragMode.ScaleVertical, false); result = true; } else { result = false; } return(result); })); AreaManipulator expr_22F = this.m_VBarBottom; expr_22F.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(expr_22F.onDrag, new AnimationWindowManipulator.OnDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnScaleValue(base.PixelToValue(evt.mousePosition.y)); return(true); })); AreaManipulator expr_256 = this.m_VBarBottom; expr_256.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(expr_256.onEndDrag, new AnimationWindowManipulator.OnEndDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return(true); })); } if (this.m_VBarTop == null) { this.m_VBarTop = new AreaManipulator(base.styles.rectangleToolVBarTop, MouseCursor.ResizeVertical); AreaManipulator expr_2A1 = this.m_VBarTop; expr_2A1.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(expr_2A1.onStartDrag, new AnimationWindowManipulator.OnStartDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { bool result; if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartScale(RectangleTool.ToolCoord.Bottom, RectangleTool.ToolCoord.Top, new Vector2(0f, base.PixelToValue(evt.mousePosition.y)), CurveEditorRectangleTool.DragMode.ScaleVertical, false); result = true; } else { result = false; } return(result); })); AreaManipulator expr_2C8 = this.m_VBarTop; expr_2C8.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(expr_2C8.onDrag, new AnimationWindowManipulator.OnDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnScaleValue(base.PixelToValue(evt.mousePosition.y)); return(true); })); AreaManipulator expr_2EF = this.m_VBarTop; expr_2EF.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(expr_2EF.onEndDrag, new AnimationWindowManipulator.OnEndDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return(true); })); } if (this.m_VBar == null) { this.m_VBar = new AreaManipulator(base.styles.rectangleToolVBar, MouseCursor.MoveArrow); AreaManipulator expr_33A = this.m_VBar; expr_33A.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(expr_33A.onStartDrag, new AnimationWindowManipulator.OnStartDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { bool result; if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartMove(new Vector2(0f, base.PixelToValue(evt.mousePosition.y)), CurveEditorRectangleTool.DragMode.MoveVertical, false); result = true; } else { result = false; } return(result); })); AreaManipulator expr_361 = this.m_VBar; expr_361.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(expr_361.onDrag, new AnimationWindowManipulator.OnDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnMove(new Vector2(0f, base.PixelToValue(evt.mousePosition.y))); return(true); })); AreaManipulator expr_388 = this.m_VBar; expr_388.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(expr_388.onEndDrag, new AnimationWindowManipulator.OnEndDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnEndMove(); return(true); })); } if (this.m_SelectionBox == null) { this.m_SelectionBox = new AreaManipulator(base.styles.rectangleToolSelection, MouseCursor.MoveArrow); AreaManipulator expr_3D3 = this.m_SelectionBox; expr_3D3.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(expr_3D3.onStartDrag, new AnimationWindowManipulator.OnStartDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { bool flag = evt.shift || EditorGUI.actionKey; bool result; 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) ? CurveEditorRectangleTool.DragMode.MoveBothAxis : CurveEditorRectangleTool.DragMode.MoveHorizontal, base.rippleTimeClutch); result = true; } else { result = false; } return(result); })); AreaManipulator expr_3FA = this.m_SelectionBox; expr_3FA.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(expr_3FA.onDrag, new AnimationWindowManipulator.OnDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnMove(new Vector2(base.PixelToTime(evt.mousePosition.x, this.frameRate), base.PixelToValue(evt.mousePosition.y))); return(true); })); AreaManipulator expr_421 = this.m_SelectionBox; expr_421.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(expr_421.onEndDrag, new AnimationWindowManipulator.OnEndDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnEndMove(); return(true); })); } if (this.m_SelectionScaleLeft == null) { this.m_SelectionScaleLeft = new AreaManipulator(base.styles.rectangleToolScaleLeft, MouseCursor.ResizeHorizontal); AreaManipulator expr_46C = this.m_SelectionScaleLeft; expr_46C.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(expr_46C.onStartDrag, new AnimationWindowManipulator.OnStartDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { bool result; 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), CurveEditorRectangleTool.DragMode.ScaleHorizontal, base.rippleTimeClutch); result = true; } else { result = false; } return(result); })); AreaManipulator expr_493 = this.m_SelectionScaleLeft; expr_493.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(expr_493.onDrag, new AnimationWindowManipulator.OnDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate)); return(true); })); AreaManipulator expr_4BA = this.m_SelectionScaleLeft; expr_4BA.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(expr_4BA.onEndDrag, new AnimationWindowManipulator.OnEndDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return(true); })); } if (this.m_SelectionScaleRight == null) { this.m_SelectionScaleRight = new AreaManipulator(base.styles.rectangleToolScaleRight, MouseCursor.ResizeHorizontal); AreaManipulator expr_505 = this.m_SelectionScaleRight; expr_505.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(expr_505.onStartDrag, new AnimationWindowManipulator.OnStartDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { bool result; 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), CurveEditorRectangleTool.DragMode.ScaleHorizontal, base.rippleTimeClutch); result = true; } else { result = false; } return(result); })); AreaManipulator expr_52C = this.m_SelectionScaleRight; expr_52C.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(expr_52C.onDrag, new AnimationWindowManipulator.OnDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnScaleTime(base.PixelToTime(evt.mousePosition.x, this.frameRate)); return(true); })); AreaManipulator expr_553 = this.m_SelectionScaleRight; expr_553.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(expr_553.onEndDrag, new AnimationWindowManipulator.OnEndDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return(true); })); } if (this.m_SelectionScaleBottom == null) { this.m_SelectionScaleBottom = new AreaManipulator(base.styles.rectangleToolScaleBottom, MouseCursor.ResizeVertical); AreaManipulator expr_59E = this.m_SelectionScaleBottom; expr_59E.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(expr_59E.onStartDrag, new AnimationWindowManipulator.OnStartDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { bool result; if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartScale(RectangleTool.ToolCoord.Top, RectangleTool.ToolCoord.Bottom, new Vector2(0f, base.PixelToValue(evt.mousePosition.y)), CurveEditorRectangleTool.DragMode.ScaleVertical, false); result = true; } else { result = false; } return(result); })); AreaManipulator expr_5C5 = this.m_SelectionScaleBottom; expr_5C5.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(expr_5C5.onDrag, new AnimationWindowManipulator.OnDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnScaleValue(base.PixelToValue(evt.mousePosition.y)); return(true); })); AreaManipulator expr_5EC = this.m_SelectionScaleBottom; expr_5EC.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(expr_5EC.onEndDrag, new AnimationWindowManipulator.OnEndDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return(true); })); } if (this.m_SelectionScaleTop == null) { this.m_SelectionScaleTop = new AreaManipulator(base.styles.rectangleToolScaleTop, MouseCursor.ResizeVertical); AreaManipulator expr_637 = this.m_SelectionScaleTop; expr_637.onStartDrag = (AnimationWindowManipulator.OnStartDragDelegate) Delegate.Combine(expr_637.onStartDrag, new AnimationWindowManipulator.OnStartDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { bool result; if (this.hasSelection && manipulator.rect.Contains(evt.mousePosition)) { this.OnStartScale(RectangleTool.ToolCoord.Bottom, RectangleTool.ToolCoord.Top, new Vector2(0f, base.PixelToValue(evt.mousePosition.y)), CurveEditorRectangleTool.DragMode.ScaleVertical, false); result = true; } else { result = false; } return(result); })); AreaManipulator expr_65E = this.m_SelectionScaleTop; expr_65E.onDrag = (AnimationWindowManipulator.OnDragDelegate) Delegate.Combine(expr_65E.onDrag, new AnimationWindowManipulator.OnDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnScaleValue(base.PixelToValue(evt.mousePosition.y)); return(true); })); AreaManipulator expr_685 = this.m_SelectionScaleTop; expr_685.onEndDrag = (AnimationWindowManipulator.OnEndDragDelegate) Delegate.Combine(expr_685.onEndDrag, new AnimationWindowManipulator.OnEndDragDelegate(delegate(AnimationWindowManipulator manipulator, Event evt) { this.OnEndScale(); return(true); })); } }
public void Init() { if (m_AddedCurves != null) { return; } m_AddedCurves = new List <CurveData>(); // Colors m_Colors = new Color[] { new Color(255 / 255f, 158 / 255f, 33 / 255f), // orange new Color(223 / 255f, 54 / 255f, 148 / 255f), // purple new Color(0f, 175 / 255f, 255 / 255f), // blue new Color(255 / 255f, 235 / 255f, 0), // yellow new Color(50 / 255f, 255 / 255f, 68 / 255f), // green new Color(250 / 255f, 0f, 0f), // red (this is the first color used) }; m_AvailableColors = new List <Color>(m_Colors); // Curve Editor m_CurveEditorSettings.useFocusColors = true; m_CurveEditorSettings.showAxisLabels = false; m_CurveEditorSettings.hRangeMin = 0.0f; m_CurveEditorSettings.vRangeMin = 0.0F; m_CurveEditorSettings.vRangeMax = 1.0f; m_CurveEditorSettings.hRangeMax = 1.0F; m_CurveEditorSettings.vSlider = false; m_CurveEditorSettings.hSlider = false; m_CurveEditorSettings.showWrapperPopups = true; m_CurveEditorSettings.rectangleToolFlags = CurveEditorSettings.RectangleToolFlags.MiniRectangleTool; m_CurveEditorSettings.hTickLabelOffset = 5; m_CurveEditorSettings.allowDraggingCurvesAndRegions = true; m_CurveEditorSettings.allowDeleteLastKeyInCurve = false; TickStyle hTS = new TickStyle(); hTS.tickColor.color = new Color(0.0f, 0.0f, 0.0f, 0.2f); hTS.distLabel = 30; hTS.stubs = false; hTS.centerLabel = true; m_CurveEditorSettings.hTickStyle = hTS; TickStyle vTS = new TickStyle(); vTS.tickColor.color = new Color(0.0f, 0.0f, 0.0f, 0.2f); vTS.distLabel = 20; vTS.stubs = false; vTS.centerLabel = true; m_CurveEditorSettings.vTickStyle = vTS; m_CurveEditor = new CurveEditor(new Rect(0, 0, 1000, 100), CreateCurveWrapperArray(), false); m_CurveEditor.settings = m_CurveEditorSettings; m_CurveEditor.leftmargin = 40; m_CurveEditor.rightmargin = m_CurveEditor.topmargin = m_CurveEditor.bottommargin = 25; m_CurveEditor.SetShownHRangeInsideMargins(m_CurveEditorSettings.hRangeMin, m_CurveEditorSettings.hRangeMax); m_CurveEditor.SetShownVRangeInsideMargins(m_CurveEditorSettings.vRangeMin, m_CurveEditorSettings.hRangeMax); m_CurveEditor.ignoreScrollWheelUntilClicked = false; Undo.undoRedoPerformed += UndoRedoPerformed; }
/// <inheritdoc /> protected override void Deinitialize() { _curve = null; base.Deinitialize(); }
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); }
void OnEnable() { m_AudioClip = serializedObject.FindProperty("m_audioClip"); m_PlayOnAwake = serializedObject.FindProperty("m_PlayOnAwake"); m_Volume = serializedObject.FindProperty("m_Volume"); m_Pitch = serializedObject.FindProperty("m_Pitch"); m_Loop = serializedObject.FindProperty("Loop"); m_Mute = serializedObject.FindProperty("Mute"); m_Spatialize = serializedObject.FindProperty("Spatialize"); m_SpatializePostEffects = serializedObject.FindProperty("SpatializePostEffects"); m_Priority = serializedObject.FindProperty("Priority"); m_DopplerLevel = serializedObject.FindProperty("DopplerLevel"); m_MinDistance = serializedObject.FindProperty("MinDistance"); m_MaxDistance = serializedObject.FindProperty("MaxDistance"); m_Pan2D = serializedObject.FindProperty("Pan2D"); m_RolloffMode = serializedObject.FindProperty("rolloffMode"); m_BypassEffects = serializedObject.FindProperty("BypassEffects"); m_BypassListenerEffects = serializedObject.FindProperty("BypassListenerEffects"); m_BypassReverbZones = serializedObject.FindProperty("BypassReverbZones"); m_OutputAudioMixerGroup = serializedObject.FindProperty("OutputAudioMixerGroup"); m_AudioCurves = new AudioCurveWrapper[] { new AudioCurveWrapper(AudioCurveType.Volume, "Volume", kRolloffCurveID, kRolloffCurveColor, serializedObject.FindProperty("rolloffCustomCurve"), 0, 1), new AudioCurveWrapper(AudioCurveType.SpatialBlend, "Spatial Blend", kSpatialBlendCurveID, kSpatialCurveColor, serializedObject.FindProperty("panLevelCustomCurve"), 0, 1), new AudioCurveWrapper(AudioCurveType.Spread, "Spread", kSpreadCurveID, kSpreadCurveColor, serializedObject.FindProperty("spreadCustomCurve"), 0, 1), new AudioCurveWrapper(AudioCurveType.Lowpass, "Low-Pass", kLowPassCurveID, kLowPassCurveColor, null, 0, 1), new AudioCurveWrapper(AudioCurveType.ReverbZoneMix, "Reverb Zone Mix", kReverbZoneMixCurveID, kReverbZoneMixCurveColor, serializedObject.FindProperty("reverbZoneMixCustomCurve"), 0, 1.1f) }; m_CurveEditorSettings.hRangeMin = 0.0f; m_CurveEditorSettings.vRangeMin = 0.0f; m_CurveEditorSettings.vRangeMax = 1.1f; m_CurveEditorSettings.hRangeMax = 1.0f; m_CurveEditorSettings.vSlider = false; m_CurveEditorSettings.hSlider = false; TickStyle hTS = new TickStyle(); hTS.tickColor.color = new Color(0.0f, 0.0f, 0.0f, 0.15f); hTS.distLabel = 30; m_CurveEditorSettings.hTickStyle = hTS; TickStyle vTS = new TickStyle(); vTS.tickColor.color = new Color(0.0f, 0.0f, 0.0f, 0.15f); vTS.distLabel = 20; m_CurveEditorSettings.vTickStyle = vTS; m_CurveEditorSettings.undoRedoSelection = true; m_CurveEditor = new CurveEditor(new Rect(0, 0, 1000, 100), new CurveWrapper[0], false); m_CurveEditor.settings = m_CurveEditorSettings; m_CurveEditor.margin = 25; m_CurveEditor.SetShownHRangeInsideMargins(0.0f, 1.0f); m_CurveEditor.SetShownVRangeInsideMargins(0.0f, 1.1f); m_CurveEditor.ignoreScrollWheelUntilClicked = true; m_LastSourcePosition = GetSourcePos(target); m_LastListenerPosition = AudioUtil.GetListenerPos(); EditorApplication.update += Update; m_Expanded3D = EditorPrefs.GetBool("AudioSourceExpanded3D", m_Expanded3D); }
public static Keyframe[] GetNormalizedKeys(Keyframe[] sourceKeys, CurveEditor curveEditor) { return(NormalizeKeys(sourceKeys, NormalizationMode.Normalize, curveEditor)); }
public override void Initialize(TimeArea timeArea) { base.Initialize(timeArea); m_CurveEditor = timeArea as CurveEditor; if (m_HBarLeft == null) { m_HBarLeft = new AreaManipulator(styles.rectangleToolHBarLeft, MouseCursor.ResizeHorizontal); m_HBarLeft.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => { if (hasSelection && manipulator.rect.Contains(evt.mousePosition)) { OnStartScale(ToolCoord.Right, ToolCoord.Left, new Vector2(PixelToTime(evt.mousePosition.x, frameRate), 0f), DragMode.ScaleHorizontal, rippleTime); return(true); } return(false); }; m_HBarLeft.onDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnScaleTime(PixelToTime(evt.mousePosition.x, frameRate)); return(true); }; m_HBarLeft.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnEndScale(); return(true); }; } if (m_HBarRight == null) { m_HBarRight = new AreaManipulator(styles.rectangleToolHBarRight, MouseCursor.ResizeHorizontal); m_HBarRight.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => { if (hasSelection && manipulator.rect.Contains(evt.mousePosition)) { OnStartScale(ToolCoord.Left, ToolCoord.Right, new Vector2(PixelToTime(evt.mousePosition.x, frameRate), 0f), DragMode.ScaleHorizontal, rippleTime); return(true); } return(false); }; m_HBarRight.onDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnScaleTime(PixelToTime(evt.mousePosition.x, frameRate)); return(true); }; m_HBarRight.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnEndScale(); return(true); }; } if (m_HBar == null) { m_HBar = new AreaManipulator(styles.rectangleToolHBar, MouseCursor.MoveArrow); m_HBar.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => { if (hasSelection && manipulator.rect.Contains(evt.mousePosition)) { OnStartMove(new Vector2(PixelToTime(evt.mousePosition.x, frameRate), 0f), DragMode.MoveHorizontal, rippleTime); return(true); } return(false); }; m_HBar.onDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnMove(new Vector2(PixelToTime(evt.mousePosition.x, frameRate), 0f)); return(true); }; m_HBar.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnEndMove(); return(true); }; } if (m_VBarBottom == null) { m_VBarBottom = new AreaManipulator(styles.rectangleToolVBarBottom, MouseCursor.ResizeVertical); m_VBarBottom.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => { if (hasSelection && manipulator.rect.Contains(evt.mousePosition)) { OnStartScale(ToolCoord.Top, ToolCoord.Bottom, new Vector2(0f, PixelToValue(evt.mousePosition.y)), DragMode.ScaleVertical, false); return(true); } return(false); }; m_VBarBottom.onDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnScaleValue(PixelToValue(evt.mousePosition.y)); return(true); }; m_VBarBottom.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnEndScale(); return(true); }; } if (m_VBarTop == null) { m_VBarTop = new AreaManipulator(styles.rectangleToolVBarTop, MouseCursor.ResizeVertical); m_VBarTop.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => { if (hasSelection && manipulator.rect.Contains(evt.mousePosition)) { OnStartScale(ToolCoord.Bottom, ToolCoord.Top, new Vector2(0f, PixelToValue(evt.mousePosition.y)), DragMode.ScaleVertical, false); return(true); } return(false); }; m_VBarTop.onDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnScaleValue(PixelToValue(evt.mousePosition.y)); return(true); }; m_VBarTop.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnEndScale(); return(true); }; } if (m_VBar == null) { m_VBar = new AreaManipulator(styles.rectangleToolVBar, MouseCursor.MoveArrow); m_VBar.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => { if (hasSelection && manipulator.rect.Contains(evt.mousePosition)) { OnStartMove(new Vector2(0f, PixelToValue(evt.mousePosition.y)), DragMode.MoveVertical, false); return(true); } return(false); }; m_VBar.onDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnMove(new Vector2(0f, PixelToValue(evt.mousePosition.y))); return(true); }; m_VBar.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnEndMove(); return(true); }; } if (m_SelectionBox == null) { m_SelectionBox = new AreaManipulator(styles.rectangleToolSelection, MouseCursor.MoveArrow); m_SelectionBox.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => { bool curveEditorOverride = evt.shift || EditorGUI.actionKey; if (!curveEditorOverride && hasSelection && manipulator.rect.Contains(evt.mousePosition)) { OnStartMove(new Vector2(PixelToTime(evt.mousePosition.x, frameRate), PixelToValue(evt.mousePosition.y)), DragMode.MoveBothAxis, rippleTime); return(true); } return(false); }; m_SelectionBox.onDrag += (AnimationWindowManipulator manipulator, Event evt) => { // Only drag along x OR y when shift is held down if (evt.shift && m_DragMode == DragMode.MoveBothAxis) { float deltaX = evt.mousePosition.x - TimeToPixel(m_Previous.x); float deltaY = evt.mousePosition.y - ValueToPixel(m_Previous.y); m_DragMode = Mathf.Abs(deltaX) > Mathf.Abs(deltaY) ? DragMode.MoveHorizontal : DragMode.MoveVertical; } float posX = ((m_DragMode & DragMode.MoveHorizontal) != 0) ? PixelToTime(evt.mousePosition.x, frameRate) : m_Previous.x; float posY = ((m_DragMode & DragMode.MoveVertical) != 0) ? PixelToValue(evt.mousePosition.y) : m_Previous.y; OnMove(new Vector2(posX, posY)); return(true); }; m_SelectionBox.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnEndMove(); return(true); }; } if (m_SelectionScaleLeft == null) { m_SelectionScaleLeft = new AreaManipulator(styles.rectangleToolScaleLeft, MouseCursor.ResizeHorizontal); m_SelectionScaleLeft.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => { if (hasSelection && manipulator.rect.Contains(evt.mousePosition)) { OnStartScale(ToolCoord.Right, ToolCoord.Left, new Vector2(PixelToTime(evt.mousePosition.x, frameRate), 0f), DragMode.ScaleHorizontal, false); return(true); } return(false); }; m_SelectionScaleLeft.onDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnScaleTime(PixelToTime(evt.mousePosition.x, frameRate)); return(true); }; m_SelectionScaleLeft.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnEndScale(); return(true); }; } if (m_SelectionScaleRight == null) { m_SelectionScaleRight = new AreaManipulator(styles.rectangleToolScaleRight, MouseCursor.ResizeHorizontal); m_SelectionScaleRight.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => { if (hasSelection && manipulator.rect.Contains(evt.mousePosition)) { OnStartScale(ToolCoord.Left, ToolCoord.Right, new Vector2(PixelToTime(evt.mousePosition.x, frameRate), 0f), DragMode.ScaleHorizontal, false); return(true); } return(false); }; m_SelectionScaleRight.onDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnScaleTime(PixelToTime(evt.mousePosition.x, frameRate)); return(true); }; m_SelectionScaleRight.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnEndScale(); return(true); }; } if (m_SelectionRippleLeft == null) { m_SelectionRippleLeft = new AreaManipulator(styles.rectangleToolRippleLeft, MouseCursor.ResizeHorizontal); m_SelectionRippleLeft.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => { if (hasSelection && manipulator.rect.Contains(evt.mousePosition)) { OnStartScale(ToolCoord.Right, ToolCoord.Left, new Vector2(PixelToTime(evt.mousePosition.x, frameRate), 0f), DragMode.ScaleHorizontal, true); return(true); } return(false); }; m_SelectionRippleLeft.onDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnScaleTime(PixelToTime(evt.mousePosition.x, frameRate)); return(true); }; m_SelectionRippleLeft.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnEndScale(); return(true); }; } if (m_SelectionRippleRight == null) { m_SelectionRippleRight = new AreaManipulator(styles.rectangleToolRippleRight, MouseCursor.ResizeHorizontal); m_SelectionRippleRight.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => { if (hasSelection && manipulator.rect.Contains(evt.mousePosition)) { OnStartScale(ToolCoord.Left, ToolCoord.Right, new Vector2(PixelToTime(evt.mousePosition.x, frameRate), 0f), DragMode.ScaleHorizontal, true); return(true); } return(false); }; m_SelectionRippleRight.onDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnScaleTime(PixelToTime(evt.mousePosition.x, frameRate)); return(true); }; m_SelectionRippleRight.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnEndScale(); return(true); }; } if (m_SelectionScaleBottom == null) { m_SelectionScaleBottom = new AreaManipulator(styles.rectangleToolScaleBottom, MouseCursor.ResizeVertical); m_SelectionScaleBottom.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => { if (hasSelection && manipulator.rect.Contains(evt.mousePosition)) { OnStartScale(ToolCoord.Top, ToolCoord.Bottom, new Vector2(0f, PixelToValue(evt.mousePosition.y)), DragMode.ScaleVertical, false); return(true); } return(false); }; m_SelectionScaleBottom.onDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnScaleValue(PixelToValue(evt.mousePosition.y)); return(true); }; m_SelectionScaleBottom.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnEndScale(); return(true); }; } if (m_SelectionScaleTop == null) { m_SelectionScaleTop = new AreaManipulator(styles.rectangleToolScaleTop, MouseCursor.ResizeVertical); m_SelectionScaleTop.onStartDrag += (AnimationWindowManipulator manipulator, Event evt) => { if (hasSelection && manipulator.rect.Contains(evt.mousePosition)) { OnStartScale(ToolCoord.Bottom, ToolCoord.Top, new Vector2(0f, PixelToValue(evt.mousePosition.y)), DragMode.ScaleVertical, false); return(true); } return(false); }; m_SelectionScaleTop.onDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnScaleValue(PixelToValue(evt.mousePosition.y)); return(true); }; m_SelectionScaleTop.onEndDrag += (AnimationWindowManipulator manipulator, Event evt) => { OnEndScale(); return(true); }; } }
public void Init() { if (this.m_AddedCurves != null) { return; } this.m_AddedCurves = new List<ParticleSystemCurveEditor.CurveData>(); this.m_Colors = new Color[] { new Color(1f, 0.619607866f, 0.129411772f), new Color(0.8745098f, 0.211764708f, 0.5803922f), new Color(0f, 0.6862745f, 1f), new Color(1f, 0.921568632f, 0f), new Color(0.196078435f, 1f, 0.266666681f), new Color(0.980392158f, 0f, 0f) }; this.m_AvailableColors = new List<Color>(this.m_Colors); ParticleSystemCurveEditor.m_CurveEditorSettings.useFocusColors = true; ParticleSystemCurveEditor.m_CurveEditorSettings.showAxisLabels = false; ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMin = 0f; ParticleSystemCurveEditor.m_CurveEditorSettings.vRangeMin = 0f; ParticleSystemCurveEditor.m_CurveEditorSettings.vRangeMax = 1f; ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMax = 1f; ParticleSystemCurveEditor.m_CurveEditorSettings.vSlider = false; ParticleSystemCurveEditor.m_CurveEditorSettings.hSlider = false; ParticleSystemCurveEditor.m_CurveEditorSettings.wrapColor = new Color(0f, 0f, 0f, 0f); ParticleSystemCurveEditor.m_CurveEditorSettings.hTickLabelOffset = 5f; ParticleSystemCurveEditor.m_CurveEditorSettings.allowDraggingCurvesAndRegions = true; ParticleSystemCurveEditor.m_CurveEditorSettings.allowDeleteLastKeyInCurve = false; TickStyle tickStyle = new TickStyle(); tickStyle.color = new Color(0f, 0f, 0f, 0.2f); tickStyle.distLabel = 30; tickStyle.stubs = false; tickStyle.centerLabel = true; ParticleSystemCurveEditor.m_CurveEditorSettings.hTickStyle = tickStyle; TickStyle tickStyle2 = new TickStyle(); tickStyle2.color = new Color(0f, 0f, 0f, 0.2f); tickStyle2.distLabel = 20; tickStyle2.stubs = false; tickStyle2.centerLabel = true; ParticleSystemCurveEditor.m_CurveEditorSettings.vTickStyle = tickStyle2; this.m_CurveEditor = new CurveEditor(new Rect(0f, 0f, 1000f, 100f), this.CreateCurveWrapperArray(), false); this.m_CurveEditor.settings = ParticleSystemCurveEditor.m_CurveEditorSettings; this.m_CurveEditor.leftmargin = 40f; ZoomableArea arg_2A2_0 = this.m_CurveEditor; float num = 25f; this.m_CurveEditor.bottommargin = num; num = num; this.m_CurveEditor.topmargin = num; arg_2A2_0.rightmargin = num; this.m_CurveEditor.SetShownHRangeInsideMargins(ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMin, ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMax); this.m_CurveEditor.SetShownVRangeInsideMargins(ParticleSystemCurveEditor.m_CurveEditorSettings.vRangeMin, ParticleSystemCurveEditor.m_CurveEditorSettings.hRangeMax); this.m_CurveEditor.ignoreScrollWheelUntilClicked = false; Undo.undoRedoPerformed = (Undo.UndoRedoCallback)Delegate.Combine(Undo.undoRedoPerformed, new Undo.UndoRedoCallback(this.UndoRedoPerformed)); }