Exemplo n.º 1
0
        public void Show()
        {
            var openResult = CSSelectionTools.OpenSceneForReveal(Path);

            if (openResult.success)
            {
                var instanceId = CSAssetTools.GetMainAssetInstanceID(Path);
                EditorGUIUtility.PingObject(instanceId);
            }

            switch (SettingsKind)
            {
            case SceneSettingsKind.RenderSettings:
            case SceneSettingsKind.LightmapSettings:
                CSMenuTools.ShowSceneSettingsLighting();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        protected override void DrawTabHeader()
        {
            EditorGUILayout.LabelField("Here you may specify which scenes to <color=" +
                                       (filterType == FilterType.Includes ? "#02C85F" : "#FF4040FF") + "><b>" +
                                       (filterType == FilterType.Ignores ? "ignore" : "include") + "</b></color>.\n" +
                                       "You may drag & drop scene files to this window directly from the Project Browser.\n" +
                                       "Print <b>t:Scene</b> in the Project Browser search bar to find all scenes in the project.",
                                       UIHelpers.richWordWrapLabel);

            if (!string.IsNullOrEmpty(headerExtra))
            {
                EditorGUILayout.LabelField(headerExtra, EditorStyles.wordWrappedLabel);
            }

            GUILayout.Space(5);
            EditorGUI.BeginChangeCheck();
            using (new GUILayout.HorizontalScope())
            {
                GUILayout.Space(5);
                ignoreScenesInBuild            = EditorGUILayout.ToggleLeft(new GUIContent("Scenes in build", "Take into account scenes added to the 'Scenes In Build' list at the Build Settings."), ignoreScenesInBuild, GUILayout.Width(110));
                GUI.enabled                    = ignoreScenesInBuild;
                ignoreOnlyEnabledScenesInBuild = EditorGUILayout.ToggleLeft(new GUIContent("Only enabled", "Take into account only enabled 'Scenes In Build'."), ignoreOnlyEnabledScenesInBuild, GUILayout.Width(110));

                if (GUILayout.Button(new GUIContent("Manage build scenes...", "Opens standard Build Settings window.")))
                {
                    CSMenuTools.ShowEditorBuildSettings();
                }

                GUI.enabled = true;
                GUILayout.Space(5);
            }

            if (EditorGUI.EndChangeCheck())
            {
                saveSceneIgnoresCallback(ignoreScenesInBuild, ignoreOnlyEnabledScenesInBuild);
            }
            GUILayout.Space(5);
        }
Exemplo n.º 3
0
        private static void ShowItem(ExactReferencesListItem <T> item)
        {
            var assetPath        = item.data.assetPath;
            var referencingEntry = item.data.entry;

            if (referencingEntry.location == Location.SceneLightingSettings ||
                referencingEntry.location == Location.SceneNavigationSettings)
            {
                var sceneOpenResult = CSSceneTools.OpenSceneWithSavePrompt(assetPath);
                if (!sceneOpenResult.success)
                {
                    Debug.LogError(Maintainer.ConstructError("Can't open scene " + assetPath));
                    MaintainerWindow.ShowNotification("Can't show it properly");
                    return;
                }
            }

            switch (referencingEntry.location)
            {
            case Location.ScriptAsset:
            case Location.ScriptableObjectAsset:

                if (!CSSelectionTools.RevealAndSelectFileAsset(assetPath))
                {
                    MaintainerWindow.ShowNotification("Can't show it properly");
                }

                break;

            case Location.PrefabAssetObject:
                if (!CSSelectionTools.RevealAndSelectSubAsset(assetPath, referencingEntry.transformPath,
                                                              referencingEntry.objectId))
                {
                    MaintainerWindow.ShowNotification("Can't show it properly");
                }

                break;

            case Location.PrefabAssetGameObject:
            case Location.SceneGameObject:

                if (!CSSelectionTools.RevealAndSelectGameObject(assetPath, referencingEntry.transformPath,
                                                                referencingEntry.objectId, referencingEntry.componentId))
                {
                    MaintainerWindow.ShowNotification("Can't show it properly");
                }

                break;

            case Location.SceneLightingSettings:

                if (!CSMenuTools.ShowSceneSettingsLighting())
                {
                    Debug.LogError(Maintainer.ConstructError("Can't open Lighting settings!"));
                    MaintainerWindow.ShowNotification("Can't show it properly");
                }

                break;

            case Location.SceneNavigationSettings:

                if (!CSMenuTools.ShowSceneSettingsNavigation())
                {
                    Debug.LogError(Maintainer.ConstructError("Can't open Navigation settings!"));
                    MaintainerWindow.ShowNotification("Can't show it properly");
                }

                break;

            case Location.NotFound:
            case Location.Invisible:
                break;

            case Location.TileMap:

                if (!CSSelectionTools.RevealAndSelectGameObject(assetPath, referencingEntry.transformPath,
                                                                referencingEntry.objectId, referencingEntry.componentId))
                {
                    MaintainerWindow.ShowNotification("Can't show it properly");
                }

                // TODO: open tile map editor window?

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }