private static void OnPreferencesGUI() { scroll = EditorGUILayout.BeginScrollView(scroll, false, false); EditorGUILayout.Separator(); Enabled.DoGUI(); EditorGUILayout.Separator(); EditorGUILayout.HelpBox("Each item has a tooltip explaining what it does, keep the mouse over it to see.", MessageType.Info); EditorGUILayout.Separator(); using (Enabled.GetEnabledScope()) { using (new GUIIndent("Misc settings")) { using (new GUIIndent("Margins")) { RightMargin.DoGUISlider(-50, 50); LeftMargin.DoGUISlider(-50, 50); Indent.DoGUISlider(0, 35); } Tree.DoGUI(); using (new GUIIndent()) using (SelectOnTree.GetFadeScope(Tree)) SelectOnTree.DoGUI(); Tooltips.DoGUI(); using (new GUIIndent()) using (RelevantTooltipsOnly.GetFadeScope(Tooltips)) RelevantTooltipsOnly.DoGUI(); EnhancedSelection.DoGUI(); Trailing.DoGUI(); ChangeAllSelected.DoGUI(); NumericChildExpand.DoGUI(); using (HideDefaultIcon.GetFadeScope(IsButtonEnabled(new Icons.GameObjectIcon()))) HideDefaultIcon.DoGUI(); GUI.changed = false; using (AllowSelectingLocked.GetFadeScope(IsButtonEnabled(new Icons.Lock()))) AllowSelectingLocked.DoGUI(); using (AllowSelectingLockedSceneView.GetFadeScope(IsButtonEnabled(new Icons.Lock()) && AllowSelectingLocked)) AllowSelectingLockedSceneView.DoGUI(); if (GUI.changed && EditorUtility.DisplayDialog("Relock all objects", "Would you like to relock all objects?\n" + "This is recommended when changing this setting and might take a few seconds on large scenes" + "\nIt's also recommended to do this on all scenes", "Yes", "No")) { Utility.RelockAllObjects(); } HoverTintColor.DoGUI(); } using (new GUIIndent("Row separators")) { LineSize.DoGUISlider(0, 6); using (LineColor.GetFadeScope(LineSize > 0)) LineColor.DoGUI(); OddRowColor.DoGUI(); EvenRowColor.DoGUI(); GUI.changed = false; var rect = EditorGUILayout.GetControlRect(false, rowColorsList.GetHeight()); rect.xMin += EditorGUI.indentLevel * 16f; rowColorsList.DoList(rect); } MiniLabel.DoGUI(); using (new GUIIndent()) { using (SmallerMiniLabel.GetFadeScope(MiniLabel.Value != MiniLabelType.None)) SmallerMiniLabel.DoGUI(); using (HideDefaultTag.GetFadeScope(MiniLabelTagEnabled)) HideDefaultTag.DoGUI(); using (HideDefaultLayer.GetFadeScope(MiniLabelLayerEnabled)) HideDefaultLayer.DoGUI(); using (CentralizeMiniLabelWhenPossible.GetFadeScope((HideDefaultLayer || HideDefaultTag) && (MiniLabel.Value == MiniLabelType.TagAndLayer || MiniLabel.Value == MiniLabelType.LayerAndTag))) CentralizeMiniLabelWhenPossible.DoGUI(); } LeftSideButtonPref.DoGUI(); using (new GUIIndent()) using (LeftmostButton.GetFadeScope(LeftSideButton != IconBase.rightNone)) LeftmostButton.DoGUI(); using (new GUIIndent("Children behaviour on change")) { using (LockAskMode.GetFadeScope(IsButtonEnabled(new Icons.Lock()))) LockAskMode.DoGUI(); using (LayerAskMode.GetFadeScope(IsButtonEnabled(new Icons.Layer()) || MiniLabelLayerEnabled)) LayerAskMode.DoGUI(); using (TagAskMode.GetFadeScope(IsButtonEnabled(new Icons.Tag()) || MiniLabelTagEnabled)) TagAskMode.DoGUI(); using (StaticAskMode.GetFadeScope(IsButtonEnabled(new Icons.Static()))) StaticAskMode.DoGUI(); using (IconAskMode.GetFadeScope(IsButtonEnabled(new Icons.GameObjectIcon()))) IconAskMode.DoGUI(); EditorGUILayout.HelpBox(string.Format("Pressing down {0} while clicking on a button will make it temporary have the opposite children change mode", Utility.CtrlKey), MessageType.Info); } leftIconsList.displayAdd = LeftIconsMenu.GetItemCount() > 0; leftIconsList.DoLayoutList(); rightIconsList.displayAdd = RightIconsMenu.GetItemCount() > 0; rightIconsList.DoLayoutList(); EditorGUILayout.HelpBox("Alt + Click on child expand toggle makes it expand all the grandchildren too", MessageType.Info); if (IsButtonEnabled(new Icons.Memory())) { EditorGUILayout.HelpBox("\"Memory Used\" may create garbage and consequently framerate stutterings, leave it disabled if maximum performance is important for your project", MessageType.Warning); } if (IsButtonEnabled(new Icons.Lock())) { EditorGUILayout.HelpBox("Remember to always unlock your game objects when removing or disabling this extension, as you won't be able to unlock without it and may lose scene data", MessageType.Warning); } GUI.enabled = true; EditorGUILayout.EndScrollView(); using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); EditorGUILayout.LabelField(versionContent, GUILayout.Width(170f)); } using (new EditorGUILayout.HorizontalScope()) { if (GUILayout.Button(resetSettingsContent, GUILayout.Width(120f))) { onResetPreferences(); } if (GUILayout.Button(unlockAllContent, GUILayout.Width(120f))) { Utility.UnlockAllObjects(); } if (GUILayout.Button(mailDeveloperContent, GUILayout.Width(120f))) { Application.OpenURL(GetEmailURL()); } } EditorGUILayout.Separator(); Styles.ReloadTooltips(); EditorApplication.RepaintHierarchyWindow(); } }
private static void OnPreferencesGUI() { try { scroll = EditorGUILayout.BeginScrollView(scroll, false, false); EditorGUILayout.Separator(); GUI.enabled = Enabled.Value = EditorGUILayout.Toggle(Enabled, Enabled); EditorGUILayout.Separator(); Offset.Value = EditorGUILayout.IntField(Offset, Offset); EditorGUILayout.Separator(); Tree.Value = EditorGUILayout.Toggle(Tree, Tree); Warnings.Value = EditorGUILayout.Toggle(Warnings, Warnings); Tooltips.Value = EditorGUILayout.Toggle(Tooltips, Tooltips); Selection.Value = EditorGUILayout.Toggle(Selection, Selection); Trailing.Value = EditorGUILayout.Toggle(Trailing, Trailing); ChangeAllSelected.Value = EditorGUILayout.Toggle(ChangeAllSelected, ChangeAllSelected); AllowSelectingLocked.Value = EditorGUILayout.Toggle(AllowSelectingLocked, AllowSelectingLocked); ReplaceToggle.Value = EditorGUILayout.Toggle(ReplaceToggle, ReplaceToggle); EditorGUILayout.Separator(); Separators.Value = (StripType)EditorGUILayout.EnumPopup(Separators, Separators); LabelType.Value = (MiniLabelType)EditorGUILayout.EnumPopup(LabelType, LabelType); SmallerMiniLabel.Value = EditorGUILayout.Toggle(SmallerMiniLabel, SmallerMiniLabel); LeftSideButton.Value = (DrawType)EditorGUILayout.EnumPopup(LeftSideButton, LeftSideButton); GUI.enabled = Enabled && LeftSideButton.Value != DrawType.None; LeftmostButton.Value = EditorGUILayout.Toggle(LeftmostButton, LeftmostButton); GUI.enabled = Enabled; EditorGUILayout.Separator(); GUI.enabled = Enabled && DrawOrder.Contains(DrawType.Lock); LockAskMode.Value = (ChildrenChangeMode)EditorGUILayout.EnumPopup(LockAskMode, LockAskMode); GUI.enabled = Enabled && (DrawOrder.Contains(DrawType.Layer) || MiniLabelLayer); LayerAskMode.Value = (ChildrenChangeMode)EditorGUILayout.EnumPopup(LayerAskMode, LayerAskMode); GUI.enabled = Enabled && (DrawOrder.Contains(DrawType.Tag) || MiniLabelTag); TagAskMode.Value = (ChildrenChangeMode)EditorGUILayout.EnumPopup(TagAskMode, TagAskMode); GUI.enabled = Enabled && DrawOrder.Contains(DrawType.Static); StaticAskMode.Value = (ChildrenChangeMode)EditorGUILayout.EnumPopup(StaticAskMode, StaticAskMode); GUI.enabled = Enabled; EditorGUILayout.Separator(); DrawOrder = rList.list.Cast <DrawType>().ToList(); rList.displayAdd = Menu.GetItemCount() > 0; rList.DoLayoutList(); GUI.enabled = true; EditorGUILayout.EndScrollView(); if (GUILayout.Button("Use Defaults", GUILayout.Width(120f))) { DeleteSavedValues(); } Styles.ReloadTooltips(); EditorApplication.RepaintHierarchyWindow(); } catch (Exception e) { EditorGUILayout.HelpBox(e.ToString(), MessageType.Error); } }