public bool EditTerrains()
        {
            GameObject[] gameObjects;
            Terrain[]    selectedObjectsOfType = SceneModeUtility.GetSelectedObjectsOfType <Terrain>(out gameObjects);
            if (gameObjects.Length == 0)
            {
                return(false);
            }
            EditorGUILayout.InspectorTitlebar((UnityEngine.Object[])selectedObjectsOfType);
            SerializedObject serializedObject = new SerializedObject((UnityEngine.Object[])gameObjects);

            EditorGUI.BeginDisabledGroup(!SceneModeUtility.StaticFlagField("Lightmap Static", serializedObject.FindProperty("m_StaticEditorFlags"), 1));
            if (GUI.enabled)
            {
                this.ShowTerrainChunks(selectedObjectsOfType);
            }
            SerializedObject so                = new SerializedObject((UnityEngine.Object[])((IEnumerable <Terrain>)selectedObjectsOfType).ToArray <Terrain>());
            float            lightmapScale     = this.LightmapScaleGUI(so, 1f);
            TerrainData      terrainData       = selectedObjectsOfType[0].terrainData;
            float            cachedSurfaceArea = !((UnityEngine.Object)terrainData != (UnityEngine.Object)null) ? 0.0f : terrainData.size.x * terrainData.size.z;

            this.ShowClampedSizeInLightmapGUI(lightmapScale, cachedSurfaceArea);
            LightingWindowObjectTab.LightmapParametersGUI(so.FindProperty("m_LightmapParameters"), LightingWindowObjectTab.s_Styles.LightmapParameters);
            if (GUI.enabled && selectedObjectsOfType.Length == 1 && (UnityEngine.Object)selectedObjectsOfType[0].terrainData != (UnityEngine.Object)null)
            {
                this.ShowBakePerformanceWarning(so, selectedObjectsOfType[0]);
            }
            this.m_ShowBakedLM = EditorGUILayout.Foldout(this.m_ShowBakedLM, LightingWindowObjectTab.s_Styles.Atlas);
            if (this.m_ShowBakedLM)
            {
                this.ShowAtlasGUI(so);
            }
            this.m_ShowRealtimeLM = EditorGUILayout.Foldout(this.m_ShowRealtimeLM, LightingWindowObjectTab.s_Styles.RealtimeLM);
            if (this.m_ShowRealtimeLM)
            {
                this.ShowRealtimeLMGUI(selectedObjectsOfType[0]);
            }
            serializedObject.ApplyModifiedProperties();
            so.ApplyModifiedProperties();
            EditorGUI.EndDisabledGroup();
            GUILayout.Space(10f);
            return(true);
        }
Esempio n. 2
0
        public bool EditTerrains()
        {
            GameObject[] objArray;
            Terrain[]    selectedObjectsOfType = SceneModeUtility.GetSelectedObjectsOfType <Terrain>(out objArray, new Type[0]);
            if (objArray.Length == 0)
            {
                return(false);
            }
            EditorGUILayout.InspectorTitlebar(selectedObjectsOfType);
            SerializedObject obj2 = new SerializedObject(objArray);

            EditorGUI.BeginDisabledGroup(!SceneModeUtility.StaticFlagField("Lightmap Static", obj2.FindProperty("m_StaticEditorFlags"), 1));
            if (GUI.enabled)
            {
                this.ShowTerrainChunks(selectedObjectsOfType);
            }
            SerializedObject so                = new SerializedObject(selectedObjectsOfType.ToArray <Terrain>());
            float            lightmapScale     = this.LightmapScaleGUI(so, 1f);
            TerrainData      terrainData       = selectedObjectsOfType[0].terrainData;
            float            cachedSurfaceArea = (terrainData == null) ? 0f : (terrainData.size.x * terrainData.size.z);

            this.ShowClampedSizeInLightmapGUI(lightmapScale, cachedSurfaceArea);
            LightmapParametersGUI(so.FindProperty("m_LightmapParameters"), s_Styles.LightmapParameters);
            if ((GUI.enabled && (selectedObjectsOfType.Length == 1)) && (selectedObjectsOfType[0].terrainData != null))
            {
                this.ShowBakePerformanceWarning(so, selectedObjectsOfType[0]);
            }
            this.m_ShowBakedLM = EditorGUILayout.Foldout(this.m_ShowBakedLM, s_Styles.Atlas);
            if (this.m_ShowBakedLM)
            {
                this.ShowAtlasGUI(so);
            }
            this.m_ShowRealtimeLM = EditorGUILayout.Foldout(this.m_ShowRealtimeLM, s_Styles.RealtimeLM);
            if (this.m_ShowRealtimeLM)
            {
                this.ShowRealtimeLMGUI(selectedObjectsOfType[0]);
            }
            obj2.ApplyModifiedProperties();
            so.ApplyModifiedProperties();
            EditorGUI.EndDisabledGroup();
            GUILayout.Space(10f);
            return(true);
        }
Esempio n. 3
0
        public void ObjectSettings()
        {
            if (s_Styles == null)
            {
                s_Styles = new Styles();
            }
            Type[] types = new Type[] { typeof(Light), typeof(Renderer), typeof(Terrain) };
            SceneModeUtility.SearchBar(types);
            EditorGUILayout.Space();
            bool flag = false;

            flag |= this.EditRenderers();
            flag |= this.EditLightmapParameters();
            flag |= this.EditLights();
            if (!(flag | this.EditTerrains()))
            {
                GUILayout.Label(s_Styles.EmptySelection, EditorStyles.helpBox, new GUILayoutOption[0]);
            }
        }
        public static bool StaticFlagField(string label, SerializedProperty property, int flag)
        {
            bool flag2 = (property.intValue & flag) != 0;
            bool flag3 = (property.hasMultipleDifferentValuesBitwise & flag) != 0;

            EditorGUI.showMixedValue = flag3;
            EditorGUI.BeginChangeCheck();
            bool flag4 = EditorGUILayout.Toggle(label, flag2, new GUILayoutOption[0]);

            if (!EditorGUI.EndChangeCheck())
            {
                EditorGUI.showMixedValue = false;
                return(flag4 && !flag3);
            }
            if (!SceneModeUtility.SetStaticFlags(property.serializedObject.targetObjects, flag, flag4))
            {
                return(flag2 && !flag3);
            }
            return(flag4);
        }
Esempio n. 5
0
        public static GameObject[] GetObjects(UnityEngine.Object[] gameObjects, bool includeChildren)
        {
            List <GameObject> arr = new List <GameObject>();

            if (!includeChildren)
            {
                foreach (GameObject gameObject in gameObjects)
                {
                    arr.Add(gameObject);
                }
            }
            else
            {
                foreach (GameObject gameObject in gameObjects)
                {
                    SceneModeUtility.GetObjectsRecurse(gameObject.transform, arr);
                }
            }
            return(arr.ToArray());
        }
