mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-02-07 06:12:47 +08:00
fix: add BeginProperty to AvatarObjectReferenceDrawer
This commit is contained in:
parent
3a94498e45
commit
3ceafb8e1f
@ -8,20 +8,28 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
{
|
{
|
||||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||||
{
|
{
|
||||||
if (CustomGUI(position, property, label)) return;
|
label = EditorGUI.BeginProperty(position, label, property);
|
||||||
|
try
|
||||||
var xButtonSize = EditorStyles.miniButtonRight.CalcSize(new GUIContent("x"));
|
|
||||||
var xButtonRect = new Rect(position.xMax - xButtonSize.x, position.y, xButtonSize.x, position.height);
|
|
||||||
position = new Rect(position.x, position.y, position.width - xButtonSize.x, position.height);
|
|
||||||
|
|
||||||
property = property.FindPropertyRelative(nameof(AvatarObjectReference.referencePath));
|
|
||||||
|
|
||||||
position = EditorGUI.PrefixLabel(position, label);
|
|
||||||
|
|
||||||
using (var scope = new ZeroIndentScope())
|
|
||||||
{
|
{
|
||||||
EditorGUI.LabelField(position,
|
if (CustomGUI(position, property, label)) return;
|
||||||
string.IsNullOrEmpty(property.stringValue) ? "(null)" : property.stringValue);
|
|
||||||
|
var xButtonSize = EditorStyles.miniButtonRight.CalcSize(new GUIContent("x"));
|
||||||
|
var xButtonRect = new Rect(position.xMax - xButtonSize.x, position.y, xButtonSize.x, position.height);
|
||||||
|
position = new Rect(position.x, position.y, position.width - xButtonSize.x, position.height);
|
||||||
|
|
||||||
|
property = property.FindPropertyRelative(nameof(AvatarObjectReference.referencePath));
|
||||||
|
|
||||||
|
position = EditorGUI.PrefixLabel(position, label);
|
||||||
|
|
||||||
|
using (var scope = new ZeroIndentScope())
|
||||||
|
{
|
||||||
|
EditorGUI.LabelField(position,
|
||||||
|
string.IsNullOrEmpty(property.stringValue) ? "(null)" : property.stringValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
EditorGUI.EndProperty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user