private void DrawRecordButtons(RecordBase record)
        {
            using (UIHelpers.Horizontal(UIHelpers.panelWithBackground))
            {
                AddShowButtonIfPossible(record);

                AssetRecord assetRecord = record as AssetRecord;
                if (assetRecord != null)
                {
                    if (GUILayout.Button(new GUIContent("Reveal", "Reveals item in system default File Manager like Explorer on Windows or Finder on Mac."), UIHelpers.recordButton))
                    {
                        EditorUtility.RevealInFinder(assetRecord.path);
                    }

                    if (GUILayout.Button("More ...", UIHelpers.recordButton))
                    {
                        GenericMenu menu = new GenericMenu();
                        if (!string.IsNullOrEmpty(assetRecord.path))
                        {
                            menu.AddItem(new GUIContent("Ignore/Add path to ignores"), false, () =>
                            {
                                if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Cleaner.pathIgnores, assetRecord.assetDatabasePath))
                                {
                                    MaintainerSettings.Save();
                                    MaintainerWindow.ShowNotification("Ignore added: " + assetRecord.assetDatabasePath);
                                    CleanerIgnoresWindow.Refresh();
                                }
                                else
                                {
                                    MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                                }
                            });

                            DirectoryInfo dir = Directory.GetParent(assetRecord.assetDatabasePath);
                            if (dir.Name != "Assets")
                            {
                                menu.AddItem(new GUIContent("Ignore/Add parent directory to ignores"), false, () =>
                                {
                                    if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Cleaner.pathIgnores, dir.ToString()))
                                    {
                                        MaintainerSettings.Save();
                                        MaintainerWindow.ShowNotification("Ignore added: " + dir);
                                        CleanerIgnoresWindow.Refresh();
                                    }
                                    else
                                    {
                                        MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                                    }
                                });
                            }
                        }
                        menu.ShowAsContext();
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Returns references of all assets at the project, e.g. where each asset is referenced.
        /// </summary>
        /// <param name="showResults">Shows results in %Maintainer window if true.</param>
        /// <returns>Array of ReferencesTreeElement for the TreeView buildup or manual parsing.</returns>
        public static ReferencesTreeElement[] FindAllAssetsReferences(bool showResults = true)
        {
            if (!MaintainerPersonalSettings.References.fullProjectScanWarningShown)
            {
                if (!EditorUtility.DisplayDialog(ModuleName,
                                                 "Full project scan may take significant amount of time if your project is very big.\nAre you sure you wish to make a full project scan?\nThis message shows only before first full scan.",
                                                 "Yes", "Nope"))
                {
                    return(null);
                }

                MaintainerPersonalSettings.References.fullProjectScanWarningShown = true;
                MaintainerSettings.Save();
            }

            return(GetReferences(null, null, showResults));
        }
        protected virtual void DrawSettingsSection()
        {
            using (UIHelpers.Vertical(UIHelpers.panelWithBackground, GUILayout.ExpandHeight(true), GUILayout.Width(300)))
            {
                GUILayout.Space(10);
                GUILayout.Label("<size=14><b>Settings</b></size>", UIHelpers.centeredLabel);
                GUILayout.Space(10);

                EditorGUI.BeginChangeCheck();

                DrawSettingsBody();

                if (EditorGUI.EndChangeCheck())
                {
                    MaintainerSettings.Save();
                }
            }
        }
Exemple #4
0
 private void OnQuit()
 {
     MaintainerSettings.Save();
 }
Exemple #5
0
 private void OnLostFocus()
 {
     MaintainerSettings.Save();
 }
Exemple #6
0
 private void OnDisable()
 {
     MaintainerSettings.Save();
     UnInitOnDisable();
 }
