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);
        }
        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);
            }
        }
        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;
            }
        }
예제 #4
0
        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();
                    }
                }
            }
        }