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(); } } } }
protected override void DrawSettingsBody() { using (UIHelpers.Vertical(UIHelpers.panelWithBackground)) { GUILayout.Space(5); if (GUILayout.Button("Manage Ignores...")) { CleanerIgnoresWindow.Create(); } MaintainerSettings.Cleaner.useTrashBin = EditorGUILayout.ToggleLeft(new GUIContent("Use Trash Bin", "All deleted items will be moved to Trash if selected. Otherwise items will be deleted permanently."), MaintainerSettings.Cleaner.useTrashBin); GUILayout.Space(5); } using (UIHelpers.Vertical(UIHelpers.panelWithBackground, GUILayout.ExpandHeight(true))) { GUILayout.Space(5); GUILayout.Label("<b>Search for:</b>", UIHelpers.richLabel); GUILayout.Space(5); settingsSectionScrollPosition = GUILayout.BeginScrollView(settingsSectionScrollPosition, GUIStyle.none, GUI.skin.verticalScrollbar); using (UIHelpers.Horizontal()) { MaintainerSettings.Cleaner.findEmptyFolders = EditorGUILayout.ToggleLeft(new GUIContent("Empty folders", "Search for all empty folders in project."), MaintainerSettings.Cleaner.findEmptyFolders, GUILayout.Width(100)); GUI.enabled = MaintainerSettings.Cleaner.findEmptyFolders; EditorGUI.BeginChangeCheck(); MaintainerSettings.Cleaner.findEmptyFoldersAutomatically = EditorGUILayout.ToggleLeft(new GUIContent("Autorun on script reload", "Perform empty folders clean automatically on every scripts reload."), MaintainerSettings.Cleaner.findEmptyFoldersAutomatically); if (EditorGUI.EndChangeCheck()) { if (MaintainerSettings.Cleaner.findEmptyFoldersAutomatically) { EditorUtility.DisplayDialog(ProjectCleaner.MODULE_NAME, "In case you're having thousands of folders in your project this may hang Unity for few additional secs on every scripts reload.\n" + ProjectCleaner.DATA_LOSS_WARNING, "Understood"); } } GUI.enabled = true; } MaintainerSettings.Cleaner.findEmptyScenes = EditorGUILayout.ToggleLeft(new GUIContent("Empty scenes", "Search for all empty scenes in project."), MaintainerSettings.Cleaner.findEmptyScenes); GUILayout.EndScrollView(); UIHelpers.Separator(); GUILayout.Space(5); using (UIHelpers.Horizontal()) { if (GUILayout.Button("Check all")) { MaintainerSettings.Cleaner.SwitchAll(true); } if (GUILayout.Button("Uncheck all")) { MaintainerSettings.Cleaner.SwitchAll(false); } } } if (GUILayout.Button(new GUIContent("Reset", "Resets settings to defaults."))) { MaintainerSettings.Cleaner.Reset(); } }