2024-08-04 10:56:07 +08:00
|
|
|
|
#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
|
|
|
|
|
{
|
2024-08-05 10:31:43 +08:00
|
|
|
|
private const string Root = "Packages/nadena.dev.modular-avatar/Editor/Inspector/ObjectToggle/";
|
2024-08-04 10:56:07 +08:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|