Esempio n. 6
0
        bool ContributeGISettings()
        {
            bool contributeGI = (m_StaticEditorFlags.intValue & (int)StaticEditorFlags.ContributeGI) != 0;
            bool mixedValue   = (m_StaticEditorFlags.hasMultipleDifferentValuesBitwise & (int)StaticEditorFlags.ContributeGI) != 0;

            EditorGUI.showMixedValue = mixedValue;

            EditorGUI.BeginChangeCheck();
            contributeGI = EditorGUILayout.Toggle(Styles.contributeGI, contributeGI);

            if (EditorGUI.EndChangeCheck())
            {
                SceneModeUtility.SetStaticFlags(m_GameObjectsSerializedObject.targetObjects, (int)StaticEditorFlags.ContributeGI, contributeGI);
                m_GameObjectsSerializedObject.SetIsDifferentCacheDirty();
                m_GameObjectsSerializedObject.Update();
            }

            EditorGUI.showMixedValue = false;

            return(contributeGI && !mixedValue);
        }
Esempio n. 7
0
        private void CameraSelectionGUI()
        {
            SceneModeUtility.SearchBar(typeof(Camera));
            EditorGUILayout.Space();
            Camera camera = (Camera)null;

            if ((bool)((UnityEngine.Object)Selection.activeGameObject))
            {
                camera = Selection.activeGameObject.GetComponent <Camera>();
            }
            if ((bool)((UnityEngine.Object)camera))
            {
                EditorGUILayout.MultiSelectionObjectTitleBar((UnityEngine.Object[]) new Camera[1] {
                    camera
                });
                EditorGUILayout.HelpBox(OcclusionCullingWindow.s_Styles.seeVisualizationInScene.text, MessageType.Info);
            }
            else
            {
                GUILayout.Label(OcclusionCullingWindow.s_Styles.emptyCameraSelection, EditorStyles.helpBox, new GUILayoutOption[0]);
            }
        }
        private static void ObjectSettings(UnityEngine.Object[] components, GameObject[] gos)
        {
            EditorGUILayout.MultiSelectionObjectTitleBar(components);
            SerializedObject serializedObject = new SerializedObject(gos);

            EditorGUI.BeginDisabledGroup(!SceneModeUtility.StaticFlagField("Navigation Static", serializedObject.FindProperty("m_StaticEditorFlags"), 8));
            SceneModeUtility.StaticFlagField("Generate OffMeshLinks", serializedObject.FindProperty("m_StaticEditorFlags"), 32);
            SerializedProperty serializedProperty = serializedObject.FindProperty("m_NavMeshLayer");

            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = serializedProperty.hasMultipleDifferentValues;
            string[] navMeshAreaNames = GameObjectUtility.GetNavMeshAreaNames();
            int      navMeshArea      = GameObjectUtility.GetNavMeshArea(gos[0]);
            int      selectedIndex    = -1;

            for (int i = 0; i < navMeshAreaNames.Length; i++)
            {
                if (GameObjectUtility.GetNavMeshAreaFromName(navMeshAreaNames[i]) == navMeshArea)
                {
                    selectedIndex = i;
                    break;
                }
            }
            int num = EditorGUILayout.Popup("Navigation Area", selectedIndex, navMeshAreaNames, new GUILayoutOption[0]);

            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                int navMeshAreaFromName = GameObjectUtility.GetNavMeshAreaFromName(navMeshAreaNames[num]);
                GameObjectUtility.ShouldIncludeChildren shouldIncludeChildren = GameObjectUtility.DisplayUpdateChildrenDialogIfNeeded(Selection.gameObjects, "Change Navigation Area", "Do you want change the navigation area to " + navMeshAreaNames[num] + " for all the child objects as well?");
                if (shouldIncludeChildren != GameObjectUtility.ShouldIncludeChildren.Cancel)
                {
                    serializedProperty.intValue = navMeshAreaFromName;
                    NavMeshEditorWindow.SetNavMeshArea(navMeshAreaFromName, shouldIncludeChildren == GameObjectUtility.ShouldIncludeChildren.IncludeChildren);
                }
            }
            EditorGUI.EndDisabledGroup();
            serializedObject.ApplyModifiedProperties();
        }
        private static void GetObjectsRecurse(Transform root, List <GameObject> arr)
        {
            arr.Add(root.gameObject);
            IEnumerator enumerator = root.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    Transform root2 = (Transform)enumerator.Current;
                    SceneModeUtility.GetObjectsRecurse(root2, arr);
                }
            }
            finally
            {
                IDisposable disposable;
                if ((disposable = (enumerator as IDisposable)) != null)
                {
                    disposable.Dispose();
                }
            }
        }
Esempio n. 10
0
        public static GameObject[] GetObjects(UnityEngine.Object[] gameObjects, bool includeChildren)
        {
            List <GameObject> list = new List <GameObject>();

            if (!includeChildren)
            {
                for (int i = 0; i < gameObjects.Length; i++)
                {
                    GameObject item = (GameObject)gameObjects[i];
                    list.Add(item);
                }
            }
            else
            {
                for (int j = 0; j < gameObjects.Length; j++)
                {
                    GameObject gameObject = (GameObject)gameObjects[j];
                    SceneModeUtility.GetObjectsRecurse(gameObject.transform, list);
                }
            }
            return(list.ToArray());
        }
