ISpriteMeshView.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using UnityEngine;
  2. namespace UnityEditor.U2D.Animation
  3. {
  4. internal enum SpriteMeshViewMode
  5. {
  6. EditGeometry,
  7. CreateVertex,
  8. CreateEdge,
  9. SplitEdge
  10. }
  11. internal enum MeshEditorAction
  12. {
  13. None,
  14. CreateVertex,
  15. MoveVertex,
  16. CreateEdge,
  17. SplitEdge,
  18. MoveEdge,
  19. SelectVertex,
  20. SelectEdge,
  21. Remove
  22. }
  23. internal interface ISpriteMeshView
  24. {
  25. SpriteMeshViewMode mode { get; set; }
  26. ISelection<int> selection { get; set; }
  27. int defaultControlID { get; set; }
  28. Rect frame { get; set; }
  29. Vector2 mouseWorldPosition { get; }
  30. int hoveredVertex { get; }
  31. int hoveredEdge { get; }
  32. int closestEdge { get; }
  33. void CancelMode();
  34. void BeginLayout();
  35. void EndLayout();
  36. void LayoutVertex(Vector2 position, int index);
  37. void LayoutEdge(Vector2 startPosition, Vector2 endPosition, int index);
  38. bool DoCreateVertex();
  39. bool DoSelectVertex(out bool additive);
  40. bool DoMoveVertex(out Vector2 delta);
  41. bool DoMoveEdge(out Vector2 delta);
  42. bool DoCreateEdge();
  43. bool DoSplitEdge();
  44. bool DoSelectEdge(out bool additive);
  45. bool DoRemove();
  46. void DrawVertex(Vector2 position);
  47. void DrawVertexHovered(Vector2 position);
  48. void DrawVertexSelected(Vector2 position);
  49. void BeginDrawEdges();
  50. void EndDrawEdges();
  51. void DrawEdge(Vector2 startPosition, Vector2 endPosition);
  52. void DrawEdgeHovered(Vector2 startPosition, Vector2 endPosition);
  53. void DrawEdgeSelected(Vector2 startPosition, Vector2 endPosition);
  54. bool IsActionTriggered(MeshEditorAction action);
  55. bool IsActionActive(MeshEditorAction action);
  56. bool IsActionHot(MeshEditorAction action);
  57. Vector2 WorldToScreen(Vector2 position);
  58. void DoRepaint();
  59. bool CanRepaint();
  60. bool CanLayout();
  61. }
  62. }