A game about forced loneliness, made by TACStudios
at master 53 lines 1.8 kB view raw
1using System; 2using UnityEngine; 3using UnityEngine.UIElements; 4 5namespace UnityEditor.U2D.Animation 6{ 7#if ENABLE_UXML_SERIALIZED_DATA 8 [UxmlElement] 9#endif 10 internal partial class WeightInspectorIMGUIPanel : VisualElement 11 { 12#if ENABLE_UXML_TRAITS 13 public class CustomUXMLFactor : UxmlFactory<WeightInspectorIMGUIPanel, UxmlTraits> {} 14#endif 15 16 private WeightInspector m_WeightInspector = new WeightInspector(); 17 18 public WeightInspector weightInspector 19 { 20 get { return m_WeightInspector; } 21 } 22 23 public event Action weightsChanged = () => {}; 24 25 public WeightInspectorIMGUIPanel() 26 { 27 name = "WeightInspectorIMGUIPanel"; 28 styleSheets.Add(ResourceLoader.Load<StyleSheet>("SkinningModule/WeightInspectorIMGUIPanelStyle.uss")); 29 30 this.Add(new IMGUIContainer(OnGUI)); 31 this.pickingMode = PickingMode.Ignore; 32 this.RegisterCallback<MouseDownEvent>((e) => { e.StopPropagation(); }); 33 this.RegisterCallback<MouseUpEvent>((e) => { e.StopPropagation(); }); 34 } 35 36 protected void OnGUI() 37 { 38 var selectionCount = 0; 39 40 if (weightInspector.selection != null) 41 selectionCount = weightInspector.selection.Count; 42 43 using (new EditorGUI.DisabledGroupScope(m_WeightInspector.spriteMeshData == null || selectionCount == 0)) 44 { 45 GUILayout.Label(new GUIContent(TextContent.vertexWeight, TextContent.vertexWeightToolTip)); 46 EditorGUI.BeginChangeCheck(); 47 m_WeightInspector.OnInspectorGUI(); 48 if (EditorGUI.EndChangeCheck()) 49 weightsChanged(); 50 } 51 } 52 } 53}