public override bool Execute(WindowState state) { var inlineCurveEditor = SelectionManager.GetCurrentInlineEditorCurve(); if (inlineCurveEditor != null && inlineCurveEditor.inlineCurvesSelected) { FrameSelectedAction.FrameInlineCurves(inlineCurveEditor, state, false); return(true); } if (state.IsEditingASubItem()) { 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(ActionContext actionContext) { var inlineCurveEditor = SelectionManager.GetCurrentInlineEditorCurve(); if (FrameSelectedAction.ShouldHandleInlineCurve(inlineCurveEditor)) { FrameSelectedAction.FrameInlineCurves(inlineCurveEditor, false); return(true); } if (TimelineWindow.instance.state.IsCurrentEditingASequencerTextField()) { return(false); } var visibleTracks = TimelineWindow.instance.treeView.visibleTracks.ToList(); if (TimelineEditor.inspectedAsset != null && TimelineEditor.inspectedAsset.markerTrack != null) { visibleTracks.Add(TimelineEditor.inspectedAsset.markerTrack); } if (visibleTracks.Count == 0) { return(false); } var startTime = float.MaxValue; var endTime = float.MinValue; foreach (var t in visibleTracks) { if (t == null) { continue; } // time range based on track's curves and clips. double trackStart, trackEnd, trackDuration; t.GetSequenceTime(out trackStart, out trackDuration); trackEnd = trackStart + trackDuration; // take track's markers into account double itemsStart, itemsEnd; ItemsUtils.GetItemRange(t, out itemsStart, out itemsEnd); startTime = Mathf.Min(startTime, (float)trackStart, (float)itemsStart); endTime = Mathf.Max(endTime, (float)(trackEnd), (float)itemsEnd); } FrameSelectedAction.FrameRange(startTime, endTime); return(true); }
public override bool Execute(ActionContext actionContext) { var inlineCurveEditor = SelectionManager.GetCurrentInlineEditorCurve(); if (FrameSelectedAction.ShouldHandleInlineCurve(inlineCurveEditor)) { FrameSelectedAction.FrameInlineCurves(inlineCurveEditor, false); return(true); } if (TimelineWindow.instance.state.IsCurrentEditingASequencerTextField()) { return(false); } var visibleTracks = TimelineWindow.instance.treeView.visibleTracks.ToList(); if (TimelineEditor.inspectedAsset != null && TimelineEditor.inspectedAsset.markerTrack != null) { visibleTracks.Add(TimelineEditor.inspectedAsset.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); return(true); } return(false); }