Exemple #7
0
        protected override void DrawRecord(int recordIndex, out bool recordRemoved)
        {
            recordRemoved = false;
            RecordBase record = records[recordIndex];

            UIHelpers.Separator();

            using (UIHelpers.Horizontal())
            {
                DrawSeverityIcon(record);
                if (record.location == RecordLocation.Prefab)
                {
                    UIHelpers.DrawPrefabIcon();
                }
                GUILayout.Label(record.GetHeader(), UIHelpers.richLabel, GUILayout.ExpandWidth(false));
            }

            GUILayout.Label(record.GetBody(), UIHelpers.richLabel);

            using (UIHelpers.Horizontal(UIHelpers.panelWithBackground))
            {
                AddShowButtonIfPossible(record);

                if (GUILayout.Button(new GUIContent("Copy", "Copies record text to the clipboard."), UIHelpers.recordButton))
                {
                    EditorGUIUtility.systemCopyBuffer = record.ToString(true);
                    MaintainerWindow.ShowNotification("Issue record copied to clipboard!");
                }

                if (GUILayout.Button(new GUIContent("Hide", "Hide this issue from the results list.\nUseful when you fixed issue and wish to hide it away."), UIHelpers.recordButton))
                {
                    // ReSharper disable once CoVariantArrayConversion
                    records = CSArrayTools.RemoveAt(records as IssueRecord[], recordIndex);
                    SearchResultsStorage.IssuesSearchResults = (IssueRecord[])records;
                    recordRemoved = true;
                    return;
                }

                //UIHelpers.VerticalSeparator();
                GameObjectIssueRecord objectIssue = record as GameObjectIssueRecord;
                if (objectIssue != null)
                {
                    if (GUILayout.Button("More ...", UIHelpers.recordButton))
                    {
                        GenericMenu menu = new GenericMenu();
                        if (!string.IsNullOrEmpty(objectIssue.path))
                        {
                            menu.AddItem(new GUIContent("Ignore/Add path to ignores"), false, () =>
                            {
                                if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Issues.pathIgnores, objectIssue.path))
                                {
                                    MaintainerSettings.Save();
                                    MaintainerWindow.ShowNotification("Ignore added: " + objectIssue.path);
                                    IssuesIgnoresWindow.Refresh();
                                }
                                else
                                {
                                    MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                                }
                            });

                            DirectoryInfo dir = Directory.GetParent(objectIssue.path);
                            if (dir.Name != "Assets")
                            {
                                menu.AddItem(new GUIContent("Ignore/Add parent directory to ignores"), false, () =>
                                {
                                    if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Issues.pathIgnores, dir.ToString()))
                                    {
                                        MaintainerSettings.Save();
                                        MaintainerWindow.ShowNotification("Ignore added: " + dir);
                                        IssuesIgnoresWindow.Refresh();
                                    }
                                    else
                                    {
                                        MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                                    }
                                });
                            }
                        }

                        if (!string.IsNullOrEmpty(objectIssue.component))
                        {
                            menu.AddItem(new GUIContent("Ignore/Add component to ignores"), false, () =>
                            {
                                if (CSArrayTools.AddIfNotExists(ref MaintainerSettings.Issues.componentIgnores, objectIssue.component))
                                {
                                    MaintainerSettings.Save();
                                    MaintainerWindow.ShowNotification("Ignore added: " + objectIssue.component);
                                    IssuesIgnoresWindow.Refresh();
                                }
                                else
                                {
                                    MaintainerWindow.ShowNotification("Such item already added to the ignores!");
                                }
                            });
                        }
                        menu.ShowAsContext();
                    }
                }
            }
        }
Exemple #8
0
 private void OnTabChange(int newTab)
 {
     MaintainerSettings.Issues.ignoresTabIndex = newTab;
     MaintainerSettings.Save();
 }
Exemple #9
0
 private void OnComponentIgnoresChange(string[] collection)
 {
     MaintainerSettings.Issues.componentIgnores = collection;
     MaintainerSettings.Save();
 }
Exemple #10
0
 private void OnPathIgnoresChange(string[] collection)
 {
     MaintainerSettings.Issues.pathIgnores = collection;
     MaintainerSettings.Save();
 }
Exemple #11
0
 private void OnDisable()
 {
     MaintainerSettings.Save();
     SearchResultsStorage.Save();
 }
Exemple #12
0
 private static void OnPathIgnoresChange(string[] collection)
 {
     MaintainerSettings.Cleaner.pathIgnores = collection;
     MaintainerSettings.Save();
 }