mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-02-16 11:15:02 +08:00
* feat: add Object Toggle component * docs: Object Toggle docs * chore: add missing HelpURL * chore: fix broken test
30 lines
964 B
C#
30 lines
964 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/ObjectSwitcher/";
|
|
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;
|
|
}
|
|
}
|
|
} |