Skip to content

Commit 9c516c0

Browse files
committed
Minor refactor changes
1 parent 889a8ff commit 9c516c0

5 files changed

Lines changed: 12 additions & 10 deletions

File tree

Assets/Editor Toolbox/Editor/Internal/PropertyScope.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
23
using UnityEditor;
34
using UnityEngine;
45

@@ -16,9 +17,7 @@ internal class PropertyScope : IDisposable
1617
public PropertyScope(SerializedProperty property, GUIContent label)
1718
{
1819
this.property = property;
19-
var rowHeight = EditorGUIUtility.singleLineHeight;
20-
var labelRect = EditorGUILayout.GetControlRect(true, rowHeight);
21-
label = EditorGUI.BeginProperty(labelRect, label, property);
20+
ToolboxEditorGui.BeginProperty(property, ref label, out var labelRect);
2221
HandleEvents(labelRect);
2322
TryDrawLabel(labelRect, label);
2423
}
@@ -28,7 +27,7 @@ private void HandleEvents(Rect rect)
2827
{
2928
if (property.isArray)
3029
{
31-
DragAndDropUtility.DoDragAndDropForProperty(rect, property);
30+
DraggingUtility.DoDragAndDropForProperty(rect, property);
3231
}
3332
}
3433

@@ -47,7 +46,7 @@ private void TryDrawLabel(Rect rect, GUIContent label)
4746

4847
public void Dispose()
4948
{
50-
EditorGUI.EndProperty();
49+
ToolboxEditorGui.CloseProperty();
5150
}
5251

5352

Assets/Editor Toolbox/Editor/Internal/ToolboxEditorList.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ protected override int GetCoveredElementIndex(Vector2 mousePosition)
330330
protected override void HandleHeaderEvents(Rect rect)
331331
{
332332
base.HandleHeaderEvents(rect);
333-
DragAndDropUtility.DoDragAndDropForProperty(rect, List);
333+
DraggingUtility.DoDragAndDropForProperty(rect, List);
334334
}
335335

336336

Assets/Editor Toolbox/Editor/Utilities/DragAndDropUtility.cs renamed to Assets/Editor Toolbox/Editor/Utilities/DraggingUtility.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
namespace Toolbox.Editor
88
{
9-
public static class DragAndDropUtility
9+
public static class DraggingUtility
1010
{
11-
static DragAndDropUtility()
11+
static DraggingUtility()
1212
{
1313
validateAssignmentMethod = typeof(EditorGUI)
1414
.GetMethod("ValidateObjectFieldAssignment",

Assets/Editor Toolbox/Editor/Utilities/DragAndDropUtility.cs.meta renamed to Assets/Editor Toolbox/Editor/Utilities/DraggingUtility.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
namespace UnityEngine
1+
using System;
2+
3+
namespace UnityEngine
24
{
35
/// <summary>
46
/// Ignores parent label and default foldout for children-based properties.
57
///
68
/// <para>Supported types: any.</para>
79
/// </summary>
10+
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
811
public class IgnoreParentAttribute : ToolboxSelfPropertyAttribute
912
{ }
1013
}

0 commit comments

Comments
 (0)