Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

WeightInspectorIMGUIPanel.cs 1.7KB

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