Пример #1
0
        bool DrawEditorLargeHeader(ref bool wasVisible)
        {
            if (!IsEditorValid())
            {
                return(true);
            }

            bool largeHeader = InspectorWindow.EditorHasLargeHeader(m_EditorIndex, m_Editors);

            // Draw large headers before we do the culling of unsupported editors below,
            // so the large header is always shown even when the editor can't be.
            if (largeHeader)
            {
                String message       = String.Empty;
                bool   IsOpenForEdit = editor.IsOpenForEdit(out message);
                wasVisible = true;

                if (inspectorWindow.editorsWithImportedObjectLabel.Contains(m_EditorIndex))
                {
                    var importedObjectBarRect = GUILayoutUtility.GetRect(16, 20);
                    importedObjectBarRect.height = 21;

                    var headerText = "Imported Object";
                    if (m_Editors.Length > 1)
                    {
                        if (m_Editors[0] is PrefabImporterEditor && m_Editors[1] is GameObjectInspector)
                        {
                            headerText = "Root in Prefab Asset";
                        }
                    }

                    GUILayout.Label(headerText, Styles.importedObjectsHeaderStyle, GUILayout.ExpandWidth(true));
                    GUILayout.Space(-7f); // Ensures no spacing between this header and the next header
                }

                // Header
                using (new EditorGUI.DisabledScope(!IsOpenForEdit)) // Only disable the entire header if the asset is locked by VCS
                {
                    editor.DrawHeader();
                }
            }

            return(largeHeader);
        }
Пример #2
0
        bool DrawEditorLargeHeader(ref bool wasVisible)
        {
            if (!IsEditorValid())
            {
                return(true);
            }

            bool largeHeader = InspectorWindow.EditorHasLargeHeader(m_EditorIndex, m_Editors);

            // Draw large headers before we do the culling of unsupported editors below,
            // so the large header is always shown even when the editor can't be.
            if (largeHeader)
            {
                String message       = String.Empty;
                bool   IsOpenForEdit = editor.IsOpenForEdit(out message);
                wasVisible = true;

                if (inspectorWindow.editorsWithImportedObjectLabel.Contains(m_EditorIndex))
                {
                    var importedObjectBarRect = GUILayoutUtility.GetRect(16, 16);
                    importedObjectBarRect.height = 17;

                    // Clip the label to avoid a black border at the bottom
                    GUI.BeginGroup(importedObjectBarRect);
                    GUI.Label(new Rect(0, 0, importedObjectBarRect.width, importedObjectBarRect.height),
                              "Imported Object", "OL Title");
                    GUI.EndGroup();
                }

                // Header
                using (new EditorGUI.DisabledScope(!IsOpenForEdit)) // Only disable the entire header if the asset is locked by VCS
                {
                    editor.DrawHeader();
                }
            }

            return(largeHeader);
        }