void DrawExtrapolationOptions() { EditorGUI.BeginChangeCheck(); // PreExtrapolation var preExtrapolationTime = m_PreExtrapolationTimeProperty.doubleValue; bool hasPreExtrap = preExtrapolationTime > 0.0; if (hasPreExtrap) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(m_PreExtrapolationModeProperty, Styles.PreExtrapolateLabel); using (new GUIMixedValueScope(m_PreExtrapolationTimeProperty.hasMultipleDifferentValues)) EditorGUILayout.DoubleField(preExtrapolationTime, EditorStyles.label); EditorGUILayout.EndHorizontal(); } // PostExtrapolation { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(m_PostExtrapolationModeProperty, Styles.PostExtrapolateLabel); using (new GUIMixedValueScope(m_PostExtrapolationTimeProperty.hasMultipleDifferentValues)) EditorGUILayout.DoubleField(m_PostExtrapolationTimeProperty.doubleValue, EditorStyles.label); EditorGUILayout.EndHorizontal(); } if (EditorGUI.EndChangeCheck()) { // if these options change the interval tree may need to be rebuilt. if (TimelineWindow.IsEditingTimelineAsset(m_TimelineAsset) && TimelineWindow.instance.state != null) { TimelineWindow.instance.state.Refresh(); } } }
internal override void OnHeaderTitleGUI(Rect titleRect, string header) { serializedObject.Update(); Rect textFieldRect = titleRect; textFieldRect.height = 16f; EditorGUI.showMixedValue = m_Name.hasMultipleDifferentValues; TimelineWindow seqWindow = TimelineWindow.instance; EditorGUI.BeginChangeCheck(); string newName = EditorGUI.DelayedTextField(textFieldRect, m_Name.stringValue, EditorStyles.textField); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck() && !string.IsNullOrEmpty(newName)) { for (int c = 0; c < targets.Length; c++) { ObjectNames.SetNameSmart(targets[c], newName); } if (seqWindow != null) { seqWindow.Repaint(); } } serializedObject.ApplyModifiedProperties(); }
public TimelineTreeViewGUI(TimelineWindow sequencerWindow, TimelineAsset timeline, Rect rect) { m_Timeline = timeline; m_Window = sequencerWindow; var treeviewState = new TreeViewState(); treeviewState.scrollPos = new Vector2(treeviewState.scrollPos.x, TimelineWindowViewPrefs.GetOrCreateViewModel(m_Timeline).verticalScroll); m_TreeView = new TreeViewController(sequencerWindow, treeviewState); m_TreeView.horizontalScrollbarStyle = GUIStyle.none; m_TreeView.scrollViewStyle = GUI.skin.scrollView; m_TreeView.keyboardInputCallback = sequencerWindow.TreeViewKeyboardCallback; m_TimelineTreeView = new TimelineTreeView(sequencerWindow, m_TreeView); var dragging = new TimelineDragging(m_TreeView, m_Window, m_Timeline); m_DataSource = new TimelineDataSource(this, m_TreeView, sequencerWindow); m_DataSource.onVisibleRowsChanged += m_TimelineTreeView.CalculateRowRects; m_TreeView.Init(rect, m_DataSource, m_TimelineTreeView, dragging); m_DataSource.ExpandItems(m_DataSource.root); }
internal override void OnHeaderTitleGUI(Rect titleRect, string header) { if (hasMultipleSelection) { base.OnHeaderTitleGUI(titleRect, m_MultiselectionHeaderTitle); return; } if (m_DisplayNameProperty != null) { using (new EditorGUI.DisabledScope(!IsEnabled())) { serializedObject.Update(); if (IsLocked()) { base.OnHeaderTitleGUI(titleRect, m_DisplayNameProperty.stringValue); } else { EditorGUI.BeginChangeCheck(); EditorGUI.DelayedTextField(titleRect, m_DisplayNameProperty, GUIContent.none); if (EditorGUI.EndChangeCheck()) { ApplyModifiedProperties(); TimelineWindow.RepaintIfEditingTimelineAsset(m_TimelineAsset); } } } } }
private void DrawExtrapolationOptions() { EditorGUI.BeginChangeCheck(); double doubleValue = this.m_PreExtrapolationTimeProperty.get_doubleValue(); bool flag = doubleValue > 0.0; if (flag) { EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_PreExtrapolationModeProperty, ClipInspector.Styles.PreExtrapolateLabel, new GUILayoutOption[0]); EditorGUI.set_showMixedValue(this.m_PreExtrapolationTimeProperty.get_hasMultipleDifferentValues()); EditorGUILayout.DoubleField(doubleValue, EditorStyles.get_label(), new GUILayoutOption[0]); EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_PostExtrapolationModeProperty, ClipInspector.Styles.PostExtrapolateLabel, new GUILayoutOption[0]); EditorGUI.set_showMixedValue(this.m_PostExtrapolationTimeProperty.get_hasMultipleDifferentValues()); EditorGUILayout.DoubleField(this.m_PostExtrapolationTimeProperty.get_doubleValue(), EditorStyles.get_label(), new GUILayoutOption[0]); EditorGUILayout.EndHorizontal(); if (EditorGUI.EndChangeCheck()) { if (TimelineWindow.IsEditingTimelineAsset(this.m_TimelineAsset) && TimelineWindow.instance.state != null) { TimelineWindow.instance.state.Refresh(); } } }
void OnGUI() { if (inst == null) { inst = this; } TransportToolbarGUI(); state?.CheckExist(); if (state.timeline) { TimelineTimeAreaGUI(); TimelineHeaderGUI(); DrawMarkerDrawer(); tree.OnGUI(state); DrawTimeOnSlider(); DrawSptLine(); DrawEndLine(); EventHandler(); } else { CalculWindowCenter(); EditorGUI.LabelField(centerArea, TimelineStyles.createNewTimelineText); } winArea = position; }
public override void OnInspectorGUI() { serializedObject.Update(); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_FrameRateProperty, Styles.FrameRate, GUILayout.MinWidth(140)); var frameRate = m_FrameRateProperty.doubleValue; EditorGUILayout.PropertyField(m_DurationModeProperty, Styles.DurationMode, GUILayout.MinWidth(140)); var durationMode = (TimelineAsset.DurationMode)m_DurationModeProperty.enumValueIndex; var inputEvent = InputEvent.None; if (durationMode == TimelineAsset.DurationMode.FixedLength) { TimelineInspectorUtility.TimeField(m_FixedDurationProperty, Styles.Duration, false, frameRate, double.Epsilon, TimelineClip.kMaxTimeValue * 2, ref inputEvent); } else { var isMixed = targets.Length > 1; TimelineInspectorUtility.TimeField(Styles.Duration, ((TimelineAsset)target).duration, true, isMixed, frameRate, double.MinValue, double.MaxValue, ref inputEvent); } bool changed = EditorGUI.EndChangeCheck(); serializedObject.ApplyModifiedProperties(); if (changed) { TimelineWindow.RepaintIfEditingTimelineAsset((TimelineAsset)target); } }
public override void OnInspectorGUI() { base.get_serializedObject().Update(); EditorGUI.BeginChangeCheck(); if (this.m_HasDrawer) { EditorGUILayout.PropertyField(this.m_ItemProperty, this.m_Label, new GUILayoutOption[0]); } else { EditorGUILayout.PropertyField(this.m_KeyProperty, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_TimeProperty, new GUILayoutOption[0]); } if (EditorGUI.EndChangeCheck()) { base.get_serializedObject().ApplyModifiedProperties(); TimelineWindow instance = TimelineWindow.instance; if (instance != null) { instance.Repaint(); if (instance.state != null) { instance.state.rebuildGraph = true; } } } }
internal override void OnHeaderTitleGUI(Rect titleRect, string header) { this.m_Name = base.get_serializedObject().FindProperty("m_Name"); base.get_serializedObject().Update(); Rect rect = titleRect; rect.set_height(16f); EditorGUI.BeginChangeCheck(); EditorGUI.set_showMixedValue(this.m_Name.get_hasMultipleDifferentValues()); TimelineWindow instance = TimelineWindow.instance; bool flag = instance == null || instance.state == null || instance.state.currentDirector == null; EditorGUI.BeginDisabledGroup(flag); EditorGUI.BeginChangeCheck(); string text = EditorGUI.DelayedTextField(rect, this.m_Name.get_stringValue(), EditorStyles.get_textField()); EditorGUI.set_showMixedValue(false); if (EditorGUI.EndChangeCheck() && !string.IsNullOrEmpty(text)) { for (int i = 0; i < base.get_targets().Count <Object>(); i++) { ObjectNames.SetNameSmart(base.get_targets()[i], text); } if (instance != null) { instance.Repaint(); } } EditorGUI.EndDisabledGroup(); base.get_serializedObject().ApplyModifiedProperties(); }
void UpdateInfiniteClipEditor(AnimationTrack animationTrack, TimelineWindow window) { if (animationTrack != null && clipCurveEditor == null && animationTrack.ShouldShowInfiniteClipEditor()) { clipCurveEditor = new ClipCurveEditor(new InfiniteClipCurveDataSource(this), window); } }
public TimelineTreeView(TimelineWindow sequencerWindow, TreeViewController treeView) { this.m_TreeView = treeView; this.m_TreeView.set_useExpansionAnimation(true); TimelineTreeView.m_Styles = DirectorStyles.Instance; this.m_State = sequencerWindow.state; this.m_FoldoutWidth = DirectorStyles.Instance.foldout.get_fixedWidth(); }
public WindowState(TimelineWindow w, SequenceHierarchy hierarchy) { m_Window = w; m_Preferences = w.preferences; hierarchy.Init(this); m_SequenceHierarchy = hierarchy; TimelinePlayable.muteAudioScrubbing = muteAudioScrubbing; }
public TimelineDataSource(TimelineTreeViewGUI parentGUI, TreeViewController treeView, TimelineWindow sequencerWindow) : base(treeView) { m_TreeView.useExpansionAnimation = false; m_TimelineWindow = sequencerWindow; m_ParentGUI = parentGUI; FetchData(); }
void UpdateInfiniteClipEditor(TimelineWindow window) { if (clipCurveEditor != null || track == null || !track.ShouldShowInfiniteClipEditor()) { return; } var dataSource = CurveDataSource.Create(this); clipCurveEditor = new ClipCurveEditor(dataSource, window, track); }
public TimeAreaAutoPanner(WindowState state) { m_State = state; m_Window = m_State.GetWindow(); var shownRange = m_State.timeAreaShownRange; var trackViewBounds = m_Window.sequenceRect; m_ViewRect = Rect.MinMaxRect(m_State.TimeToPixel(shownRange.x), trackViewBounds.yMin, m_State.TimeToPixel(shownRange.y), trackViewBounds.yMax); }
public override void OnInspectorGUI() { if (target == null) { return; } serializedObject.Update(); if (!m_TimelineWindow) { m_TimelineWindow = TimelineWindow.instance; } ShowAnimationClipField(); ShowRecordableClipRename(); ShowAnimationClipWarnings(); EditorGUI.BeginChangeCheck(); TransformOffsetsGUI(); // extra checks are because the context menu may need to cause a re-evaluate bool changed = EditorGUI.EndChangeCheck() || m_LastPosition != m_PositionProperty.vector3Value || m_LastRotation != m_RotationProperty.vector3Value; m_LastPosition = m_PositionProperty.vector3Value; m_LastRotation = m_RotationProperty.vector3Value; if (changed) { // updates the changed properties and pushes them to the active playable serializedObject.ApplyModifiedProperties(); ((AnimationPlayableAsset)target).LiveLink(); // force an evaluate to happen next frame if (TimelineWindow.instance != null && TimelineWindow.instance.state != null) { TimelineWindow.instance.state.Evaluate(); } } EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_ApplyFootIK, Styles.ApplyFootIK); EditorGUILayout.PropertyField(m_Loop, Styles.Loop); if (EditorGUI.EndChangeCheck()) { TimelineEditor.Refresh(RefreshReason.ContentsModified); } serializedObject.ApplyModifiedProperties(); }
void DrawBlendOptions() { EditorGUI.BeginChangeCheck(); DrawBlendCurve(Styles.BlendInCurveName, m_BlendInCurveModeProperty, m_MixInCurveProperty, x => OnMixCurveSelected("Blend In", BuiltInPresets.blendInPresets, x, true)); DrawBlendCurve(Styles.BlendOutCurveName, m_BlendOutCurveModeProperty, m_MixOutCurveProperty, x => OnMixCurveSelected("Blend Out", BuiltInPresets.blendOutPresets, x, false)); if (EditorGUI.EndChangeCheck()) { TimelineWindow.RepaintIfEditingTimelineAsset(m_TimelineAsset); } }
public override bool Execute(TimelineWindow.TimelineState state) { bool result; if (state.IsEditingASubItem()) { result = false; } else { TimelineWindow window = state.GetWindow(); if (window == null || window.treeView == null) { result = false; } else { TrackAsset[] visibleTracks = window.treeView.visibleTracks; if (visibleTracks.Length == 0) { result = false; } else { float num = 3.40282347E+38f; float num2 = -3.40282347E+38f; TrackAsset[] array = visibleTracks; for (int i = 0; i < array.Length; i++) { TrackAsset trackAsset = array[i]; double num3; double num4; trackAsset.GetSequenceTime(out num3, out num4); num = Mathf.Min(num, (float)num3); num2 = Mathf.Max(num2, (float)(num3 + num4)); } float num5 = num2 - Math.Max(0f, num); if (num5 > 0f) { state.SetTimeAreaShownRange(Mathf.Max(-10f, num - num5 * 0.1f), num2 + num5 * 0.1f); } else { state.SetTimeAreaShownRange(0f, 100f); } state.Evaluate(); result = true; } } } return(result); }
public BindingSelector(EditorWindow window, CurveEditor curveEditor, TreeViewState trackGlobalTreeViewState) { m_Window = window as TimelineWindow; m_CurveEditor = curveEditor; m_TrackGlobalTreeViewState = trackGlobalTreeViewState; m_DopeLines = new ReorderableList(m_StringList, typeof(string), false, false, false, false); m_DopeLines.drawElementBackgroundCallback = null; m_DopeLines.showDefaultBackground = false; m_DopeLines.index = 0; m_DopeLines.headerHeight = 0; m_DopeLines.elementHeight = 20; m_DopeLines.draggable = false; }
public static void DrawLineAtTime(TimelineWindow win, float time, Color color, bool dotted = false) { var t = win.TimeToPixel(time); var p0 = new Vector3(t, win.timeAreaRect.yMax); var p1 = new Vector3(t, win.timeAreaRect.yMax + win.winArea.height - WindowConstants.sliderWidth); if (dotted) { DrawDottedLine(p0, p1, 4.0f, color); } else { DrawLine(p0, p1, color); } }
public TimelineTreeView(TimelineWindow sequencerWindow, TreeViewController treeView) { m_TreeView = treeView; m_TreeView.useExpansionAnimation = true; m_TreeView.selectionChangedCallback += SelectionChangedCallback; m_TreeView.contextClickOutsideItemsCallback += ContextClickOutsideItemsCallback; m_TreeView.itemDoubleClickedCallback += ItemDoubleClickedCallback; m_TreeView.contextClickItemCallback += ContextClickItemCallback; m_TreeView.SetConsumeKeyDownEvents(false); m_Styles = DirectorStyles.Instance; m_State = sequencerWindow.state; m_FoldoutWidth = DirectorStyles.Instance.foldout.fixedWidth; }
private void DrawBlendOptions() { EditorGUI.BeginChangeCheck(); this.DrawBlendCurve(ClipInspector.Styles.BlendInCurveName, this.m_BlendInCurveModeProperty, this.m_MixInCurveProperty, delegate(SerializedProperty x) { this.OnMixCurveSelected("Blend In", BuiltInPresets.blendInPresets, x, true); }); this.DrawBlendCurve(ClipInspector.Styles.BlendOutCurveName, this.m_BlendOutCurveModeProperty, this.m_MixOutCurveProperty, delegate(SerializedProperty x) { this.OnMixCurveSelected("Blend Out", BuiltInPresets.blendOutPresets, x, false); }); if (EditorGUI.EndChangeCheck()) { TimelineWindow.RepaintIfEditingTimelineAsset(this.m_TimelineAsset); } }
internal override void OnHeaderTitleGUI(Rect titleRect, string header) { if (this.hasMultipleSelection) { base.OnHeaderTitleGUI(titleRect, this.m_MultiselectionHeaderTitle); } else if (this.m_DisplayNameProperty != null) { base.get_serializedObject().Update(); EditorGUI.BeginChangeCheck(); EditorGUI.DelayedTextField(titleRect, this.m_DisplayNameProperty, GUIContent.none); if (EditorGUI.EndChangeCheck()) { this.ApplyModifiedProperties(); TimelineWindow.RepaintIfEditingTimelineAsset(this.m_TimelineAsset); } } }
public void RefreshCurveEditor() { AnimationTrack animationTrack = base.track as AnimationTrack; TimelineWindow instance = TimelineWindow.instance; if (animationTrack != null && instance != null && instance.state != null) { bool flag = this.clipCurveEditor != null; bool flag2 = animationTrack.ShouldShowInfiniteClipEditor(); if (flag != flag2) { instance.state.AddEndFrameDelegate(delegate(ITimelineState x, Event currentEvent) { x.Refresh(); return(true); }); } } }
void ShowPlayableAssetInspector() { if (!m_SelectionInfo.selectedAssetTypesAreHomogeneous) { return; } if (m_SelectedPlayableAssetsInspector != null) { if (Event.current.type == EventType.Repaint || Event.current.type == EventType.Layout) { foreach (var selectedItem in m_SelectionCache) { CurvesOwnerInspectorHelper.PreparePlayableAsset(selectedItem); } } EditorGUI.BeginChangeCheck(); using (new EditorGUI.DisabledScope(IsLocked())) { m_SelectedPlayableAssetsInspector.OnInspectorGUI(); } if (EditorGUI.EndChangeCheck()) { MarkClipsDirty(); if (TimelineWindow.IsEditingTimelineAsset(m_TimelineAsset) && TimelineWindow.instance.state != null) { var inspectorChangeHandler = m_SelectedPlayableAssetsInspector as IInspectorChangeHandler; if (inspectorChangeHandler != null) { inspectorChangeHandler.OnPlayableAssetChangedInInspector(); } else { TimelineEditor.Refresh(RefreshReason.ContentsModified); } } } } }
public override void OnInspectorGUI() { base.get_serializedObject().Update(); if (!this.m_TimelineWindow) { this.m_TimelineWindow = TimelineWindow.instance; } using (new EditorGUI.DisabledScope(true)) { EditorGUILayout.PropertyField(this.m_AnimClipProperty, AnimationPlayableAssetInspector.Styles.AnimClipText, new GUILayoutOption[0]); } this.ShowRecordableClipRename(); this.ShowAnimationClipWarnings(); EditorGUI.BeginChangeCheck(); if (base.get_targets().Length == 1) { using (new EditorGUI.DisabledScope(!this.ShouldShowOffsets())) { EditorGUI.set_indentLevel(EditorGUI.get_indentLevel() + 1); this.ClipRootMotionOffsetsGUI(); this.ClipOffsetsMatchFieldsGUI(); EditorGUI.set_indentLevel(EditorGUI.get_indentLevel() - 1); } } bool flag = EditorGUI.EndChangeCheck() || this.m_LastPosition != this.m_PositionProperty.get_vector3Value() || this.m_LastRotation != this.m_RotationProperty.get_quaternionValue(); this.m_LastPosition = this.m_PositionProperty.get_vector3Value(); this.m_LastRotation = this.m_RotationProperty.get_quaternionValue(); if (flag) { base.get_serializedObject().ApplyModifiedProperties(); ((AnimationPlayableAsset)base.get_target()).LiveLink(); if (TimelineWindow.instance != null && TimelineWindow.instance.state != null) { TimelineWindow.instance.state.Evaluate(); } } base.get_serializedObject().ApplyModifiedProperties(); }
private void ShowPlayableAssetInspector() { if (this.m_SelectionInfo.selectedAssetTypesAreHomogeneous) { if (this.m_SelectedPlayableAssetsInspector != null) { foreach (ClipInspector.EditorClipSelection current in this.m_SelectionCache) { ClipInspector.PreparePlayableAsset(current); } EditorGUI.BeginChangeCheck(); this.m_SelectedPlayableAssetsInspector.OnInspectorGUI(); if (EditorGUI.EndChangeCheck()) { if (TimelineWindow.IsEditingTimelineAsset(this.m_TimelineAsset) && TimelineWindow.instance.state != null) { TimelineWindow.instance.state.rebuildGraph = true; TimelineWindow.instance.Repaint(); } } } } }
void ShowPlayableAssetInspector() { if (!m_SelectionInfo.selectedAssetTypesAreHomogeneous) { return; } if (m_SelectedPlayableAssetsInspector != null) { foreach (var selectedItem in m_SelectionCache) { CurvesOwnerInspectorHelper.PreparePlayableAsset(selectedItem); } EditorGUI.BeginChangeCheck(); using (new EditorGUI.DisabledScope(IsLocked())) { m_SelectedPlayableAssetsInspector.OnInspectorGUI(); } if (EditorGUI.EndChangeCheck()) { MarkClipsDirty(); if (TimelineWindow.IsEditingTimelineAsset(m_TimelineAsset) && TimelineWindow.instance.state != null) { var basicInspector = m_SelectedPlayableAssetsInspector as BasicAssetInspector; if (basicInspector != null) { basicInspector.ApplyChanges(); } else { TimelineEditor.Refresh(RefreshReason.ContentsModified); } } } } }
public void OnGUI() { if (MagnetEngine.displayDebugLayout) { foreach (MagnetEngine.MagnetInfo current in this.m_Magnets) { TimelineWindow instance = TimelineWindow.instance; Rect rect = new Rect(this.m_State.TimeToPixel(current.time) - MagnetEngine.k_MagnetInfluenceInPixels, instance.timeAreaBounds.get_yMax(), 2f * MagnetEngine.k_MagnetInfluenceInPixels, this.m_State.windowHeight); EditorGUI.DrawRect(rect, new Color(1f, 0f, 0f, 0.4f)); } Vector2 mousePosition = Event.get_current().get_mousePosition(); float num = this.m_State.PixelToTime(mousePosition.x); Vector2 vector = new Vector2(this.m_State.TimeToPixel((double)num), TimelineWindow.instance.timeAreaBounds.get_yMax()); Vector2 vector2 = new Vector2(1f, this.m_State.windowHeight); EditorGUI.DrawRect(new Rect(vector, vector2), Color.get_blue()); } if (this.m_ActiveMagnet != null) { TimelineWindow instance2 = TimelineWindow.instance; Vector2 vector3 = new Vector2(this.m_State.TimeToPixel(this.m_ActiveMagnet.time), instance2.timeAreaBounds.get_yMax()); Vector2 vector4 = new Vector2(1f, this.m_State.windowHeight); EditorGUI.DrawRect(new Rect(vector3, vector4), DirectorStyles.Instance.customSkin.colorSnapLine); } }
void RefreshCurves() { AnimationCurvePreviewCache.ClearCache(); TimelineWindow.RepaintIfEditingTimelineAsset(m_TimelineAsset); Repaint(); }