SkeletonView.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. using UnityEngine;
  2. using System;
  3. namespace UnityEditor.U2D.Animation
  4. {
  5. internal class SkeletonView : ISkeletonView
  6. {
  7. private const float kPickingRadius = 5f;
  8. internal const string kDeleteCommandName = "Delete";
  9. internal const string kSoftDeleteCommandName = "SoftDelete";
  10. private static readonly int kBodyHashCode = "Body".GetHashCode();
  11. private static readonly int kJointHashCode = "Joint".GetHashCode();
  12. private static readonly int kTailHashCode = "Tail".GetHashCode();
  13. private static readonly int kCreateBoneHashCode = "CreateBone".GetHashCode();
  14. public int InvalidID { get; set; }
  15. public SkeletonMode mode { get; set; }
  16. public int defaultControlID { get; set; }
  17. public int hoveredBoneID { get { return m_HoveredBoneID; } }
  18. public int hoveredJointID { get { return m_HoveredJointID; } }
  19. public int hoveredBodyID { get { return m_HoveredBodyID; } }
  20. public int hoveredTailID { get { return m_HoveredTailID; } }
  21. public int hotBoneID { get { return m_HotBoneID; } }
  22. private IGUIWrapper m_GUIWrapper;
  23. private int m_RotateControlID = -1;
  24. private int m_MoveControlID = -1;
  25. private int m_FreeMoveControlID = -1;
  26. private int m_MoveJointControlID = -1;
  27. private int m_MoveEndPositionControlID = -1;
  28. private int m_ChangeLengthControlID = -1;
  29. private int m_CreateBoneControlID = -1;
  30. private int m_HoveredBoneID = 0;
  31. private int m_PrevHoveredBoneID = 0;
  32. private int m_HoveredBodyID = 0;
  33. private int m_HoveredJointID = 0;
  34. private int m_HoveredTailID = 0;
  35. private int m_HotBoneID = 0;
  36. private int m_HoveredBodyControlID = -1;
  37. private int m_HoveredJointControlID = -1;
  38. private int m_HoveredTailControlID = -1;
  39. private float m_NearestDistance;
  40. private float m_NearestBodyDistance;
  41. private float m_NearestJointDistance;
  42. private float m_NearestTailDistance;
  43. private int m_NearestBodyId = 0;
  44. private int m_NearestJointId = 0;
  45. private int m_NearestTailId = 0;
  46. private SliderData m_HoveredSliderData = SliderData.zero;
  47. private SliderData m_HotSliderData = SliderData.zero;
  48. public SkeletonView(IGUIWrapper gw)
  49. {
  50. m_GUIWrapper = gw;
  51. }
  52. public void BeginLayout()
  53. {
  54. m_HoveredBodyControlID = m_GUIWrapper.GetControlID(kBodyHashCode, FocusType.Passive);
  55. m_HoveredJointControlID = m_GUIWrapper.GetControlID(kJointHashCode, FocusType.Passive);
  56. m_HoveredTailControlID = m_GUIWrapper.GetControlID(kTailHashCode, FocusType.Passive);
  57. m_CreateBoneControlID = m_GUIWrapper.GetControlID(kCreateBoneHashCode, FocusType.Passive);
  58. if (m_GUIWrapper.eventType == EventType.Layout)
  59. {
  60. m_PrevHoveredBoneID = m_HoveredBoneID;
  61. m_NearestDistance = float.MaxValue;
  62. m_NearestBodyDistance = float.MaxValue;
  63. m_NearestJointDistance = float.MaxValue;
  64. m_NearestTailDistance = float.MaxValue;
  65. m_NearestBodyId = InvalidID;
  66. m_NearestJointId = InvalidID;
  67. m_NearestTailId = InvalidID;
  68. m_HoveredBoneID = InvalidID;
  69. m_HoveredBodyID = InvalidID;
  70. m_HoveredJointID = InvalidID;
  71. m_HoveredTailID = InvalidID;
  72. m_HoveredSliderData = SliderData.zero;
  73. if (m_GUIWrapper.IsControlHot(0))
  74. {
  75. m_RotateControlID = -1;
  76. m_MoveControlID = -1;
  77. m_FreeMoveControlID = -1;
  78. m_MoveJointControlID = -1;
  79. m_MoveEndPositionControlID = -1;
  80. m_ChangeLengthControlID = -1;
  81. m_HotBoneID = InvalidID;
  82. }
  83. }
  84. }
  85. public void EndLayout()
  86. {
  87. m_GUIWrapper.LayoutControl(m_HoveredBodyControlID, m_NearestBodyDistance * 0.25f);
  88. m_GUIWrapper.LayoutControl(m_HoveredJointControlID, m_NearestJointDistance);
  89. m_GUIWrapper.LayoutControl(m_HoveredTailControlID, m_NearestTailDistance);
  90. if (m_GUIWrapper.IsControlNearest(m_HoveredBodyControlID))
  91. {
  92. m_HoveredBoneID = m_NearestBodyId;
  93. m_HoveredBodyID = m_NearestBodyId;
  94. }
  95. if (m_GUIWrapper.IsControlNearest(m_HoveredJointControlID))
  96. {
  97. m_HoveredBoneID = m_NearestJointId;
  98. m_HoveredJointID = m_NearestJointId;
  99. }
  100. if (m_GUIWrapper.IsControlNearest(m_HoveredTailControlID))
  101. {
  102. m_HoveredBoneID = m_NearestTailId;
  103. m_HoveredTailID = m_NearestTailId;
  104. }
  105. if ((m_GUIWrapper.eventType == EventType.Layout && m_PrevHoveredBoneID != m_HoveredBoneID) || m_GUIWrapper.eventType == EventType.MouseMove)
  106. m_GUIWrapper.Repaint();
  107. }
  108. public bool CanLayout()
  109. {
  110. return m_GUIWrapper.eventType == EventType.Layout;
  111. }
  112. public void LayoutBone(int id, Vector3 position, Vector3 endPosition, Vector3 forward, Vector3 up, Vector3 right, bool isChainEnd)
  113. {
  114. if (mode == SkeletonMode.Disabled)
  115. return;
  116. var sliderData = new SliderData()
  117. {
  118. position = GetMouseWorldPosition(forward, position),
  119. forward = forward,
  120. up = up,
  121. right = right
  122. };
  123. {
  124. var distance = m_GUIWrapper.DistanceToSegmentClamp(position, endPosition);
  125. if (distance <= m_NearestDistance)
  126. {
  127. m_NearestDistance = distance;
  128. m_NearestBodyDistance = distance;
  129. m_NearestBodyId = id;
  130. m_HoveredSliderData = sliderData;
  131. }
  132. }
  133. {
  134. var distance = m_GUIWrapper.DistanceToCircle(position, GetBoneRadiusForPicking(position) * 2f);
  135. if (distance <= m_NearestDistance)
  136. {
  137. m_NearestDistance = distance;
  138. m_NearestJointDistance = distance;
  139. m_NearestJointId = id;
  140. m_HoveredSliderData = sliderData;
  141. }
  142. }
  143. if (isChainEnd &&
  144. (IsCapable(SkeletonAction.ChangeLength) ||
  145. IsCapable(SkeletonAction.MoveEndPosition) ||
  146. IsCapable(SkeletonAction.CreateBone)))
  147. {
  148. var distance = m_GUIWrapper.DistanceToCircle(endPosition, GetBoneRadiusForPicking(endPosition));
  149. if (distance <= m_NearestDistance)
  150. {
  151. m_NearestDistance = distance;
  152. m_NearestTailDistance = distance;
  153. m_NearestTailId = id;
  154. m_HoveredSliderData = sliderData;
  155. }
  156. }
  157. }
  158. public Vector3 GetMouseWorldPosition(Vector3 planeNormal, Vector3 planePosition)
  159. {
  160. return m_GUIWrapper.GUIToWorld(m_GUIWrapper.mousePosition, planeNormal, planePosition);
  161. }
  162. private float GetBoneRadiusForPicking(Vector3 position)
  163. {
  164. if (m_GUIWrapper.HasCurrentCamera())
  165. return 0.1f * m_GUIWrapper.GetHandleSize(position);
  166. return kPickingRadius;
  167. }
  168. public bool DoSelectBone(out int id, out bool additive)
  169. {
  170. id = 0;
  171. additive = false;
  172. if (IsActionTriggering(SkeletonAction.Select))
  173. {
  174. id = m_HoveredBoneID;
  175. additive = m_GUIWrapper.isActionKeyDown;
  176. if (mode == SkeletonMode.Selection)
  177. {
  178. m_GUIWrapper.UseCurrentEvent();
  179. m_GUIWrapper.SetGuiChanged(true);
  180. }
  181. return true;
  182. }
  183. return false;
  184. }
  185. public bool DoRotateBone(Vector3 pivot, Vector3 normal, out float deltaAngle)
  186. {
  187. deltaAngle = 0f;
  188. Vector3 oldPosition = m_HotSliderData.position;
  189. Vector3 newPosition;
  190. if (DoSliderAction(SkeletonAction.RotateBone, m_HoveredBodyControlID, ref m_RotateControlID, out newPosition))
  191. {
  192. deltaAngle = Vector3.SignedAngle(oldPosition - pivot, (Vector3)newPosition - pivot, normal);
  193. return true;
  194. }
  195. return false;
  196. }
  197. public bool DoMoveBone(out Vector3 deltaPosition)
  198. {
  199. deltaPosition = Vector3.zero;
  200. Vector3 oldPosition = m_HotSliderData.position;
  201. Vector3 newPosition;
  202. if (DoSliderAction(SkeletonAction.MoveBone, m_HoveredJointControlID, ref m_MoveControlID, out newPosition))
  203. {
  204. deltaPosition = newPosition - oldPosition;
  205. return true;
  206. }
  207. return false;
  208. }
  209. public bool DoFreeMoveBone(out Vector3 deltaPosition)
  210. {
  211. deltaPosition = Vector3.zero;
  212. Vector3 oldPosition = m_HotSliderData.position;
  213. Vector3 newPosition;
  214. if (DoSliderAction(SkeletonAction.FreeMoveBone, m_HoveredBodyControlID, ref m_FreeMoveControlID, out newPosition))
  215. {
  216. deltaPosition = newPosition - oldPosition;
  217. return true;
  218. }
  219. return false;
  220. }
  221. public bool DoMoveJoint(out Vector3 deltaPosition)
  222. {
  223. deltaPosition = Vector3.zero;
  224. Vector3 oldPosition = m_HotSliderData.position;
  225. Vector3 newPosition;
  226. if (DoSliderAction(SkeletonAction.MoveJoint, m_HoveredJointControlID, ref m_MoveJointControlID, out newPosition))
  227. {
  228. deltaPosition = newPosition - oldPosition;
  229. return true;
  230. }
  231. return false;
  232. }
  233. public bool DoMoveEndPosition(out Vector3 endPosition)
  234. {
  235. return DoSliderAction(SkeletonAction.MoveEndPosition, m_HoveredTailControlID, ref m_MoveEndPositionControlID, out endPosition);
  236. }
  237. public bool DoChangeLength(out Vector3 endPosition)
  238. {
  239. return DoSliderAction(SkeletonAction.ChangeLength, m_HoveredTailControlID, ref m_ChangeLengthControlID, out endPosition);
  240. }
  241. private bool DoSliderAction(SkeletonAction action, int controlID, ref int actionControlID, out Vector3 newPosition)
  242. {
  243. newPosition = m_HoveredSliderData.position;
  244. if (IsActionTriggering(action))
  245. {
  246. actionControlID = controlID;
  247. m_HotSliderData = m_HoveredSliderData;
  248. m_HotBoneID = hoveredBoneID;
  249. }
  250. if (m_GUIWrapper.DoSlider(actionControlID, m_HotSliderData, out newPosition))
  251. {
  252. m_HotSliderData.position = newPosition;
  253. return true;
  254. }
  255. return false;
  256. }
  257. public bool DoCreateBoneStart(out Vector3 position)
  258. {
  259. position = GetMouseWorldPosition(m_HoveredSliderData.forward, m_HoveredSliderData.position);
  260. if (CanCreateBone())
  261. m_GUIWrapper.LayoutControl(m_CreateBoneControlID, 0f);
  262. if (IsActionActive(SkeletonAction.CreateBone))
  263. ConsumeMouseMoveEvents();
  264. if (IsActionTriggering(SkeletonAction.CreateBone))
  265. {
  266. m_HotBoneID = hoveredBoneID;
  267. m_GUIWrapper.SetMultiStepControlHot(m_CreateBoneControlID);
  268. m_GUIWrapper.UseCurrentEvent();
  269. return true;
  270. }
  271. return false;
  272. }
  273. public bool CanCreateBone()
  274. {
  275. return mode == SkeletonMode.CreateBone && (m_GUIWrapper.IsControlNearest(defaultControlID) || m_GUIWrapper.IsControlNearest(m_HoveredTailControlID));
  276. }
  277. public bool DoCreateBone(out Vector3 position)
  278. {
  279. position = GetMouseWorldPosition(m_HoveredSliderData.forward, m_HoveredSliderData.position);
  280. if (IsActionHot(SkeletonAction.CreateBone))
  281. ConsumeMouseMoveEvents();
  282. if (IsActionFinishing(SkeletonAction.CreateBone))
  283. {
  284. m_GUIWrapper.UseCurrentEvent();
  285. m_GUIWrapper.SetGuiChanged(true);
  286. return true;
  287. }
  288. return false;
  289. }
  290. public bool DoSplitBone(out int id, out Vector3 position)
  291. {
  292. id = m_HoveredBodyID;
  293. position = GetMouseWorldPosition(m_HoveredSliderData.forward, m_HoveredSliderData.position);
  294. if (IsActionActive(SkeletonAction.SplitBone))
  295. ConsumeMouseMoveEvents();
  296. if (IsActionTriggering(SkeletonAction.SplitBone))
  297. {
  298. m_GUIWrapper.UseCurrentEvent();
  299. m_GUIWrapper.SetGuiChanged(true);
  300. return true;
  301. }
  302. return false;
  303. }
  304. public bool DoRemoveBone()
  305. {
  306. if (IsActionTriggering(SkeletonAction.Remove))
  307. {
  308. m_GUIWrapper.UseCurrentEvent();
  309. m_GUIWrapper.SetGuiChanged(true);
  310. return true;
  311. }
  312. return false;
  313. }
  314. public bool DoCancelMultistepAction(bool force)
  315. {
  316. if (force)
  317. {
  318. m_GUIWrapper.SetMultiStepControlHot(0);
  319. return true;
  320. }
  321. if ((!m_GUIWrapper.IsMultiStepControlHot(0) && (m_GUIWrapper.IsMouseDown(1) || m_GUIWrapper.IsKeyDown(KeyCode.Escape))))
  322. {
  323. m_GUIWrapper.SetMultiStepControlHot(0);
  324. m_GUIWrapper.UseCurrentEvent();
  325. return true;
  326. }
  327. return false;
  328. }
  329. public bool IsActionActive(SkeletonAction action)
  330. {
  331. if (m_GUIWrapper.isAltDown || !m_GUIWrapper.IsControlHot(0) || !m_GUIWrapper.IsMultiStepControlHot(0))
  332. return false;
  333. if (action == SkeletonAction.None)
  334. return m_GUIWrapper.IsControlNearest(defaultControlID);
  335. if (!IsCapable(action))
  336. return false;
  337. if (action == SkeletonAction.RotateBone)
  338. return m_GUIWrapper.IsControlNearest(m_HoveredBodyControlID);
  339. if (action == SkeletonAction.ChangeLength)
  340. return m_GUIWrapper.IsControlNearest(m_HoveredTailControlID) && !m_GUIWrapper.isShiftDown;
  341. if (action == SkeletonAction.MoveJoint)
  342. return m_GUIWrapper.IsControlNearest(m_HoveredJointControlID);
  343. if (action == SkeletonAction.MoveEndPosition)
  344. return m_GUIWrapper.IsControlNearest(m_HoveredTailControlID) && !m_GUIWrapper.isShiftDown;
  345. if (action == SkeletonAction.FreeMoveBone)
  346. return m_GUIWrapper.IsControlNearest(m_HoveredBodyControlID);
  347. if (action == SkeletonAction.MoveBone)
  348. return m_GUIWrapper.IsControlNearest(m_HoveredJointControlID);
  349. bool canCreateBone = IsCapable(SkeletonAction.CreateBone) && m_GUIWrapper.IsControlNearest(m_CreateBoneControlID);
  350. bool canSplitBone = IsCapable(SkeletonAction.SplitBone) && m_GUIWrapper.IsControlNearest(m_HoveredBodyControlID);
  351. if (action == SkeletonAction.CreateBone)
  352. return canCreateBone;
  353. if (action == SkeletonAction.SplitBone)
  354. return canSplitBone;
  355. if (action == SkeletonAction.Select)
  356. return (m_GUIWrapper.IsControlNearest(m_HoveredBodyControlID) && !canSplitBone) ||
  357. m_GUIWrapper.IsControlNearest(m_HoveredJointControlID) ||
  358. (m_GUIWrapper.IsControlNearest(m_HoveredTailControlID) && !canCreateBone);
  359. if (action == SkeletonAction.Remove)
  360. return true;
  361. return false;
  362. }
  363. public bool IsActionHot(SkeletonAction action)
  364. {
  365. if (action == SkeletonAction.None)
  366. return m_GUIWrapper.IsControlHot(0) && m_GUIWrapper.IsMultiStepControlHot(0);
  367. if (action == SkeletonAction.RotateBone)
  368. return m_GUIWrapper.IsControlHot(m_RotateControlID);
  369. if (action == SkeletonAction.MoveBone)
  370. return m_GUIWrapper.IsControlHot(m_MoveControlID);
  371. if (action == SkeletonAction.FreeMoveBone)
  372. return m_GUIWrapper.IsControlHot(m_FreeMoveControlID);
  373. if (action == SkeletonAction.MoveJoint)
  374. return m_GUIWrapper.IsControlHot(m_MoveJointControlID);
  375. if (action == SkeletonAction.MoveEndPosition)
  376. return m_GUIWrapper.IsControlHot(m_MoveEndPositionControlID);
  377. if (action == SkeletonAction.ChangeLength)
  378. return m_GUIWrapper.IsControlHot(m_ChangeLengthControlID);
  379. if (action == SkeletonAction.CreateBone)
  380. return m_GUIWrapper.IsMultiStepControlHot(m_CreateBoneControlID) && !m_GUIWrapper.isAltDown;
  381. return false;
  382. }
  383. public bool IsActionTriggering(SkeletonAction action)
  384. {
  385. if (!IsActionActive(action))
  386. return false;
  387. if (action == SkeletonAction.Remove)
  388. {
  389. if ((m_GUIWrapper.eventType == EventType.ValidateCommand || m_GUIWrapper.eventType == EventType.ExecuteCommand)
  390. && (m_GUIWrapper.commandName == kSoftDeleteCommandName || m_GUIWrapper.commandName == kDeleteCommandName))
  391. {
  392. if (m_GUIWrapper.eventType == EventType.ExecuteCommand)
  393. return true;
  394. m_GUIWrapper.UseCurrentEvent();
  395. }
  396. return false;
  397. }
  398. return m_GUIWrapper.IsMouseDown(0);
  399. }
  400. public bool IsActionFinishing(SkeletonAction action)
  401. {
  402. if (!IsActionHot(action) || !IsCapable(action))
  403. return false;
  404. if (m_GUIWrapper.IsEventOutsideWindow())
  405. return true;
  406. if (action == SkeletonAction.CreateBone)
  407. return m_GUIWrapper.IsMouseDown(0);
  408. return m_GUIWrapper.IsMouseUp(0);
  409. }
  410. public bool IsRepainting()
  411. {
  412. return m_GUIWrapper.IsRepainting();
  413. }
  414. public void DrawBone(Vector3 position, Vector3 right, Vector3 forward, float length, Color color, bool isChained, bool isSelected, bool isJointHovered, bool isTailHovered, bool isHot)
  415. {
  416. var endPosition = position + right * length;
  417. var rotation = Quaternion.LookRotation(forward, Vector3.Cross(right, forward));
  418. var boneBodyColor = color;
  419. var boneJointColor = new Color(0f, 0f, 0f, 0.75f * color.a);
  420. var tailColor = new Color(0f, 0f, 0f, 0.75f * color.a);
  421. var hoveredColor = Handles.preselectionColor;
  422. var selectedColor = Handles.selectedColor;
  423. var drawRectCap = false;
  424. if (isJointHovered)
  425. boneJointColor = hoveredColor;
  426. if (isHot && (IsActionHot(SkeletonAction.MoveBone) || IsActionHot(SkeletonAction.MoveJoint)))
  427. boneJointColor = selectedColor;
  428. if (mode == SkeletonMode.EditPose || mode == SkeletonMode.CreateBone)
  429. {
  430. if (isJointHovered || isSelected)
  431. drawRectCap = true;
  432. }
  433. else if (mode == SkeletonMode.EditJoints || mode == SkeletonMode.SplitBone)
  434. {
  435. rotation = Quaternion.identity;
  436. drawRectCap = true;
  437. }
  438. if (drawRectCap)
  439. Handles.RectangleHandleCap(0, position, rotation, BoneDrawingUtility.GetBoneRadius(position), EventType.Repaint);
  440. BoneDrawingUtility.DrawBone(position, endPosition, forward, boneBodyColor);
  441. BoneDrawingUtility.DrawBoneNode(position, forward, boneJointColor);
  442. if (!isChained &&
  443. (IsCapable(SkeletonAction.ChangeLength) ||
  444. IsCapable(SkeletonAction.MoveEndPosition)))
  445. {
  446. if (isTailHovered)
  447. tailColor = hoveredColor;
  448. if (isHot && (IsActionHot(SkeletonAction.ChangeLength) || IsActionHot(SkeletonAction.MoveEndPosition)))
  449. tailColor = selectedColor;
  450. BoneDrawingUtility.DrawBoneNode(endPosition, forward, tailColor);
  451. }
  452. }
  453. public void DrawBoneParentLink(Vector3 parentPosition, Vector3 position, Vector3 forward, Color color)
  454. {
  455. BoneDrawingUtility.DrawBone(position, parentPosition, forward, color);
  456. }
  457. public void DrawBoneOutline(Vector3 position, Vector3 right, Vector3 forward, float length, Color color, float outlineScale)
  458. {
  459. BoneDrawingUtility.DrawBoneOutline(position, position + right * length, forward, color, outlineScale);
  460. }
  461. public void DrawCursors(bool canBeActive)
  462. {
  463. var mouseScreenRect = new Rect(m_GUIWrapper.mousePosition.x - 100f, m_GUIWrapper.mousePosition.y - 100f, 200f, 200f);
  464. var isRotateHot = IsActionHot(SkeletonAction.RotateBone);
  465. if ((canBeActive && IsActionActive(SkeletonAction.RotateBone)) || isRotateHot)
  466. EditorGUIUtility.AddCursorRect(mouseScreenRect, MouseCursor.RotateArrow);
  467. if ((canBeActive && IsActionActive(SkeletonAction.MoveBone)) || IsActionHot(SkeletonAction.MoveBone) ||
  468. (canBeActive && IsActionActive(SkeletonAction.FreeMoveBone)) || IsActionHot(SkeletonAction.FreeMoveBone) ||
  469. (canBeActive && IsActionActive(SkeletonAction.MoveJoint)) || IsActionHot(SkeletonAction.MoveJoint) ||
  470. (canBeActive && IsActionActive(SkeletonAction.MoveEndPosition)) || IsActionHot(SkeletonAction.MoveEndPosition))
  471. EditorGUIUtility.AddCursorRect(mouseScreenRect, MouseCursor.MoveArrow);
  472. }
  473. private void ConsumeMouseMoveEvents()
  474. {
  475. if (m_GUIWrapper.eventType == EventType.MouseMove || (m_GUIWrapper.eventType == EventType.MouseDrag && m_GUIWrapper.mouseButton == 0))
  476. m_GUIWrapper.UseCurrentEvent();
  477. }
  478. private bool IsCapable(SkeletonAction action)
  479. {
  480. return ((int)mode & (int)action) != 0;
  481. }
  482. }
  483. }