first commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Animations.Rigging;
|
||||
|
||||
namespace UnityEditor.Animations.Rigging
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(ExpandChildrenAttribute))]
|
||||
class ExpandChildrenDrawer : PropertyDrawer
|
||||
{
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
property.isExpanded = true;
|
||||
return EditorGUI.GetPropertyHeight(property)
|
||||
- EditorGUIUtility.standardVerticalSpacing
|
||||
- EditorGUIUtility.singleLineHeight;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var endProperty = property.GetEndProperty();
|
||||
var childProperty = property.Copy();
|
||||
childProperty.NextVisible(true);
|
||||
while (!SerializedProperty.EqualContents(childProperty, endProperty))
|
||||
{
|
||||
position.height = EditorGUI.GetPropertyHeight(childProperty);
|
||||
OnChildPropertyGUI(position, childProperty);
|
||||
position.y += position.height + EditorGUIUtility.standardVerticalSpacing;
|
||||
childProperty.NextVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnChildPropertyGUI(Rect position, SerializedProperty childProperty)
|
||||
{
|
||||
EditorGUI.PropertyField(position, childProperty, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user