protected override bool ContextClick(Event evt, WindowState state) { if (!m_TimeAreaItem.bounds.Contains(evt.mousePosition)) { return(false); } var tolerance = TimeUtility.GetEpsilon(state.editSequence.time, state.referenceSequence.frameRate); var menu = new GenericMenu(); if (!TimelineWindow.instance.state.editSequence.isReadOnly) { menu.AddItem(kSingleFrameGuiContents, false, () => Gaps.Insert(state.editSequence.asset, state.editSequence.time, 1.0 / state.referenceSequence.frameRate, tolerance) ); for (var i = 0; i != kFrameInsertionValues.Length; ++i) { double f = kFrameInsertionValues[i]; menu.AddItem( kFrameInsertionValuesGuiContents[i], false, () => Gaps.Insert(state.editSequence.asset, state.editSequence.time, f / state.referenceSequence.frameRate, tolerance) ); } var playRangeTime = state.playRange; if (playRangeTime.y > playRangeTime.x) { menu.AddItem(kSelectedTimeGuiContents, false, () => Gaps.Insert(state.editSequence.asset, playRangeTime.x, playRangeTime.y - playRangeTime.x, TimeUtility.GetEpsilon(playRangeTime.x, state.referenceSequence.frameRate)) ); } } menu.AddItem(EditorGUIUtility.TrTextContent("Select/Clips Ending Before"), false, () => SelectClipsEndingBefore(state)); menu.AddItem(EditorGUIUtility.TrTextContent("Select/Clips Starting Before"), false, () => SelectClipsStartingBefore(state)); menu.AddItem(EditorGUIUtility.TrTextContent("Select/Clips Ending After"), false, () => SelectClipsEndingAfter(state)); menu.AddItem(EditorGUIUtility.TrTextContent("Select/Clips Starting After"), false, () => SelectClipsStartingAfter(state)); menu.AddItem(EditorGUIUtility.TrTextContent("Select/Clips Intersecting"), false, () => SelectClipsIntersecting(state)); menu.AddItem(EditorGUIUtility.TrTextContent("Select/Blends Intersecting"), false, () => SelectBlendsIntersecting(state)); menu.ShowAsContext(); return(true); }
internal static void SelectClipsStartingAfter(WindowState state) { var tolerance = TimeUtility.GetEpsilon(state.editSequence.time, state.referenceSequence.frameRate); SelectMenuCallback(x => x.start - state.editSequence.time >= -tolerance, state); }
internal static void SelectClipsEndingBefore(WindowState state) { var tolerance = TimeUtility.GetEpsilon(state.editSequence.time, state.referenceSequence.frameRate); SelectMenuCallback(x => x.end < state.editSequence.time + tolerance, state); }