Esempio n. 11
0
        private void CameraSelectionGUI()
        {
            Type[] types = new Type[] { typeof(Camera) };
            SceneModeUtility.SearchBar(types);
            EditorGUILayout.Space();
            Camera component = null;

            if (Selection.activeGameObject != null)
            {
                component = Selection.activeGameObject.GetComponent <Camera>();
            }
            if (component != null)
            {
                Camera[] objects = new Camera[] { component };
                EditorGUILayout.MultiSelectionObjectTitleBar(objects);
                EditorGUILayout.HelpBox(s_Styles.seeVisualizationInScene.text, MessageType.Info);
            }
            else
            {
                GUILayout.Label(s_Styles.emptyCameraSelection, EditorStyles.helpBox, new GUILayoutOption[0]);
            }
        }
        void CameraSelectionGUI()
        {
            SceneModeUtility.SearchBar(typeof(Camera));
            EditorGUILayout.Space();

            Camera cam = null;

            if (Selection.activeGameObject)
            {
                cam = Selection.activeGameObject.GetComponent <Camera>();
            }

            // Camera
            if (cam)
            {
                Camera[] cameras = new Camera[] { cam };
                EditorGUILayout.MultiSelectionObjectTitleBar(cameras);
                EditorGUILayout.HelpBox(s_Styles.seeVisualizationInScene.text, MessageType.Info);
            }
            else
            {
                GUILayout.Label(s_Styles.emptyCameraSelection, EditorStyles.helpBox);
            }
        }
        private void DoStaticToggleField(GameObject go)
        {
            var staticRect = GUILayoutUtility.GetRect(Styles.staticContent, EditorStyles.toggle, GUILayout.ExpandWidth(false));

            staticRect.height = Math.Max(EditorGUIUtility.singleLineHeight, staticRect.height);
            EditorGUI.BeginProperty(staticRect, GUIContent.none, m_StaticEditorFlags);
            EditorGUI.BeginChangeCheck();
            var toggleRect = staticRect;

            EditorGUI.showMixedValue |= ShowMixedStaticEditorFlags((StaticEditorFlags)m_StaticEditorFlags.intValue);
            // Ignore mouse clicks that are not with the primary (left) mouse button so those can be grabbed by other things later.
            Event     evt          = Event.current;
            EventType origType     = evt.type;
            bool      nonLeftClick = (evt.type == EventType.MouseDown && evt.button != 0);

            if (nonLeftClick)
            {
                evt.type = EventType.Ignore;
            }
            var toggled = EditorGUI.ToggleLeft(toggleRect, Styles.staticContent, go.isStatic);

            if (nonLeftClick)
            {
                evt.type = origType;
            }
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                SceneModeUtility.SetStaticFlags(targets, ~0, toggled);
                serializedObject.SetIsDifferentCacheDirty();

                // Displaying the dialog to ask the user whether to update children nukes the gui state (case 962453)
                EditorGUIUtility.ExitGUI();
            }
            EditorGUI.EndProperty();
        }
        public static bool SetStaticFlags(UnityEngine.Object[] targetObjects, int changedFlags, bool flagValue)
        {
            bool flag = changedFlags == -1;
            StaticEditorFlags staticEditorFlags = (!flag) ? ((StaticEditorFlags)Enum.Parse(typeof(StaticEditorFlags), changedFlags.ToString())) : ((StaticEditorFlags)0);

            GameObjectUtility.ShouldIncludeChildren shouldIncludeChildren = GameObjectUtility.DisplayUpdateChildrenDialogIfNeeded(targetObjects.OfType <GameObject>(), "Change Static Flags", (!flag) ? string.Concat(new string[]
            {
                "Do you want to ",
                (!flagValue) ? "disable" : "enable",
                " the ",
                ObjectNames.NicifyVariableName(staticEditorFlags.ToString()),
                " flag for all the child objects as well?"
            }) : ("Do you want to " + ((!flagValue) ? "disable" : "enable") + " the static flags for all the child objects as well?"));
            bool result;

            if (shouldIncludeChildren == GameObjectUtility.ShouldIncludeChildren.Cancel)
            {
                GUIUtility.ExitGUI();
                result = false;
            }
            else
            {
                GameObject[] objects = SceneModeUtility.GetObjects(targetObjects, shouldIncludeChildren == GameObjectUtility.ShouldIncludeChildren.IncludeChildren);
                Undo.RecordObjects(objects, "Change Static Flags");
                GameObject[] array = objects;
                for (int i = 0; i < array.Length; i++)
                {
                    GameObject go  = array[i];
                    int        num = (int)GameObjectUtility.GetStaticEditorFlags(go);
                    num = ((!flagValue) ? (num & ~changedFlags) : (num | changedFlags));
                    GameObjectUtility.SetStaticEditorFlags(go, (StaticEditorFlags)num);
                }
                result = true;
            }
            return(result);
        }
        private void DoStaticFlagsDropDown(GameObject go)
        {
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = m_StaticEditorFlags.hasMultipleDifferentValues;
            int  changedFlags;
            bool changedToValue;

            EditorGUI.EnumFlagsField(
                GUILayoutUtility.GetRect(GUIContent.none, s_Styles.staticDropdown, GUILayout.ExpandWidth(false)),
                GUIContent.none,
                GameObjectUtility.GetStaticEditorFlags(go),
                out changedFlags, out changedToValue,
                s_Styles.staticDropdown
                );
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                SceneModeUtility.SetStaticFlags(targets, changedFlags, changedToValue);
                serializedObject.SetIsDifferentCacheDirty();

                // Displaying the dialog to ask the user whether to update children nukes the gui state (case 962453)
                EditorGUIUtility.ExitGUI();
            }
        }
 private Object[] GetObjects(bool includeChildren)
 {
     return(SceneModeUtility.GetObjects(base.targets, includeChildren));
 }
 private UnityEngine.Object[] GetObjects(bool includeChildren) =>
 SceneModeUtility.GetObjects(base.targets, includeChildren);
        internal bool DrawInspector(Rect contentRect)
        {
            if (GameObjectInspector.s_styles == null)
            {
                GameObjectInspector.s_styles = new GameObjectInspector.Styles();
            }
            this.serializedObject.Update();
            GameObject target1 = this.target as GameObject;

            EditorGUIUtility.labelWidth = 52f;
            bool enabled1 = GUI.enabled;

            GUI.enabled = true;
            GUI.Label(new Rect(contentRect.x, contentRect.y, contentRect.width, contentRect.height + 3f), GUIContent.none, EditorStyles.inspectorBig);
            GUI.enabled = enabled1;
            float      width1     = contentRect.width;
            float      y          = contentRect.y;
            GUIContent guiContent = (GUIContent)null;
            PrefabType prefabType = PrefabType.None;

            if (this.m_AllOfSamePrefabType)
            {
                prefabType = PrefabUtility.GetPrefabType((UnityEngine.Object)target1);
                switch (prefabType)
                {
                case PrefabType.None:
                    guiContent = GameObjectInspector.s_styles.goIcon;
                    break;

                case PrefabType.Prefab:
                case PrefabType.PrefabInstance:
                case PrefabType.DisconnectedPrefabInstance:
                    guiContent = GameObjectInspector.s_styles.prefabIcon;
                    break;

                case PrefabType.ModelPrefab:
                case PrefabType.ModelPrefabInstance:
                case PrefabType.DisconnectedModelPrefabInstance:
                    guiContent = GameObjectInspector.s_styles.modelIcon;
                    break;

                case PrefabType.MissingPrefabInstance:
                    guiContent = GameObjectInspector.s_styles.prefabIcon;
                    break;
                }
            }
            else
            {
                guiContent = GameObjectInspector.s_styles.typelessIcon;
            }
            EditorGUI.ObjectIconDropDown(new Rect(3f, 4f + y, 24f, 24f), this.targets, true, guiContent.image as Texture2D, this.m_Icon);
            EditorGUI.BeginDisabledGroup(prefabType == PrefabType.ModelPrefab);
            EditorGUI.PropertyField(new Rect(34f, 4f + y, 14f, 14f), this.m_IsActive, GUIContent.none);
            float num1   = GameObjectInspector.s_styles.staticFieldToggleWidth + 15f;
            float width2 = (float)((double)width1 - 52.0 - (double)num1 - 5.0);

            EditorGUI.DelayedTextField(new Rect(52f, (float)(4.0 + (double)y + 1.0), width2, 16f), this.m_Name, GUIContent.none);
            Rect totalPosition = new Rect(width1 - num1, 4f + y, GameObjectInspector.s_styles.staticFieldToggleWidth, 16f);

            EditorGUI.BeginProperty(totalPosition, GUIContent.none, this.m_StaticEditorFlags);
            EditorGUI.BeginChangeCheck();
            Rect position1 = totalPosition;

            EditorGUI.showMixedValue |= GameObjectInspector.ShowMixedStaticEditorFlags((StaticEditorFlags)this.m_StaticEditorFlags.intValue);
            Event     current = Event.current;
            EventType type    = current.type;
            bool      flag    = current.type == EventType.MouseDown && current.button != 0;

            if (flag)
            {
                current.type = EventType.Ignore;
            }
            bool flagValue = EditorGUI.ToggleLeft(position1, "Static", target1.isStatic);

            if (flag)
            {
                current.type = type;
            }
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                SceneModeUtility.SetStaticFlags(this.targets, -1, flagValue);
                this.serializedObject.SetIsDifferentCacheDirty();
            }
            EditorGUI.EndProperty();
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_StaticEditorFlags.hasMultipleDifferentValues;
            int  changedFlags;
            bool changedToValue;

            EditorGUI.EnumMaskField(new Rect(totalPosition.x + GameObjectInspector.s_styles.staticFieldToggleWidth, totalPosition.y, 10f, 14f), (Enum)GameObjectUtility.GetStaticEditorFlags(target1), GameObjectInspector.s_styles.staticDropdown, out changedFlags, out changedToValue);
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                SceneModeUtility.SetStaticFlags(this.targets, changedFlags, changedToValue);
                this.serializedObject.SetIsDifferentCacheDirty();
            }
            float num2 = 4f;
            float num3 = 4f;

            EditorGUIUtility.fieldWidth = (float)(((double)width1 - (double)num2 - 52.0 - (double)GameObjectInspector.s_styles.layerFieldWidth - (double)num3) / 2.0);
            string tag;

            try
            {
                tag = target1.tag;
            }
            catch (Exception ex)
            {
                tag = "Undefined";
            }
            EditorGUIUtility.labelWidth = GameObjectInspector.s_styles.tagFieldWidth;
            Rect rect = new Rect(52f - EditorGUIUtility.labelWidth, 24f + y, EditorGUIUtility.labelWidth + EditorGUIUtility.fieldWidth, 16f);

            EditorGUI.BeginProperty(rect, GUIContent.none, this.m_Tag);
            EditorGUI.BeginChangeCheck();
            string str = EditorGUI.TagField(rect, EditorGUIUtility.TempContent("Tag"), tag);

            if (EditorGUI.EndChangeCheck())
            {
                this.m_Tag.stringValue = str;
                Undo.RecordObjects(this.targets, "Change Tag of " + this.targetTitle);
                foreach (UnityEngine.Object target2 in this.targets)
                {
                    (target2 as GameObject).tag = str;
                }
            }
            EditorGUI.EndProperty();
            EditorGUIUtility.labelWidth = GameObjectInspector.s_styles.layerFieldWidth;
            rect = new Rect(52f + EditorGUIUtility.fieldWidth + num2, 24f + y, EditorGUIUtility.labelWidth + EditorGUIUtility.fieldWidth, 16f);
            EditorGUI.BeginProperty(rect, GUIContent.none, this.m_Layer);
            EditorGUI.BeginChangeCheck();
            int layer = EditorGUI.LayerField(rect, EditorGUIUtility.TempContent("Layer"), target1.layer);

            if (EditorGUI.EndChangeCheck())
            {
                GameObjectUtility.ShouldIncludeChildren shouldIncludeChildren = GameObjectUtility.DisplayUpdateChildrenDialogIfNeeded(this.targets.OfType <GameObject>(), "Change Layer", "Do you want to set layer to " + InternalEditorUtility.GetLayerName(layer) + " for all child objects as well?");
                if (shouldIncludeChildren != GameObjectUtility.ShouldIncludeChildren.Cancel)
                {
                    this.m_Layer.intValue = layer;
                    this.SetLayer(layer, shouldIncludeChildren == GameObjectUtility.ShouldIncludeChildren.IncludeChildren);
                }
            }
            EditorGUI.EndProperty();
            if (this.m_HasInstance && !EditorApplication.isPlayingOrWillChangePlaymode)
            {
                float      width3    = (float)(((double)width1 - 52.0 - 5.0) / 3.0);
                Rect       position2 = new Rect((float)(52.0 + (double)width3 * 0.0), 44f + y, width3, 15f);
                Rect       position3 = new Rect((float)(52.0 + (double)width3 * 1.0), 44f + y, width3, 15f);
                Rect       position4 = new Rect((float)(52.0 + (double)width3 * 2.0), 44f + y, width3, 15f);
                Rect       position5 = new Rect(52f, 44f + y, width3 * 3f, 15f);
                GUIContent content   = this.targets.Length <= 1 ? GameObjectInspector.s_styles.goTypeLabel[(int)prefabType] : GameObjectInspector.s_styles.goTypeLabelMultiple;
                if (content != null)
                {
                    float x = GUI.skin.label.CalcSize(content).x;
                    if (prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.MissingPrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance)
                    {
                        GUI.contentColor = GUI.skin.GetStyle("CN StatusWarn").normal.textColor;
                        if (prefabType == PrefabType.MissingPrefabInstance)
                        {
                            GUI.Label(new Rect(52f, 44f + y, (float)((double)width1 - 52.0 - 5.0), 18f), content, EditorStyles.whiteLabel);
                        }
                        else
                        {
                            GUI.Label(new Rect((float)(52.0 - (double)x - 5.0), 44f + y, (float)((double)width1 - 52.0 - 5.0), 18f), content, EditorStyles.whiteLabel);
                        }
                        GUI.contentColor = Color.white;
                    }
                    else
                    {
                        GUI.Label(new Rect((float)(52.0 - (double)x - 5.0), 44f + y, x, 18f), content);
                    }
                }
                if (this.targets.Length > 1)
                {
                    GUI.Label(position5, "Instance Management Disabled", GameObjectInspector.s_styles.instanceManagementInfo);
                }
                else
                {
                    if (prefabType != PrefabType.MissingPrefabInstance && GUI.Button(position2, "Select", (GUIStyle)"MiniButtonLeft"))
                    {
                        Selection.activeObject = PrefabUtility.GetPrefabParent(this.target);
                        EditorGUIUtility.PingObject(Selection.activeObject);
                    }
                    if ((prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance) && GUI.Button(position3, "Revert", (GUIStyle)"MiniButtonMid"))
                    {
                        Undo.RegisterFullObjectHierarchyUndo((UnityEngine.Object)target1, "Revert to prefab");
                        PrefabUtility.ReconnectToLastPrefab(target1);
                        PrefabUtility.RevertPrefabInstance(target1);
                        this.CalculatePrefabStatus();
                        Undo.RegisterCreatedObjectUndo((UnityEngine.Object)target1, "Reconnect prefab");
                        GUIUtility.ExitGUI();
                    }
                    bool enabled2 = GUI.enabled;
                    GUI.enabled = GUI.enabled && !AnimationMode.InAnimationMode();
                    if ((prefabType == PrefabType.ModelPrefabInstance || prefabType == PrefabType.PrefabInstance) && GUI.Button(position3, "Revert", (GUIStyle)"MiniButtonMid"))
                    {
                        Undo.RegisterFullObjectHierarchyUndo((UnityEngine.Object)target1, "Revert Prefab Instance");
                        PrefabUtility.RevertPrefabInstance(target1);
                        this.CalculatePrefabStatus();
                        Undo.RegisterCreatedObjectUndo((UnityEngine.Object)target1, "Revert prefab");
                        GUIUtility.ExitGUI();
                    }
                    if (prefabType == PrefabType.PrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance)
                    {
                        GameObject prefabInstanceRoot = PrefabUtility.FindValidUploadPrefabInstanceRoot(target1);
                        GUI.enabled = (UnityEngine.Object)prefabInstanceRoot != (UnityEngine.Object)null && !AnimationMode.InAnimationMode();
                        if (GUI.Button(position4, "Apply", (GUIStyle)"MiniButtonRight"))
                        {
                            UnityEngine.Object prefabParent = PrefabUtility.GetPrefabParent((UnityEngine.Object)prefabInstanceRoot);
                            if (Provider.PromptAndCheckoutIfNeeded(new string[1] {
                                AssetDatabase.GetAssetPath(prefabParent)
                            }, "The version control requires you to check out the prefab before applying changes."))
                            {
                                PrefabUtility.ReplacePrefab(prefabInstanceRoot, prefabParent, ReplacePrefabOptions.ConnectToPrefab);
                                this.CalculatePrefabStatus();
                                EditorSceneManager.MarkSceneDirty(prefabInstanceRoot.scene);
                                GUIUtility.ExitGUI();
                            }
                        }
                    }
                    GUI.enabled = enabled2;
                    if ((prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.ModelPrefabInstance) && GUI.Button(position4, "Open", (GUIStyle)"MiniButtonRight"))
                    {
                        AssetDatabase.OpenAsset(PrefabUtility.GetPrefabParent(this.target));
                        GUIUtility.ExitGUI();
                    }
                }
            }
            EditorGUI.EndDisabledGroup();
            this.serializedObject.ApplyModifiedProperties();
            return(true);
        }
 UnityObject[] GetObjects(bool includeChildren)
 {
     return(SceneModeUtility.GetObjects(targets, includeChildren));
 }
