protected override bool ContextClick(Event evt, WindowState state) { if (!m_TimeAreaItem.bounds.Contains(evt.mousePosition)) { return(false); } var tolerance = 0.25f / state.referenceSequence.frameRate; var menu = new GenericMenu(); if (!TimelineWindow.instance.state.editSequence.isReadOnly) { menu.AddItem(EditorGUIUtility.TrTextContent("Insert/Frame/Single"), false, () => { Gaps.Insert(state.editSequence.asset, state.editSequence.time, 1.0f / state.referenceSequence.frameRate, tolerance); state.Refresh(); } ); int[] values = { 5, 10, 25, 100 }; for (var i = 0; i != values.Length; ++i) { float f = values[i]; menu.AddItem(EditorGUIUtility.TrTextContent("Insert/Frame/" + values[i] + " Frames"), false, () => { Gaps.Insert(state.editSequence.asset, state.editSequence.time, f / state.referenceSequence.frameRate, tolerance); state.Refresh(); } ); } var playRangeTime = state.playRange; if (playRangeTime.y > playRangeTime.x) { menu.AddItem(EditorGUIUtility.TrTextContent("Insert/Selected Time"), false, () => { Gaps.Insert(state.editSequence.asset, playRangeTime.x, playRangeTime.y - playRangeTime.x, tolerance); state.Refresh(); } ); } } menu.AddItem(EditorGUIUtility.TrTextContent("Select/Clips Ending Before"), false, () => SelectMenuCallback(x => x.end < state.editSequence.time + tolerance, state)); menu.AddItem(EditorGUIUtility.TrTextContent("Select/Clips Starting Before"), false, () => SelectMenuCallback(x => x.start < state.editSequence.time + tolerance, state)); menu.AddItem(EditorGUIUtility.TrTextContent("Select/Clips Ending After"), false, () => SelectMenuCallback(x => x.end - state.editSequence.time >= -tolerance, state)); menu.AddItem(EditorGUIUtility.TrTextContent("Select/Clips Starting After"), false, () => SelectMenuCallback(x => x.start - state.editSequence.time >= -tolerance, state)); menu.AddItem(EditorGUIUtility.TrTextContent("Select/Clips Intersecting"), false, () => SelectMenuCallback(x => x.start <= state.editSequence.time && state.editSequence.time <= x.end, state)); menu.AddItem(EditorGUIUtility.TrTextContent("Select/Blends Intersecting"), false, () => SelectMenuCallback(x => SelectBlendingIntersecting(x, state.editSequence.time), state)); menu.ShowAsContext(); return(true); }
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); }
public override void Init(IControl parent) { parent.ContextClick += delegate(object target, Event evt, TimelineWindow.TimelineState state) { float tolerance = 0.25f / state.frameRate; GenericMenu genericMenu = new GenericMenu(); genericMenu.AddItem(EditorGUIUtility.TextContent("Insert/Frame/Single"), false, delegate { Gaps.Insert(state.timeline, state.time, (double)(1f / state.frameRate), tolerance); state.Refresh(true); }); int[] array = new int[] { 5, 10, 25, 100 }; for (int num = 0; num != array.Length; num++) { float f = (float)array[num]; genericMenu.AddItem(EditorGUIUtility.TextContent("Insert/Frame/" + array[num] + " Frames"), false, delegate { Gaps.Insert(state.timeline, state.time, (double)(f / state.frameRate), tolerance); state.Refresh(true); }); } Vector2 playRangeTime = state.playRangeTime; if (playRangeTime.y > playRangeTime.x) { genericMenu.AddItem(EditorGUIUtility.TextContent("Insert/Selected Time"), false, delegate { Gaps.Insert(state.timeline, (double)playRangeTime.x, (double)(playRangeTime.y - playRangeTime.x), tolerance); state.Refresh(true); }); } genericMenu.AddItem(EditorGUIUtility.TextContent("Select/Clips Ending Before"), false, delegate { TrackheadContextMenu.SelectMenuCallback((TimelineClip x) => x.end < state.time + (double)tolerance, state); }); genericMenu.AddItem(EditorGUIUtility.TextContent("Select/Clips Starting Before"), false, delegate { TrackheadContextMenu.SelectMenuCallback((TimelineClip x) => x.start < state.time + (double)tolerance, state); }); genericMenu.AddItem(EditorGUIUtility.TextContent("Select/Clips Ending After"), false, delegate { TrackheadContextMenu.SelectMenuCallback((TimelineClip x) => x.end - state.time >= (double)(-(double)tolerance), state); }); genericMenu.AddItem(EditorGUIUtility.TextContent("Select/Clips Starting After"), false, delegate { TrackheadContextMenu.SelectMenuCallback((TimelineClip x) => x.start - state.time >= (double)(-(double)tolerance), state); }); genericMenu.AddItem(EditorGUIUtility.TextContent("Select/Clips Intersecting"), false, delegate { TrackheadContextMenu.SelectMenuCallback((TimelineClip x) => x.start <= state.time && state.time <= x.end, state); }); genericMenu.AddItem(EditorGUIUtility.TextContent("Select/Blends Intersecting"), false, delegate { TrackheadContextMenu.SelectMenuCallback((TimelineClip x) => TrackheadContextMenu.SelectBlendingIntersecting(x, state.time), state); }); genericMenu.ShowAsContext(); return(base.ConsumeEvent()); }; }