55
66namespace Toolbox . Editor
77{
8+ /// <summary>
9+ /// Default drawer responsible for drawing <see cref="UnityEditor.Editor"/>s.
10+ /// This helper class that can be used across many Toolbox-based editors that cannot share the same base class.
11+ /// </summary>
812 public class ToolboxEditorDrawer : IToolboxEditorDrawer
913 {
1014 private readonly HashSet < string > propertiesToIgnore = new HashSet < string > ( ) ;
11- //TODO:
1215 private readonly Action < SerializedProperty > toolboxDrawingAction ;
1316 private readonly Action < SerializedProperty > defaultDrawingAction ;
1417
15- public ToolboxEditorDrawer ( )
18+ public ToolboxEditorDrawer ( ) : this ( ToolboxEditorGui . DrawToolboxProperty , ToolboxEditorGui . DrawNativeProperty )
19+ { }
20+
21+ public ToolboxEditorDrawer ( Action < SerializedProperty > toolboxDrawingAction , Action < SerializedProperty > defaultDrawingAction )
1622 {
17- toolboxDrawingAction = ToolboxEditorGui . DrawToolboxProperty ;
18- defaultDrawingAction = ToolboxEditorGui . DrawNativeProperty ;
23+ this . toolboxDrawingAction = toolboxDrawingAction ;
24+ this . defaultDrawingAction = defaultDrawingAction ;
1925 }
2026
2127 private void DrawProperty ( SerializedProperty property , Action < SerializedProperty > drawingAction )
@@ -67,13 +73,13 @@ public void DrawEditor(SerializedObject serializedObject, Action<SerializedPrope
6773 /// <inheritdoc />
6874 public void DrawToolboxEditor ( SerializedObject serializedObject )
6975 {
70- DrawEditor ( serializedObject , ToolboxEditorGui . DrawToolboxProperty ) ;
76+ DrawEditor ( serializedObject , toolboxDrawingAction ) ;
7177 }
7278
7379 /// <inheritdoc />
7480 public void DrawDefaultEditor ( SerializedObject serializedObject )
7581 {
76- DrawEditor ( serializedObject , ToolboxEditorGui . DrawNativeProperty ) ;
82+ DrawEditor ( serializedObject , defaultDrawingAction ) ;
7783 }
7884
7985 /// <inheritdoc />
@@ -88,6 +94,12 @@ public void IgnoreProperty(string propertyPath)
8894 propertiesToIgnore . Add ( propertyPath ) ;
8995 }
9096
97+ /// <inheritdoc />
98+ public bool IsPropertyIgnored ( SerializedProperty property )
99+ {
100+ return IsPropertyIgnored ( property . propertyPath ) ;
101+ }
102+
91103 /// <inheritdoc />
92104 public bool IsPropertyIgnored ( string propertyPath )
93105 {
0 commit comments