Esempio n. 20
0
        internal bool DrawInspector(Rect contentRect)
        {
            if (GameObjectInspector.s_styles == null)
            {
                GameObjectInspector.s_styles = new GameObjectInspector.Styles();
            }
            base.serializedObject.Update();
            GameObject gameObject = this.target as GameObject;

            EditorGUIUtility.labelWidth = 52f;
            bool enabled = GUI.enabled;

            GUI.enabled = true;
            GUI.Label(new Rect(contentRect.x, contentRect.y, contentRect.width, contentRect.height + 3f), GUIContent.none, EditorStyles.inspectorBig);
            GUI.enabled = enabled;
            float      width      = contentRect.width;
            float      y          = contentRect.y;
            GUIContent gUIContent = null;
            PrefabType prefabType = PrefabType.None;

            if (this.m_AllOfSamePrefabType)
            {
                prefabType = PrefabUtility.GetPrefabType(gameObject);
                switch (prefabType)
                {
                case PrefabType.None:
                    gUIContent = GameObjectInspector.s_styles.goIcon;
                    break;

                case PrefabType.Prefab:
                case PrefabType.PrefabInstance:
                case PrefabType.DisconnectedPrefabInstance:
                    gUIContent = GameObjectInspector.s_styles.prefabIcon;
                    break;

                case PrefabType.ModelPrefab:
                case PrefabType.ModelPrefabInstance:
                case PrefabType.DisconnectedModelPrefabInstance:
                    gUIContent = GameObjectInspector.s_styles.modelIcon;
                    break;

                case PrefabType.MissingPrefabInstance:
                    gUIContent = GameObjectInspector.s_styles.prefabIcon;
                    break;
                }
            }
            else
            {
                gUIContent = GameObjectInspector.s_styles.typelessIcon;
            }
            EditorGUI.ObjectIconDropDown(new Rect(3f, 4f + y, 24f, 24f), base.targets, true, gUIContent.image as Texture2D, this.m_Icon);
            using (new EditorGUI.DisabledScope(prefabType == PrefabType.ModelPrefab))
            {
                EditorGUI.PropertyField(new Rect(34f, 4f + y, 14f, 14f), this.m_IsActive, GUIContent.none);
                float num    = GameObjectInspector.s_styles.staticFieldToggleWidth + 15f;
                float width2 = width - 52f - num - 5f;
                EditorGUI.DelayedTextField(new Rect(52f, 4f + y + 1f, width2, 16f), this.m_Name, GUIContent.none);
                Rect rect = new Rect(width - num, 4f + y, GameObjectInspector.s_styles.staticFieldToggleWidth, 16f);
                EditorGUI.BeginProperty(rect, GUIContent.none, this.m_StaticEditorFlags);
                EditorGUI.BeginChangeCheck();
                Rect position = rect;
                EditorGUI.showMixedValue |= GameObjectInspector.ShowMixedStaticEditorFlags((StaticEditorFlags)this.m_StaticEditorFlags.intValue);
                Event     current = Event.current;
                EventType type    = current.type;
                bool      flag    = current.type == EventType.MouseDown && current.button != 0;
                if (flag)
                {
                    current.type = EventType.Ignore;
                }
                bool flagValue = EditorGUI.ToggleLeft(position, "Static", gameObject.isStatic);
                if (flag)
                {
                    current.type = type;
                }
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    SceneModeUtility.SetStaticFlags(base.targets, -1, flagValue);
                    base.serializedObject.SetIsDifferentCacheDirty();
                }
                EditorGUI.EndProperty();
                EditorGUI.BeginChangeCheck();
                EditorGUI.showMixedValue = this.m_StaticEditorFlags.hasMultipleDifferentValues;
                int  changedFlags;
                bool flagValue2;
                EditorGUI.EnumMaskField(new Rect(rect.x + GameObjectInspector.s_styles.staticFieldToggleWidth, rect.y, 10f, 14f), GameObjectUtility.GetStaticEditorFlags(gameObject), GameObjectInspector.s_styles.staticDropdown, out changedFlags, out flagValue2);
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    SceneModeUtility.SetStaticFlags(base.targets, changedFlags, flagValue2);
                    base.serializedObject.SetIsDifferentCacheDirty();
                }
                float num2 = 4f;
                float num3 = 4f;
                EditorGUIUtility.fieldWidth = (width - num2 - 52f - GameObjectInspector.s_styles.layerFieldWidth - num3) / 2f;
                string tag = null;
                try
                {
                    tag = gameObject.tag;
                }
                catch (Exception)
                {
                    tag = "Undefined";
                }
                EditorGUIUtility.labelWidth = GameObjectInspector.s_styles.tagFieldWidth;
                Rect rect2 = new Rect(52f - EditorGUIUtility.labelWidth, 24f + y, EditorGUIUtility.labelWidth + EditorGUIUtility.fieldWidth, 16f);
                EditorGUI.BeginProperty(rect2, GUIContent.none, this.m_Tag);
                EditorGUI.BeginChangeCheck();
                string text = EditorGUI.TagField(rect2, EditorGUIUtility.TempContent("Tag"), tag);
                if (EditorGUI.EndChangeCheck())
                {
                    this.m_Tag.stringValue = text;
                    Undo.RecordObjects(base.targets, "Change Tag of " + this.targetTitle);
                    UnityEngine.Object[] targets = base.targets;
                    for (int i = 0; i < targets.Length; i++)
                    {
                        UnityEngine.Object @object = targets[i];
                        (@object as GameObject).tag = text;
                    }
                }
                EditorGUI.EndProperty();
                EditorGUIUtility.labelWidth = GameObjectInspector.s_styles.layerFieldWidth;
                rect2 = new Rect(52f + EditorGUIUtility.fieldWidth + num2, 24f + y, EditorGUIUtility.labelWidth + EditorGUIUtility.fieldWidth, 16f);
                EditorGUI.BeginProperty(rect2, GUIContent.none, this.m_Layer);
                EditorGUI.BeginChangeCheck();
                int num4 = EditorGUI.LayerField(rect2, EditorGUIUtility.TempContent("Layer"), gameObject.layer);
                if (EditorGUI.EndChangeCheck())
                {
                    GameObjectUtility.ShouldIncludeChildren shouldIncludeChildren = GameObjectUtility.DisplayUpdateChildrenDialogIfNeeded(base.targets.OfType <GameObject>(), "Change Layer", "Do you want to set layer to " + InternalEditorUtility.GetLayerName(num4) + " for all child objects as well?");
                    if (shouldIncludeChildren != GameObjectUtility.ShouldIncludeChildren.Cancel)
                    {
                        this.m_Layer.intValue = num4;
                        this.SetLayer(num4, shouldIncludeChildren == GameObjectUtility.ShouldIncludeChildren.IncludeChildren);
                    }
                }
                EditorGUI.EndProperty();
                if (this.m_HasInstance)
                {
                    using (new EditorGUI.DisabledScope(EditorApplication.isPlayingOrWillChangePlaymode))
                    {
                        float      num5        = (width - 52f - 5f) / 3f;
                        Rect       position2   = new Rect(52f + num5 * 0f, 44f + y, num5, 15f);
                        Rect       position3   = new Rect(52f + num5 * 1f, 44f + y, num5, 15f);
                        Rect       position4   = new Rect(52f + num5 * 2f, 44f + y, num5, 15f);
                        Rect       position5   = new Rect(52f, 44f + y, num5 * 3f, 15f);
                        GUIContent gUIContent2 = (base.targets.Length <= 1) ? GameObjectInspector.s_styles.goTypeLabel[(int)prefabType] : GameObjectInspector.s_styles.goTypeLabelMultiple;
                        if (gUIContent2 != null)
                        {
                            float x = GUI.skin.label.CalcSize(gUIContent2).x;
                            if (prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.MissingPrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance)
                            {
                                GUI.contentColor = GUI.skin.GetStyle("CN StatusWarn").normal.textColor;
                                if (prefabType == PrefabType.MissingPrefabInstance)
                                {
                                    GUI.Label(new Rect(52f, 44f + y, width - 52f - 5f, 18f), gUIContent2, EditorStyles.whiteLabel);
                                }
                                else
                                {
                                    GUI.Label(new Rect(52f - x - 5f, 44f + y, width - 52f - 5f, 18f), gUIContent2, EditorStyles.whiteLabel);
                                }
                                GUI.contentColor = Color.white;
                            }
                            else
                            {
                                Rect position6 = new Rect(52f - x - 5f, 44f + y, x, 18f);
                                GUI.Label(position6, gUIContent2);
                            }
                        }
                        if (base.targets.Length > 1)
                        {
                            GUI.Label(position5, "Instance Management Disabled", GameObjectInspector.s_styles.instanceManagementInfo);
                        }
                        else
                        {
                            if (prefabType != PrefabType.MissingPrefabInstance && GUI.Button(position2, "Select", "MiniButtonLeft"))
                            {
                                Selection.activeObject = PrefabUtility.GetPrefabParent(this.target);
                                EditorGUIUtility.PingObject(Selection.activeObject);
                            }
                            if ((prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance) && GUI.Button(position3, "Revert", "MiniButtonMid"))
                            {
                                Undo.RegisterFullObjectHierarchyUndo(gameObject, "Revert to prefab");
                                PrefabUtility.ReconnectToLastPrefab(gameObject);
                                PrefabUtility.RevertPrefabInstance(gameObject);
                                this.CalculatePrefabStatus();
                                Undo.RegisterCreatedObjectUndo(gameObject, "Reconnect prefab");
                                GUIUtility.ExitGUI();
                            }
                            using (new EditorGUI.DisabledScope(AnimationMode.InAnimationMode()))
                            {
                                if ((prefabType == PrefabType.ModelPrefabInstance || prefabType == PrefabType.PrefabInstance) && GUI.Button(position3, "Revert", "MiniButtonMid"))
                                {
                                    Undo.RegisterFullObjectHierarchyUndo(gameObject, "Revert Prefab Instance");
                                    PrefabUtility.RevertPrefabInstance(gameObject);
                                    this.CalculatePrefabStatus();
                                    Undo.RegisterCreatedObjectUndo(gameObject, "Revert prefab");
                                    GUIUtility.ExitGUI();
                                }
                                if (prefabType == PrefabType.PrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance)
                                {
                                    GameObject gameObject2 = PrefabUtility.FindValidUploadPrefabInstanceRoot(gameObject);
                                    GUI.enabled = (gameObject2 != null && !AnimationMode.InAnimationMode());
                                    if (GUI.Button(position4, "Apply", "MiniButtonRight"))
                                    {
                                        UnityEngine.Object prefabParent = PrefabUtility.GetPrefabParent(gameObject2);
                                        string             assetPath    = AssetDatabase.GetAssetPath(prefabParent);
                                        bool flag2 = Provider.PromptAndCheckoutIfNeeded(new string[]
                                        {
                                            assetPath
                                        }, "The version control requires you to check out the prefab before applying changes.");
                                        if (flag2)
                                        {
                                            PrefabUtility.ReplacePrefab(gameObject2, prefabParent, ReplacePrefabOptions.ConnectToPrefab);
                                            this.CalculatePrefabStatus();
                                            EditorSceneManager.MarkSceneDirty(gameObject2.scene);
                                            GUIUtility.ExitGUI();
                                        }
                                    }
                                }
                            }
                            if ((prefabType == PrefabType.DisconnectedModelPrefabInstance || prefabType == PrefabType.ModelPrefabInstance) && GUI.Button(position4, "Open", "MiniButtonRight"))
                            {
                                AssetDatabase.OpenAsset(PrefabUtility.GetPrefabParent(this.target));
                                GUIUtility.ExitGUI();
                            }
                        }
                    }
                }
            }
            base.serializedObject.ApplyModifiedProperties();
            return(true);
        }
