WeightPainterToolWrapper.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using UnityEngine;
  2. namespace UnityEditor.U2D.Animation
  3. {
  4. internal class WeightPainterToolWrapper : BaseTool
  5. {
  6. [SerializeField]
  7. private WeightPainterMode m_PaintMode;
  8. [SerializeField]
  9. private WeightPainterTool m_WeightPainterTool;
  10. private string m_Title;
  11. public override IMeshPreviewBehaviour previewBehaviour
  12. {
  13. get { return m_WeightPainterTool.previewBehaviour; }
  14. }
  15. public WeightPainterTool weightPainterTool
  16. {
  17. get { return m_WeightPainterTool; }
  18. set { m_WeightPainterTool = value; }
  19. }
  20. public WeightPainterMode paintMode
  21. {
  22. get { return m_PaintMode; }
  23. set { m_PaintMode = value; }
  24. }
  25. public string title
  26. {
  27. set { m_Title = value; }
  28. }
  29. public override int defaultControlID
  30. {
  31. get { return weightPainterTool.defaultControlID; }
  32. }
  33. protected override void OnActivate()
  34. {
  35. weightPainterTool.Activate();
  36. weightPainterTool.panelTitle = m_Title;
  37. }
  38. protected override void OnDeactivate()
  39. {
  40. weightPainterTool.Deactivate();
  41. }
  42. protected override void OnGUI()
  43. {
  44. weightPainterTool.paintMode = paintMode;
  45. weightPainterTool.DoGUI();
  46. }
  47. }
  48. }