protected override bool MouseDown(Event evt, WindowState state) { if (state.IsCurrentEditingASequencerTextField()) { return(false); } m_ActiveRect = TimelineWindow.instance.sequenceContentRect; if (!m_ActiveRect.Contains(evt.mousePosition)) { return(false); } if (!CanStartRectangle(evt)) { return(false); } if (enableAutoPan) { m_TimeAreaAutoPanner = new TimeAreaAutoPanner(state); } m_StartPoint = new TimelinePoint(state, evt.mousePosition); m_EndPixel = evt.mousePosition; state.AddCaptured(this); return(true); }
protected override bool ExecuteCommand(Event evt, WindowState state) { if (state.IsCurrentEditingASequencerTextField()) { return(false); } if (evt.commandName == EventCommandNames.SelectAll) { Invoker.InvokeWithSelected <SelectAllAction>(); return(true); } if (evt.commandName == EventCommandNames.SoftDelete) { Invoker.InvokeWithSelected <DeleteAction>(); return(true); } if (evt.commandName == EventCommandNames.FrameSelected) { Invoker.InvokeWithSelected <FrameSelectedAction>(); return(true); } return(ActionManager.HandleShortcut(evt)); }
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())); }
static bool InternalExecute(Event evt, WindowState state) { if (state.IsCurrentEditingASequencerTextField()) { return(false); } var tracks = SelectionManager.SelectedTracks().ToList(); var items = SelectionManager.SelectedClipGUI(); foreach (var item in items) { var trackGUI = item.parent as TimelineTrackBaseGUI; if (trackGUI == null) { continue; } if (!tracks.Contains(trackGUI.track)) { tracks.Add(trackGUI.track); } } return(ActionManager.HandleShortcut(evt, ActionManager.TrackActions, x => ActionManager.ExecuteTrackAction(x, tracks))); }
public override bool Execute(WindowState state) { var inlineCurveEditor = SelectionManager.GetCurrentInlineEditorCurve(); if (FrameSelectedAction.ShouldHandleInlineCurve(inlineCurveEditor)) { FrameSelectedAction.FrameInlineCurves(inlineCurveEditor, state, false); return(true); } if (state.IsCurrentEditingASequencerTextField()) { return(false); } var w = state.GetWindow(); if (w == null || w.treeView == null) { return(false); } var visibleTracks = w.treeView.visibleTracks.ToList(); if (state.editSequence.asset != null && state.editSequence.asset.markerTrack != null) { visibleTracks.Add(state.editSequence.asset.markerTrack); } if (visibleTracks.Count == 0) { return(false); } var startTime = float.MaxValue; var endTime = float.MinValue; foreach (var t in visibleTracks) { if (t == null) { continue; } double trackStart, trackEnd; t.GetItemRange(out trackStart, out trackEnd); startTime = Mathf.Min(startTime, (float)trackStart); endTime = Mathf.Max(endTime, (float)(trackEnd)); } if (startTime != float.MinValue) { FrameSelectedAction.FrameRange(startTime, endTime, state); return(true); } return(false); }
public override bool Execute(WindowState state) { var inlineCurveEditor = SelectionManager.GetCurrentInlineEditorCurve(); if (ShouldHandleInlineCurve(inlineCurveEditor)) { FrameInlineCurves(inlineCurveEditor, state, true); return(true); } if (state.IsCurrentEditingASequencerTextField()) { return(false); } if (SelectionManager.Count() == 0) { Invoke <FrameAllAction>(state); return(true); } var startTime = float.MaxValue; var endTime = float.MinValue; var clips = SelectionManager.SelectedClipGUI(); var markers = SelectionManager.SelectedMarkers(); if (!clips.Any() && !markers.Any()) { return(false); } foreach (var c in clips) { startTime = Mathf.Min(startTime, (float)c.clip.start); endTime = Mathf.Max(endTime, (float)c.clip.end); if (c.clipCurveEditor != null) { c.clipCurveEditor.FrameClip(); } } foreach (var marker in markers) { startTime = Mathf.Min(startTime, (float)marker.time); endTime = Mathf.Max(endTime, (float)marker.time); } FrameRange(startTime, endTime, state); return(true); }
protected override bool ExecuteCommand(Event evt, WindowState state) { if (state.IsCurrentEditingASequencerTextField()) { return(false); } var inlineCurveEditor = SelectionManager.GetCurrentInlineEditorCurve(); if (inlineCurveEditor == null || !inlineCurveEditor.inlineCurvesSelected) { return(false); } if (evt.commandName != EventCommandNames.FrameSelected) { return(false); } Invoker.InvokeWithSelected <FrameSelectedAction>(); return(true); }
public void OnGUI(WindowState state, EventType rawType, Vector2 mousePosition) { if (m_Id == 0) { m_Id = GUIUtility.GetPermanentControlID(); } if (state == null || state.GetWindow().treeView == null) { return; } var evt = Event.current; if (rawType == EventType.MouseDown || evt.type == EventType.MouseDown) { if (state.IsCurrentEditingASequencerTextField()) { return; } m_ActiveRect = TimelineWindow.instance.sequenceContentRect; //remove the track header splitter overlap m_ActiveRect.x += k_HeaderSplitterOverlap; m_ActiveRect.width -= k_HeaderSplitterOverlap; if (!m_ActiveRect.Contains(mousePosition)) { return; } if (!CanStartRectangle(evt)) { return; } if (enableAutoPan) { m_TimeAreaAutoPanner = new TimeAreaAutoPanner(state); } m_StartPoint = new TimelinePoint(state, mousePosition); m_EndPixel = mousePosition; GUIUtility.hotControl = m_Id; //HACK: Because the treeView eats all the events, steal the hotControl if necessary... evt.Use(); return; } switch (evt.GetTypeForControl(m_Id)) { case EventType.KeyDown: { if (GUIUtility.hotControl == m_Id) { if (evt.keyCode == KeyCode.Escape) { m_TimeAreaAutoPanner = null; GUIUtility.hotControl = 0; evt.Use(); } } return; } case EventType.MouseDrag: { if (GUIUtility.hotControl != m_Id) { return; } m_EndPixel = mousePosition; evt.Use(); return; } case EventType.MouseUp: { if (GUIUtility.hotControl != m_Id) { return; } m_TimeAreaAutoPanner = null; var rect = CurrentRectangle(); if (IsValidRect(rect)) { OnFinish(evt, state, rect); } GUIUtility.hotControl = 0; evt.Use(); return; } } if (GUIUtility.hotControl == m_Id) { if (evt.type == EventType.Repaint) { var r = CurrentRectangle(); if (IsValidRect(r)) { using (new GUIViewportScope(m_ActiveRect)) { DrawRectangle(r); } } } if (m_TimeAreaAutoPanner != null) { m_TimeAreaAutoPanner.OnGUI(evt); } } }