Esempio n. 21
0
        internal bool DrawInspector(Rect contentRect)
        {
            int  num6;
            bool flag4;

            if (s_styles == null)
            {
                s_styles = new Styles();
            }
            base.serializedObject.Update();
            GameObject target = this.target as GameObject;

            EditorGUIUtility.labelWidth = 52f;
            bool enabled = GUI.enabled;

            GUI.enabled = true;
            GUI.Label(new Rect(contentRect.x, contentRect.y, contentRect.width, contentRect.height + 3f), GUIContent.none, EditorStyles.inspectorBig);
            GUI.enabled = enabled;
            float      width  = contentRect.width;
            float      y      = contentRect.y;
            GUIContent goIcon = null;
            PrefabType none   = PrefabType.None;

            if (this.m_AllOfSamePrefabType)
            {
                none = PrefabUtility.GetPrefabType(target);
                switch (none)
                {
                case PrefabType.None:
                    goIcon = s_styles.goIcon;
                    break;

                case PrefabType.Prefab:
                case PrefabType.PrefabInstance:
                case PrefabType.DisconnectedPrefabInstance:
                    goIcon = s_styles.prefabIcon;
                    break;

                case PrefabType.ModelPrefab:
                case PrefabType.ModelPrefabInstance:
                case PrefabType.DisconnectedModelPrefabInstance:
                    goIcon = s_styles.modelIcon;
                    break;

                case PrefabType.MissingPrefabInstance:
                    goIcon = s_styles.prefabIcon;
                    break;
                }
            }
            else
            {
                goIcon = s_styles.typelessIcon;
            }
            EditorGUI.ObjectIconDropDown(new Rect(3f, 4f + y, 24f, 24f), base.targets, true, goIcon.image as Texture2D, this.m_Icon);
            EditorGUI.BeginDisabledGroup(none == PrefabType.ModelPrefab);
            EditorGUI.PropertyField(new Rect(34f, 4f + y, 14f, 14f), this.m_IsActive, GUIContent.none);
            float num3 = s_styles.staticFieldToggleWidth + 15f;
            float num4 = ((width - 52f) - num3) - 5f;

            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_Name.hasMultipleDifferentValues;
            string name = EditorGUI.DelayedTextField(new Rect(52f, (4f + y) + 1f, num4, 16f), target.name, null, EditorStyles.textField);

            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                foreach (UnityEngine.Object obj3 in base.targets)
                {
                    ObjectNames.SetNameSmart(obj3 as GameObject, name);
                }
            }
            Rect totalPosition = new Rect(width - num3, 4f + y, s_styles.staticFieldToggleWidth, 16f);

            EditorGUI.BeginProperty(totalPosition, GUIContent.none, this.m_StaticEditorFlags);
            EditorGUI.BeginChangeCheck();
            Rect position = totalPosition;

            EditorGUI.showMixedValue |= ShowMixedStaticEditorFlags((StaticEditorFlags)this.m_StaticEditorFlags.intValue);
            Event     current = Event.current;
            EventType type    = current.type;
            bool      flag2   = (current.type == EventType.MouseDown) && (current.button != 0);

            if (flag2)
            {
                current.type = EventType.Ignore;
            }
            bool flagValue = EditorGUI.ToggleLeft(position, "Static", target.isStatic);

            if (flag2)
            {
                current.type = type;
            }
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                SceneModeUtility.SetStaticFlags(base.targets, -1, flagValue);
                base.serializedObject.SetIsDifferentCacheDirty();
            }
            EditorGUI.EndProperty();
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_StaticEditorFlags.hasMultipleDifferentValues;
            EditorGUI.EnumMaskField(new Rect(totalPosition.x + s_styles.staticFieldToggleWidth, totalPosition.y, 10f, 14f), GameObjectUtility.GetStaticEditorFlags(target), s_styles.staticDropdown, out num6, out flag4);
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                SceneModeUtility.SetStaticFlags(base.targets, num6, flag4);
                base.serializedObject.SetIsDifferentCacheDirty();
            }
            float num7 = 4f;
            float num8 = 4f;

            EditorGUIUtility.fieldWidth = ((((width - num7) - 52f) - s_styles.layerFieldWidth) - num8) / 2f;
            string tag = null;

            try
            {
                tag = target.tag;
            }
            catch (Exception)
            {
                tag = "Undefined";
            }
            EditorGUIUtility.labelWidth = s_styles.tagFieldWidth;
            Rect rect3 = new Rect(52f - EditorGUIUtility.labelWidth, 24f + y, EditorGUIUtility.labelWidth + EditorGUIUtility.fieldWidth, 16f);

            EditorGUI.BeginProperty(rect3, GUIContent.none, this.m_Tag);
            EditorGUI.BeginChangeCheck();
            string str3 = EditorGUI.TagField(rect3, EditorGUIUtility.TempContent("Tag"), tag);

            if (EditorGUI.EndChangeCheck())
            {
                this.m_Tag.stringValue = str3;
                Undo.RecordObjects(base.targets, "Change Tag of " + this.targetTitle);
                foreach (UnityEngine.Object obj4 in base.targets)
                {
                    (obj4 as GameObject).tag = str3;
                }
            }
            EditorGUI.EndProperty();
            EditorGUIUtility.labelWidth = s_styles.layerFieldWidth;
            rect3 = new Rect((52f + EditorGUIUtility.fieldWidth) + num7, 24f + y, EditorGUIUtility.labelWidth + EditorGUIUtility.fieldWidth, 16f);
            EditorGUI.BeginProperty(rect3, GUIContent.none, this.m_Layer);
            EditorGUI.BeginChangeCheck();
            int layer = EditorGUI.LayerField(rect3, EditorGUIUtility.TempContent("Layer"), target.layer);

            if (EditorGUI.EndChangeCheck())
            {
                GameObjectUtility.ShouldIncludeChildren children = GameObjectUtility.DisplayUpdateChildrenDialogIfNeeded(base.targets.OfType <GameObject>(), "Change Layer", "Do you want to set layer to " + InternalEditorUtility.GetLayerName(layer) + " for all child objects as well?");
                if (children != GameObjectUtility.ShouldIncludeChildren.Cancel)
                {
                    this.m_Layer.intValue = layer;
                    this.SetLayer(layer, children == GameObjectUtility.ShouldIncludeChildren.IncludeChildren);
                }
            }
            EditorGUI.EndProperty();
            if (!this.m_HasInstance || EditorApplication.isPlayingOrWillChangePlaymode)
            {
                goto Label_0992;
            }
            float      num11    = ((width - 52f) - 5f) / 3f;
            Rect       rect4    = new Rect(52f + (num11 * 0f), 44f + y, num11, 15f);
            Rect       rect5    = new Rect(52f + (num11 * 1f), 44f + y, num11, 15f);
            Rect       rect6    = new Rect(52f + (num11 * 2f), 44f + y, num11, 15f);
            Rect       rect7    = new Rect(52f, 44f + y, num11 * 3f, 15f);
            GUIContent content2 = (base.targets.Length <= 1) ? s_styles.goTypeLabel[(int)none] : s_styles.goTypeLabelMultiple;

            if (content2 != null)
            {
                float x = GUI.skin.label.CalcSize(content2).x;
                switch (none)
                {
                case PrefabType.DisconnectedModelPrefabInstance:
                case PrefabType.MissingPrefabInstance:
                case PrefabType.DisconnectedPrefabInstance:
                    GUI.contentColor = GUI.skin.GetStyle("CN StatusWarn").normal.textColor;
                    if (none == PrefabType.MissingPrefabInstance)
                    {
                        GUI.Label(new Rect(52f, 44f + y, (width - 52f) - 5f, 18f), content2, EditorStyles.whiteLabel);
                    }
                    else
                    {
                        GUI.Label(new Rect((52f - x) - 5f, 44f + y, (width - 52f) - 5f, 18f), content2, EditorStyles.whiteLabel);
                    }
                    GUI.contentColor = Color.white;
                    goto Label_078B;
                }
                Rect rect8 = new Rect((52f - x) - 5f, 44f + y, x, 18f);
                GUI.Label(rect8, content2);
            }
