mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-04 13:45:04 +08:00
8e7526e711
* refactor: generalize support for arbitrary parameters as conditions * feat: automatically assign Menu Item parameters * feat: ReactiveComponents respond to MenuItems * feat: AvatarObjectReference tracks both paths and direct object references * feat: set isSaved/isSynced/default values from MenuItem * feat: Object Toggle preview supports menu items and manipulating parent objects * feat: reactive previews respond to menu item default value states * chore: update NDMF dependency
30 lines
962 B
C#
30 lines
962 B
C#
#region
|
|
|
|
using UnityEditor;
|
|
using UnityEditor.UIElements;
|
|
using UnityEngine.UIElements;
|
|
|
|
#endregion
|
|
|
|
namespace nadena.dev.modular_avatar.core.editor.ShapeChanger
|
|
{
|
|
[CustomPropertyDrawer(typeof(ToggledObject))]
|
|
public class ToggledObjectEditor : PropertyDrawer
|
|
{
|
|
private const string Root = "Packages/nadena.dev.modular-avatar/Editor/Inspector/ObjectToggle/";
|
|
private const string UxmlPath = Root + "ToggledObjectEditor.uxml";
|
|
private const string UssPath = Root + "ObjectSwitcherStyles.uss";
|
|
|
|
public override VisualElement CreatePropertyGUI(SerializedProperty property)
|
|
{
|
|
var uxml = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(UxmlPath).CloneTree();
|
|
var uss = AssetDatabase.LoadAssetAtPath<StyleSheet>(UssPath);
|
|
|
|
Localization.UI.Localize(uxml);
|
|
uxml.styleSheets.Add(uss);
|
|
uxml.BindProperty(property);
|
|
|
|
return uxml;
|
|
}
|
|
}
|
|
} |