DrawHeaderGUI() статический приватный Метод

static private DrawHeaderGUI ( Editor editor, string header ) : Rect
editor Editor
header string
Результат UnityEngine.Rect
Пример #1
0
        public static void DrawFoldoutInspector(UnityObject target, ref Editor editor)
        {
            if (editor != null && (editor.target != target || target == null))
            {
                UnityObject.DestroyImmediate(editor);
                editor = null;
            }

            if (editor == null && target != null)
                editor = Editor.CreateEditor(target);

            if (editor == null)
                return;

            const float kSpaceForFoldoutArrow = 10f;
            Rect titleRect = Editor.DrawHeaderGUI(editor, editor.targetTitle, kSpaceForFoldoutArrow);
            int id = GUIUtility.GetControlID(45678, FocusType.Passive);

            Rect renderRect = EditorGUI.GetInspectorTitleBarObjectFoldoutRenderRect(titleRect);
            renderRect.y = titleRect.yMax - 17f; // align with bottom
            bool oldVisible = UnityEditorInternal.InternalEditorUtility.GetIsInspectorExpanded(target);
            bool newVisible = EditorGUI.DoObjectFoldout(oldVisible, titleRect, renderRect, editor.targets, id);

            if (newVisible != oldVisible)
                UnityEditorInternal.InternalEditorUtility.SetIsInspectorExpanded(target, newVisible);

            if (newVisible)
                editor.OnInspectorGUI();
        }
Пример #2
0
        public void ShowEditGUI()
        {
            if (selectedIndex == -1)
            {
                return;
            }

            Brush b = m_BrushList == null ? null : GetActiveBrush();

            // if the brush has been deleted outside unity rebuild the brush list
            if (b == null)
            {
                m_BrushList = null;
                LoadBrushes();
                UpdateSelection(0);
                return;
            }

            if (b.readOnly)
            {
                EditorGUILayout.HelpBox(EditorGUIUtility.TrTextContent("Built-in brush"));
            }

            if (m_BrushEditor)
            {
                Rect titleRect = Editor.DrawHeaderGUI(m_BrushEditor, b.name, 10f);
                int  id        = GUIUtility.GetControlID(78901, FocusType.Passive);

                Rect renderRect = EditorGUI.GetInspectorTitleBarObjectFoldoutRenderRect(titleRect);
                renderRect.y        = titleRect.yMax - 17f; // align with bottom
                m_FoldoutContent[0] = b;
                bool newVisible = EditorGUI.DoObjectFoldout(m_ShowBrushSettings, titleRect, renderRect, m_FoldoutContent, id);

                // Toggle visibility
                if (newVisible != m_ShowBrushSettings)
                {
                    m_ShowBrushSettings = newVisible;
                    InternalEditorUtility.SetIsInspectorExpanded(b, newVisible);
                }
                if (m_ShowBrushSettings)
                {
                    m_BrushEditor.OnInspectorGUI();
                }
            }
        }
Пример #3
0
        protected override void OnHeaderGUI()
        {
            string header = (base.targets.Length != 1) ? (base.targets.Length + " Animation Events") : "Animation Event";

            Editor.DrawHeaderGUI(this, header);
        }
Пример #4
0
 internal static Rect DrawHeaderGUI(Editor editor, string header)
 {
     return(Editor.DrawHeaderGUI(editor, header, 0f));
 }
Пример #5
0
 protected virtual void OnHeaderGUI()
 {
     Editor.DrawHeaderGUI(this, this.targetTitle);
 }