using System; using UnityEngine; using UnityEngine.UIElements; namespace UnityEditor.U2D.Animation { internal class GenerateWeightsPanel : VisualElement { public class GenerateWeightsPanelFactory : UxmlFactory {} public class GenerateWeightsPanelUxmlTraits : UxmlTraits {} public event Action onGenerateWeights = () => {}; public event Action onNormalizeWeights = () => {}; public event Action onClearWeights = () => {}; private VisualElement m_AssociateBoneControl; private Toggle m_AssociateBonesToggle; Button m_GenerateWeightsButton; public bool associateBones { get { return m_AssociateBoneControl.visible && m_AssociateBonesToggle.value; } set { m_AssociateBonesToggle.value = value; } } public GenerateWeightsPanel() { styleSheets.Add(ResourceLoader.Load("SkinningModule/GenerateWeightsPanelStyle.uss")); if (EditorGUIUtility.isProSkin) AddToClassList("Dark"); AddToClassList("AssociateBoneEnabled"); RegisterCallback((e) => { e.StopPropagation(); }); RegisterCallback((e) => { e.StopPropagation(); }); } public void BindElements() { m_AssociateBoneControl = this.Q("AssociateBonesControl"); m_GenerateWeightsButton = this.Q