void DrawOptions() { if (currentMode.headerState.options == TimelineModeGUIState.Hidden || state.editSequence.asset == null) { return; } using (new EditorGUI.DisabledScope(currentMode.headerState.options == TimelineModeGUIState.Disabled)) { var rect = new Rect(position.width - WindowConstants.cogButtonWidth, 0, WindowConstants.cogButtonWidth, WindowConstants.timeAreaYPosition); if (EditorGUI.DropdownButton(rect, DirectorStyles.optionsCogIcon, FocusType.Keyboard, EditorStyles.toolbarButton)) { GenericMenu menu = new GenericMenu(); menu.AddItem(L10n.TextContent("Preferences Page..."), false, () => SettingsWindow.Show(SettingsScope.User, "Preferences/Timeline")); menu.AddSeparator(""); menu.AddItem(MenuItemFrames, state.timeFormat == TimeFormat.Frames, () => state.timeFormat = TimeFormat.Frames); menu.AddItem(MenuItemTimecode, state.timeFormat == TimeFormat.Timecode, () => state.timeFormat = TimeFormat.Timecode); menu.AddItem(MenuItemSeconds, state.timeFormat == TimeFormat.Seconds, () => state.timeFormat = TimeFormat.Seconds); menu.AddSeparator(""); TimeAreaContextMenu.AddTimeAreaMenuItems(menu, state); menu.AddSeparator(""); bool isCustom = !FrameRateDisplayUtility.GetStandardFromFrameRate(state.editSequence.frameRate, out StandardFrameRates option); var frameRatesLabels = FrameRateDisplayUtility.GetDefaultFrameRatesLabels(option); if (isCustom) { frameRatesLabels[frameRatesLabels.Length - 1] = String.Format(k_CustomFpsLabel, frameRatesLabels.Last(), state.editSequence.frameRate); } for (var i = 0; i < frameRatesLabels.Length; i++) { var currentStandard = (StandardFrameRates)i; AddStandardFrameRateMenu(menu, currentStandard, frameRatesLabels[i], currentStandard == option); } if (Unsupported.IsDeveloperMode()) { menu.AddSeparator(""); menu.AddItem(L10n.TextContent("Show Snapping Debug"), SnapEngine.displayDebugLayout, () => SnapEngine.displayDebugLayout = !SnapEngine.displayDebugLayout); menu.AddItem(L10n.TextContent("Debug TimeArea"), false, () => Debug.LogFormat("translation: {0} scale: {1} rect: {2} shownRange: {3}", m_TimeArea.translation, m_TimeArea.scale, m_TimeArea.rect, m_TimeArea.shownArea)); menu.AddItem(L10n.TextContent("Edit Skin"), false, () => Selection.activeObject = DirectorStyles.Instance.customSkin); menu.AddItem(L10n.TextContent("Show QuadTree Debugger"), state.showQuadTree, () => state.showQuadTree = !state.showQuadTree); } menu.DropDown(rect); } } }
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(L10n.TextContent("Select/Clips Ending Before"), false, () => SelectClipsEndingBefore(state)); menu.AddItem(L10n.TextContent("Select/Clips Starting Before"), false, () => SelectClipsStartingBefore(state)); menu.AddItem(L10n.TextContent("Select/Clips Ending After"), false, () => SelectClipsEndingAfter(state)); menu.AddItem(L10n.TextContent("Select/Clips Starting After"), false, () => SelectClipsStartingAfter(state)); menu.AddItem(L10n.TextContent("Select/Clips Intersecting"), false, () => SelectClipsIntersecting(state)); menu.AddItem(L10n.TextContent("Select/Blends Intersecting"), false, () => SelectBlendsIntersecting(state)); menu.ShowAsContext(); return(true); }
void DrawOptions() { if (currentMode.headerState.options == TimelineModeGUIState.Hidden || state.editSequence.asset == null) { return; } using (new EditorGUI.DisabledScope(currentMode.headerState.options == TimelineModeGUIState.Disabled)) { var rect = new Rect(position.width - WindowConstants.cogButtonWidth, 0, WindowConstants.cogButtonWidth, WindowConstants.timeAreaYPosition); if (EditorGUI.DropdownButton(rect, DirectorStyles.optionsCogIcon, FocusType.Keyboard, EditorStyles.toolbarButton)) { GenericMenu menu = new GenericMenu(); menu.AddItem(L10n.TextContent("Preferences Page..."), false, () => SettingsWindow.Show(SettingsScope.User, "Preferences/Timeline")); menu.AddSeparator(""); menu.AddItem(MenuItemFrames, state.timeFormat == TimeFormat.Frames, () => state.timeFormat = TimeFormat.Frames); menu.AddItem(MenuItemTimecode, state.timeFormat == TimeFormat.Timecode, () => state.timeFormat = TimeFormat.Timecode); menu.AddItem(MenuItemSeconds, state.timeFormat == TimeFormat.Seconds, () => state.timeFormat = TimeFormat.Seconds); menu.AddSeparator(""); TimeAreaContextMenu.AddTimeAreaMenuItems(menu, state); menu.AddSeparator(""); bool standardFrameRate = false; for (int i = 0; i < TimelineProjectSettings.framerateValues.Length; i++) { standardFrameRate |= AddStandardFrameRateMenu(menu, "Frame Rate/" + TimelineProjectSettings.framerateLabels[i], TimelineProjectSettings.framerateValues[i]); } if (standardFrameRate) { menu.AddDisabledItem(L10n.TextContent("Frame Rate/Custom")); } else { menu.AddItem(L10n.TextContent("Frame Rate/Custom (" + state.editSequence.frameRate + ")"), true, () => {}); } menu.AddSeparator(""); if (state.playRangeEnabled) { menu.AddItem(L10n.TextContent("Play Range Mode/Loop"), state.playRangeLoopMode, () => state.playRangeLoopMode = true); menu.AddItem(L10n.TextContent("Play Range Mode/Once"), !state.playRangeLoopMode, () => state.playRangeLoopMode = false); } else { menu.AddDisabledItem(L10n.TextContent("Play Range Mode")); } if (Unsupported.IsDeveloperMode()) { menu.AddSeparator(""); menu.AddItem(L10n.TextContent("Show Snapping Debug"), SnapEngine.displayDebugLayout, () => SnapEngine.displayDebugLayout = !SnapEngine.displayDebugLayout); menu.AddItem(L10n.TextContent("Debug TimeArea"), false, () => Debug.LogFormat("translation: {0} scale: {1} rect: {2} shownRange: {3}", m_TimeArea.translation, m_TimeArea.scale, m_TimeArea.rect, m_TimeArea.shownArea)); menu.AddItem(L10n.TextContent("Edit Skin"), false, () => Selection.activeObject = DirectorStyles.Instance.customSkin); menu.AddItem(L10n.TextContent("Show QuadTree Debugger"), state.showQuadTree, () => state.showQuadTree = !state.showQuadTree); } menu.DropDown(rect); } } }
public static GUIContent TrTextContent(string text, string tooltip = null) { return(L10n.TextContent(text, tooltip)); }