Label_078B:
            if (base.targets.Length > 1)
            {
                GUI.Label(rect7, "Instance Management Disabled", s_styles.instanceManagementInfo);
            }
            else
            {
                if ((none != PrefabType.MissingPrefabInstance) && GUI.Button(rect4, "Select", "MiniButtonLeft"))
                {
                    Selection.activeObject = PrefabUtility.GetPrefabParent(this.target);
                    EditorGUIUtility.PingObject(Selection.activeObject);
                }
                if (((none == PrefabType.DisconnectedModelPrefabInstance) || (none == PrefabType.DisconnectedPrefabInstance)) && GUI.Button(rect5, "Revert", "MiniButtonMid"))
                {
                    Undo.RegisterFullObjectHierarchyUndo(target, "Revert to prefab");
                    PrefabUtility.ReconnectToLastPrefab(target);
                    PrefabUtility.RevertPrefabInstance(target);
                    this.CalculatePrefabStatus();
                    Undo.RegisterCreatedObjectUndo(target, "Reconnect prefab");
                    GUIUtility.ExitGUI();
                }
                bool flag5 = GUI.enabled;
                GUI.enabled = GUI.enabled && !AnimationMode.InAnimationMode();
                if (((none == PrefabType.ModelPrefabInstance) || (none == PrefabType.PrefabInstance)) && GUI.Button(rect5, "Revert", "MiniButtonMid"))
                {
                    Undo.RegisterFullObjectHierarchyUndo(target, "Revert Prefab Instance");
                    PrefabUtility.RevertPrefabInstance(target);
                    this.CalculatePrefabStatus();
                    GUIUtility.ExitGUI();
                }
                if ((none == PrefabType.PrefabInstance) || (none == PrefabType.DisconnectedPrefabInstance))
                {
                    GameObject source = PrefabUtility.FindValidUploadPrefabInstanceRoot(target);
                    GUI.enabled = (source != null) && !AnimationMode.InAnimationMode();
                    if (GUI.Button(rect6, "Apply", "MiniButtonRight"))
                    {
                        UnityEngine.Object prefabParent = PrefabUtility.GetPrefabParent(source);
                        string             assetPath    = AssetDatabase.GetAssetPath(prefabParent);
                        string[]           assets       = new string[] { assetPath };
                        if (Provider.PromptAndCheckoutIfNeeded(assets, "The version control requires you to check out the prefab before applying changes."))
                        {
                            PrefabUtility.ReplacePrefab(source, prefabParent, ReplacePrefabOptions.ConnectToPrefab);
                            this.CalculatePrefabStatus();
                            GUIUtility.ExitGUI();
                        }
                    }
                }
                GUI.enabled = flag5;
                if (((none == PrefabType.DisconnectedModelPrefabInstance) || (none == PrefabType.ModelPrefabInstance)) && GUI.Button(rect6, "Open", "MiniButtonRight"))
                {
                    AssetDatabase.OpenAsset(PrefabUtility.GetPrefabParent(this.target));
                    GUIUtility.ExitGUI();
                }
            }
