Пример #1
0
        public override void FindDependencies()
        {
            var files = DependencyFinderEngine.GetFilesThatReference(Target);

            Dependencies = Group(files.Where(f => !(f.Target is SceneAsset)))
                           .OrderBy(t => t.LabelContent.text, StringComparer.Ordinal)
                           .ToArray();
        }
Пример #2
0
        void ShowDependencies(ResultRow[] dependencies)
        {
            var nDeps = dependencies.Count();

            _expandFiles = EditorGUILayout.Foldout(_expandFiles, $"{FindMode.GetContentByFindMode(_findMode)}: [{nDeps}]");

            if (_findMode == FindModeEnum.File)
            {
                if (_data.Target.Scene.IsValid() && !_data.Target.Scene.isLoaded)
                {
                    return;
                }
            }

            if (_expandFiles)
            {
                if (nDeps > 0)
                {
                    foreach (var dependency in dependencies)
                    {
                        if (dependency != null && dependency.SerializedObject != null && dependency.SerializedObject.targetObject != null)
                        {
                            DrawRow(dependency);
                        }
                        else
                        {
                            this.Close();
                        }
                    }
                }
                else
                {
                    EditorGUILayout.LabelField("No file dependencies found.");
                }
            }

            EditorGUILayout.Space();

            var fileDep = _data as FileDependencyFinder;

            if (fileDep == null)
            {
                return;
            }

            if (fileDep.ScenePaths == null)
            {
                fileDep.ScenePaths = DependencyFinderEngine.GetScenesThatContain(_data.Target.Target)
                                     .Select(p => new FileDependencyFinder.Pair {
                    Path = p, NicifiedPath = p.Replace("Assets/", string.Empty)
                }).ToArray();
            }

            var nScenes = fileDep.ScenePaths.Count();

            _expandScenes = EditorGUILayout.Foldout(_expandScenes, $"In Scenes: [{nScenes}]");

            if (!_expandScenes)
            {
                return;
            }
            if (nScenes > 0)
            {
                foreach (var p in fileDep.ScenePaths)
                {
                    using (new EditorGUILayout.HorizontalScope()) {
                        SceneIcon.text = p.NicifiedPath;

                        if (GUILayout.Button(SceneIcon, EditorStyles.label, GUILayout.Height(16f)))
                        {
                            Selection.activeObject = AssetDatabase.LoadAssetAtPath <SceneAsset>(p.Path);
                        }

                        if (!GUILayout.Button("Open scene & search", GUILayout.Width(200f)))
                        {
                            continue;
                        }

                        var sceneToOpen = SceneManager.GetSceneByPath(p.Path);
                        if (sceneToOpen.isLoaded)
                        {
                            GuiManager.OpenSceneWindow(_data.Target.Target, p.Path);
                        }
                        else
                        {
                            var currentScene = EditorSceneManager.GetActiveScene();

                            if (currentScene.isDirty && EditorUtility.DisplayDialog(
                                    $"Unsaved changes",
                                    $"You are going to open and search in scene [{p.Path}]\n" +
                                    $"but you have unsaved shanges at the scene [{currentScene.name}]",
                                    $"Stay at current scene and cancel search", $"Discard changes and search"))
                            {
                                return;
                            }

                            EditorSceneManager.OpenScene(p.Path);
                            GuiManager.OpenSceneWindow(_data.Target.Target, p.Path);
                        }
                    }
                }
            }
            else
            {
                EditorGUILayout.LabelField("No scene dependencies found.");
            }
        }
Пример #3
0
        public override void FindDependencies()
        {
            var dependenciesInScene = DependencyFinderEngine.GetDependenciesInScene(Target);

            Dependencies = Group(dependenciesInScene).ToArray();
        }
Пример #4
0
 public override void FindDependencies()
 {
     Dependencies = Group(DependencyFinderEngine.GetDependenciesInScene(Target)).ToArray();
 }