private void FloatingOnGUI() { GUILayout.Box("", FloatingBackground, GUILayout.MaxWidth(FloatingWidth), GUILayout.Height(17.0f)); if (Event.current.type == EventType.Repaint) { FloatingBackgroundRect = GUILayoutUtility.GetLastRect(); } bool wasLabelPressed; var newExpandedState = USEditor.FoldoutLabel(FloatingBackgroundRect, IsExpanded, USEditorUtility.GetReadableTimelineContainerName(TimelineContainer), out wasLabelPressed); if (newExpandedState != IsExpanded) { USUndoManager.PropertyChange(this, "Foldout"); IsExpanded = newExpandedState; } base.FloatingOnGUI(0); if (!USRuntimeUtility.HasObserverTimeline(TimelineContainer.transform) && TimelineContainer.AffectedObject == null) { IsExpanded = false; } }
protected override void FloatingOnGUI(int depth) { GUILayout.Box("", FloatingBackground, GUILayout.MaxWidth(FloatingWidth), GUILayout.Height(17.0f)); if (Event.current.type == EventType.Repaint) { var lastRect = GUILayoutUtility.GetLastRect(); lastRect.x += GetXOffsetForDepth(depth); lastRect.width -= GetXOffsetForDepth(depth); if (FloatingBackgroundRect != lastRect) { EditorWindow.Repaint(); FloatingBackgroundRect = lastRect; } } var wasLabelPressed = false; var newExpandedState = USEditor.FoldoutLabel(FloatingBackgroundRect, IsExpanded, AnimationTimeline.name, out wasLabelPressed); if (newExpandedState != IsExpanded) { USUndoManager.PropertyChange(this, "Foldout"); IsExpanded = newExpandedState; EditorWindow.Repaint(); } base.FloatingOnGUI(depth); }
private void ProcessDuplicate(IUSHierarchyItem item) { var timelineContainer = item as USTimelineContainerHierarchyItem; if (timelineContainer != null) { var newTimelineContainer = USEditor.DuplicateTimelineContainer(timelineContainer.TimelineContainer, CurrentSequence); USUndoManager.RegisterCreatedObjectUndo(newTimelineContainer.gameObject, "Duplicate Timeline"); AddNewTimelineContainer(newTimelineContainer); } var timeline = item as IUSTimelineHierarchyItem; if (timeline != null) { USUndoManager.RegisterCompleteObjectUndo(this, "Duplicate Timeline"); USUndoManager.RegisterCompleteObjectUndo(USHierarchy, "Duplicate Timeline"); var newTimeline = USEditor.DuplicateTimeline(timeline.BaseTimeline, timeline.BaseTimeline.TimelineContainer); USUndoManager.RegisterCreatedObjectUndo(newTimeline.gameObject, "Duplicate Timeline"); var parent = USHierarchy.GetParentOf(item) as USTimelineContainerHierarchyItem; USUndoManager.RegisterCompleteObjectUndo(parent, "Duplicate Timeline"); parent.AddTimeline(newTimeline); } }
public override void DoGUI(int depth) { using (new Shared.GUIBeginHorizontal()) { FloatingOnGUI(depth); EventEditor.Duration = EventTimeline.Sequence.Duration; EventEditor.XScale = XScale; EventEditor.XScroll = XScroll; EventEditor.YScroll = YScroll; if (IsExpanded) { EventEditor.OnGUI(); } else { EventEditor.OnCollapsedGUI(); } GUI.Box(FloatingBackgroundRect, "", FloatingBackground); var wasLabelPressed = false; var newExpandedState = USEditor.FoldoutLabel(FloatingBackgroundRect, IsExpanded, EventTimeline.name, out wasLabelPressed); if (newExpandedState != IsExpanded) { USUndoManager.PropertyChange(this, "Foldout"); IsExpanded = newExpandedState; EditorWindow.Repaint(); } base.FloatingOnGUI(depth, MoreRect); } }
protected override void FloatingOnGUI(int depth) { GUILayout.Box("", FloatingBackground, GUILayout.Width(FloatingWidth), GUILayout.Height(17.0f)); if (Event.current.type == EventType.Repaint) { var lastRect = GUILayoutUtility.GetLastRect(); lastRect.x += GetXOffsetForDepth(depth); lastRect.width -= GetXOffsetForDepth(depth); FloatingBackgroundRect = lastRect; } if (Component == null) { var missingRect = FloatingBackgroundRect; missingRect.x += GetXOffsetForDepth(2); GUI.Label(missingRect, "*Missing*"); IsExpanded = false; return; } var wasLabelPressed = false; var displayableContent = new GUIContent(Component.GetType().Name, EditorGUIUtility.ObjectContent(Component, Component.GetType()).image); var newExpandedState = USEditor.FoldoutLabel(FloatingBackgroundRect, IsExpanded, displayableContent, out wasLabelPressed); if (newExpandedState != IsExpanded) { USUndoManager.PropertyChange(this, "Foldout"); IsExpanded = newExpandedState; } }
public override void DoGUI(int depth) { GUILayout.Box("", FloatingBackground, GUILayout.Width(FloatingWidth), GUILayout.Height(17.0f)); if (Event.current.type == EventType.Repaint) { IsSelected = Children.Any(element => ((USPropertyMemberHierarchyItem)element).IsSelected); var lastRect = GUILayoutUtility.GetLastRect(); lastRect.x += GetXOffsetForDepth(depth); lastRect.width -= GetXOffsetForDepth(depth); FloatingBackgroundRect = lastRect; } if (IsSelected) { GUI.Box(new Rect(0, FloatingBackgroundRect.y, FloatingBackgroundRect.width + FloatingBackgroundRect.x, FloatingBackgroundRect.height), ""); } var newExpandedState = IsExpanded; bool wasLabelPressed; newExpandedState = USEditor.FoldoutLabel(FloatingBackgroundRect, IsExpanded, PropertyFieldInfo.ReadableName, out wasLabelPressed); if (newExpandedState != IsExpanded) { USUndoManager.PropertyChange(this, "Foldout"); IsExpanded = newExpandedState; } var addRect = FloatingBackgroundRect; var padding = 1.0f; var addWidth = 22.0f; addRect.x = addRect.x + addRect.width - addWidth - padding; addRect.width = addWidth; if (!HasChildCurves) { if (GUI.Button(addRect, "+")) { AddProperty(); } } else { using (new Shared.GUIChangeColor(Color.red)) { if (GUI.Button(addRect, "-")) { RemoveProperty(); } } } }
private void ProcessDuplicateToSequence(IUSHierarchyItem item, USSequencer sequence) { var affectedObject = default(Transform); var timelineContainer = item as USTimelineContainerHierarchyItem; var timeline = item as IUSTimelineHierarchyItem; if (timelineContainer != null) { affectedObject = timelineContainer.TimelineContainer.AffectedObject; } if (timeline != null) { affectedObject = timeline.BaseTimeline.AffectedObject; } if (timelineContainer && USRuntimeUtility.HasTimelineContainerWithAffectedObject(sequence, affectedObject)) { EditorUtility.DisplayDialog("Cannot continue", string.Format("The sequence {0} already has timelines for the object {1}", sequence.name, affectedObject.name), "Ok"); return; } if (timelineContainer) { var newTimelineContainer = USEditor.DuplicateTimelineContainer(timelineContainer.TimelineContainer, sequence); USUndoManager.RegisterCreatedObjectUndo(newTimelineContainer.gameObject, "Duplicate Timeline"); } if (timeline) { var newTimelineContainer = sequence.GetTimelineContainerFor(timeline.BaseTimeline.AffectedObject); if (newTimelineContainer == null) { newTimelineContainer = sequence.CreateNewTimelineContainer(timeline.BaseTimeline.AffectedObject); USUndoManager.RegisterCreatedObjectUndo(newTimelineContainer.gameObject, "Duplicate Timeline"); } var newTimeline = USEditor.DuplicateTimeline(timeline.BaseTimeline, newTimelineContainer); USUndoManager.RegisterCreatedObjectUndo(newTimeline.gameObject, "Duplicate Timeline"); } }