Skip to content

Commit 8ae429a

Browse files
committed
Small improvements
1 parent 5b16643 commit 8ae429a

5 files changed

Lines changed: 31 additions & 6 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Toolbox.Editor
2+
{
3+
internal static class ToolboxDefines
4+
{
5+
internal const string defaultListsDefine = "TOOLBOX_FORCE_DEFAULT_LISTS";
6+
}
7+
}

Assets/Editor Toolbox/Editor/ToolboxDefines.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Editor Toolbox/Editor/ToolboxDrawerModule.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ namespace Toolbox.Editor
1010
{
1111
using Toolbox.Editor.Drawers;
1212

13+
//TODO:
14+
//1. dedicated class to initialize and hold drawer-related data
15+
//2. dedicated class used for settings initialization
16+
//3. separate logic for resettings active drawers
17+
1318
internal static class ToolboxDrawerModule
1419
{
1520
[InitializeOnLoadMethod]
@@ -271,14 +276,13 @@ internal static bool HasTargetTypeDrawer(Type type)
271276

272277
internal static void ForceDefaultLists(bool value)
273278
{
274-
const string targetDefine = "TOOLBOX_FORCE_DEFAULT_LISTS";
275279
if (value)
276280
{
277-
ScriptingUtility.AppendDefine(targetDefine);
281+
ScriptingUtility.AppendDefine(ToolboxDefines.defaultListsDefine);
278282
}
279283
else
280284
{
281-
ScriptingUtility.RemoveDefine(targetDefine);
285+
ScriptingUtility.RemoveDefine(ToolboxDefines.defaultListsDefine);
282286
}
283287
}
284288

@@ -426,7 +430,7 @@ internal static ToolboxPropertyHandler GetPropertyHandler(SerializedProperty pro
426430

427431
//TODO:
428432
//NOTE: unfortunately there is no valid, non-reflection way to check if property has a custom native drawer
429-
private readonly static MethodInfo getDrawerTypeForTypeMethod =
433+
private static readonly MethodInfo getDrawerTypeForTypeMethod =
430434
ReflectionUtility.GetEditorMethod("UnityEditor.ScriptAttributeUtility", "GetDrawerTypeForType",
431435
BindingFlags.NonPublic | BindingFlags.Static);
432436
}

Assets/Editor Toolbox/Editor/ToolboxEditorSettings.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ internal class ToolboxEditorSettings : ScriptableObject, IToolboxGeneralSettings
8282
[SerializeField, ReorderableList(ListStyle.Boxed)]
8383
private List<FolderData> customFolders = new List<FolderData>();
8484

85-
[SerializeField]
85+
[SerializeField, Tooltip("Set to false if you don't want to use Toolbox attributes and related features.")]
8686
private bool useToolboxDrawers = true;
87-
[SerializeField, Tooltip("Inspectors will use the default ReorderableList instead of a simple hierarchy.")]
87+
[SerializeField, Tooltip("By default, Inspectors will use the built-in version of the list instead of the Toolbox-based one. " +
88+
"Keep in mind that built-in properties don't support Toolbox attributes. \n\n Changing this property will recompile the code.")]
8889
private bool forceDefaultLists;
8990

9091
[SerializeField, ReorderableList(ListStyle.Boxed), ClassExtends(typeof(ToolboxDecoratorDrawer<>))]

Assets/Editor Toolbox/Editor/ToolboxEditorSettingsEditor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ private void DrawInspectorSettings()
262262
EditorGUI.BeginChangeCheck();
263263
EditorGUILayout.Space();
264264
EditorGUILayout.PropertyField(useToolboxDrawersProperty);
265+
EditorGUI.BeginDisabledGroup(!useToolboxDrawersProperty.boolValue);
265266
EditorGUILayout.PropertyField(forceDefaultListsProperty);
267+
EditorGUI.EndDisabledGroup();
266268
EditorGUILayout.Space();
267269

268270
var validateInspector = false;

0 commit comments

Comments
 (0)