Label_0992:
            EditorGUI.EndDisabledGroup();
            base.serializedObject.ApplyModifiedProperties();
            return(true);
        }
 private UnityEngine.Object[] GetObjects(bool includeChildren)
 {
     return((UnityEngine.Object[])SceneModeUtility.GetObjects(this.targets, includeChildren));
 }
        public bool EditRenderers()
        {
            GameObject[] array;
            Renderer[]   selectedObjectsOfType = SceneModeUtility.GetSelectedObjectsOfType <Renderer>(out array, new Type[]
            {
                typeof(MeshRenderer),
                typeof(SkinnedMeshRenderer)
            });
            if (array.Length == 0)
            {
                return(false);
            }
            EditorGUILayout.InspectorTitlebar(selectedObjectsOfType);
            SerializedObject serializedObject = new SerializedObject(array);

            using (new EditorGUI.DisabledScope(!SceneModeUtility.StaticFlagField("Lightmap Static", serializedObject.FindProperty("m_StaticEditorFlags"), 1)))
            {
                SerializedObject serializedObject2 = new SerializedObject(selectedObjectsOfType);
                float            num = LightmapVisualization.GetLightmapLODLevelScale(selectedObjectsOfType[0]);
                for (int i = 1; i < selectedObjectsOfType.Length; i++)
                {
                    if (!Mathf.Approximately(num, LightmapVisualization.GetLightmapLODLevelScale(selectedObjectsOfType[i])))
                    {
                        num = 1f;
                    }
                }
                float lightmapScale     = this.LightmapScaleGUI(serializedObject2, num) * LightmapVisualization.GetLightmapLODLevelScale(selectedObjectsOfType[0]);
                float cachedSurfaceArea = (!(selectedObjectsOfType[0] is MeshRenderer)) ? InternalMeshUtil.GetCachedSkinnedMeshSurfaceArea(selectedObjectsOfType[0] as SkinnedMeshRenderer) : InternalMeshUtil.GetCachedMeshSurfaceArea(selectedObjectsOfType[0] as MeshRenderer);
                this.ShowClampedSizeInLightmapGUI(lightmapScale, cachedSurfaceArea);
                EditorGUILayout.PropertyField(serializedObject2.FindProperty("m_ImportantGI"), LightingWindowObjectTab.s_Styles.ImportantGI, new GUILayoutOption[0]);
                LightingWindowObjectTab.LightmapParametersGUI(serializedObject2.FindProperty("m_LightmapParameters"), LightingWindowObjectTab.s_Styles.LightmapParameters, true);
                GUILayout.Space(10f);
                this.RendererUVSettings(serializedObject2);
                GUILayout.Space(10f);
                this.m_ShowBakedLM = EditorGUILayout.Foldout(this.m_ShowBakedLM, LightingWindowObjectTab.s_Styles.Atlas);
                if (this.m_ShowBakedLM)
                {
                    this.ShowAtlasGUI(serializedObject2);
                }
                this.m_ShowRealtimeLM = EditorGUILayout.Foldout(this.m_ShowRealtimeLM, LightingWindowObjectTab.s_Styles.RealtimeLM);
                if (this.m_ShowRealtimeLM)
                {
                    this.ShowRealtimeLMGUI(serializedObject2, selectedObjectsOfType[0]);
                }
                if (LightmapEditorSettings.HasZeroAreaMesh(selectedObjectsOfType[0]))
                {
                    EditorGUILayout.HelpBox(LightingWindowObjectTab.s_Styles.ZeroAreaPackingMesh.text, MessageType.Warning);
                }
                if (LightmapEditorSettings.HasClampedResolution(selectedObjectsOfType[0]))
                {
                    EditorGUILayout.HelpBox(LightingWindowObjectTab.s_Styles.ClampedPackingResolution.text, MessageType.Warning);
                }
                if (!LightingWindowObjectTab.HasNormals(selectedObjectsOfType[0]))
                {
                    EditorGUILayout.HelpBox(LightingWindowObjectTab.s_Styles.NoNormalsNoLightmapping.text, MessageType.Warning);
                }
                serializedObject.ApplyModifiedProperties();
                serializedObject2.ApplyModifiedProperties();
            }
            GUILayout.Space(10f);
            return(true);
        }