diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2020-04-19 17:19:32 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2020-04-19 17:19:32 -0400 |
| commit | c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78 (patch) | |
| tree | ee4d51c7c1d633e11f46453ef1edd3c77c4ef9f7 /Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/ManipulationsTracks.cs | |
| download | Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.gz Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.bz2 Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.zip | |
Inital commit
Diffstat (limited to 'Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/ManipulationsTracks.cs')
| -rw-r--r-- | Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/ManipulationsTracks.cs | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/ManipulationsTracks.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/ManipulationsTracks.cs new file mode 100644 index 0000000..3bd2a1c --- /dev/null +++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/ManipulationsTracks.cs @@ -0,0 +1,103 @@ +using System.Linq; +using UnityEngine; +using UnityEngine.Timeline; + +namespace UnityEditor.Timeline +{ + class InlineCurveResize : Manipulator + { + bool m_Captured; + + float m_CapturedHeight; + float m_CaptureMouseYPos; + + InlineCurveResizeHandle m_Target; + + protected override bool MouseDown(Event evt, WindowState state) + { + m_Target = PickerUtils.PickedInlineCurveResizer(); + if (m_Target == null) + return false; + + m_Captured = true; + m_CapturedHeight = TimelineWindowViewPrefs.GetInlineCurveHeight(m_Target.trackGUI.track); + m_CaptureMouseYPos = GUIUtility.GUIToScreenPoint(Event.current.mousePosition).y; + state.AddCaptured(this); + + return true; + } + + protected override bool MouseDrag(Event evt, WindowState state) + { + if (!m_Captured || m_Target == null) + return false; + + var trackGUI = m_Target.trackGUI; + + float inlineTrackHeight = m_CapturedHeight + + (GUIUtility.GUIToScreenPoint(Event.current.mousePosition).y - m_CaptureMouseYPos); + + TimelineWindowViewPrefs.SetInlineCurveHeight(trackGUI.track, Mathf.Max(inlineTrackHeight, 60.0f)); + + state.GetWindow().treeView.CalculateRowRects(); + + return true; + } + + protected override bool MouseUp(Event evt, WindowState state) + { + if (!m_Captured) + return false; + + state.RemoveCaptured(this); + m_Captured = false; + + return true; + } + } + + class TrackDoubleClick : Manipulator + { + protected override bool DoubleClick(Event evt, WindowState state) + { + if (evt.button != 0) + return false; + + var trackGUI = PickerUtils.PickedTrackBaseGUI(); + + if (trackGUI == null) + return false; + + // Double-click is only available for AnimationTracks: it conflicts with selection mechanics on other tracks + if ((trackGUI.track as AnimationTrack) == null) + return false; + + return EditTrackInAnimationWindow.Do(state, trackGUI.track); + } + } + + class TrackShortcutManipulator : Manipulator + { + protected override bool ExecuteCommand(Event evt, WindowState state) + { + if (state.IsCurrentEditingASequencerTextField()) + return false; + + var tracks = SelectionManager.SelectedTracks().ToList(); + + var itemGUIs = SelectionManager.SelectedClipGUI(); + + foreach (var itemGUI in itemGUIs) + { + var trackGUI = itemGUI.parent == null ? null : itemGUI.parent as TimelineTrackBaseGUI; + if (trackGUI == null) + continue; + + if (!tracks.Contains(trackGUI.track)) + tracks.Add(trackGUI.track); + } + + return TrackAction.HandleShortcut(state, evt, tracks.ToArray()); + } + } +} |
