Bone2D.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Bone2D" inherits="Node2D" version="4.0">
  3. <brief_description>
  4. Joint used with [Skeleton2D] to control and animate other nodes.
  5. </brief_description>
  6. <description>
  7. Use a hierarchy of [code]Bone2D[/code] bound to a [Skeleton2D] to control, and animate other [Node2D] nodes.
  8. You can use [code]Bone2D[/code] and [code]Skeleton2D[/code] nodes to animate 2D meshes created with the Polygon 2D UV editor.
  9. Each bone has a [member rest] transform that you can reset to with [method apply_rest]. These rest poses are relative to the bone's parent.
  10. If in the editor, you can set the rest pose of an entire skeleton using a menu option, from the code, you need to iterate over the bones to set their individual rest poses.
  11. </description>
  12. <tutorials>
  13. </tutorials>
  14. <methods>
  15. <method name="apply_rest">
  16. <return type="void" />
  17. <description>
  18. Stores the node's current transforms in [member rest].
  19. </description>
  20. </method>
  21. <method name="get_autocalculate_length_and_angle" qualifiers="const">
  22. <return type="bool" />
  23. <description>
  24. Returns whether this [code]Bone2D[/code] node is going to autocalculate its length and bone angle using its first [code]Bone2D[/code] child node, if one exists. If there are no [code]Bone2D[/code] children, then it cannot autocalculate these values and will print a warning.
  25. </description>
  26. </method>
  27. <method name="get_bone_angle" qualifiers="const">
  28. <return type="float" />
  29. <description>
  30. Returns the angle of the bone in the [code]Bone2D[/code] node.
  31. [b]Note:[/b] This is different from the [code]Bone2D[/code]'s rotation. The bone angle is the rotation of the bone shown by the [code]Bone2D[/code] gizmo, and because [code]Bone2D[/code] bones are based on positions, this can vary from the actual rotation of the [code]Bone2D[/code] node.
  32. </description>
  33. </method>
  34. <method name="get_default_length" qualifiers="const">
  35. <return type="float" />
  36. <description>
  37. Deprecated. Please use [code]get_length[/code] instead.
  38. </description>
  39. </method>
  40. <method name="get_index_in_skeleton" qualifiers="const">
  41. <return type="int" />
  42. <description>
  43. Returns the node's index as part of the entire skeleton. See [Skeleton2D].
  44. </description>
  45. </method>
  46. <method name="get_length" qualifiers="const">
  47. <return type="float" />
  48. <description>
  49. Returns the length of the bone in the [code]Bone2D[/code] node.
  50. </description>
  51. </method>
  52. <method name="get_skeleton_rest" qualifiers="const">
  53. <return type="Transform2D" />
  54. <description>
  55. Returns the node's [member rest] [code]Transform2D[/code] if it doesn't have a parent, or its rest pose relative to its parent.
  56. </description>
  57. </method>
  58. <method name="set_autocalculate_length_and_angle">
  59. <return type="void" />
  60. <argument index="0" name="auto_calculate" type="bool" />
  61. <description>
  62. When set to [code]true[/code], the [code]Bone2D[/code] node will attempt to automatically calculate the bone angle and length using the first child [code]Bone2D[/code] node, if one exists. If none exist, the [code]Bone2D[/code] cannot automatically calculate these values and will print a warning.
  63. </description>
  64. </method>
  65. <method name="set_bone_angle">
  66. <return type="void" />
  67. <argument index="0" name="angle" type="float" />
  68. <description>
  69. Sets the bone angle for the [code]Bone2D[/code] node. This is typically set to the rotation from the [code]Bone2D[/code] node to a child [code]Bone2D[/code] node.
  70. [b]Note:[/b] This is different from the [code]Bone2D[/code]'s rotation. The bone angle is the rotation of the bone shown by the [code]Bone2D[/code] gizmo, and because [code]Bone2D[/code] bones are based on positions, this can vary from the actual rotation of the [code]Bone2D[/code] node.
  71. </description>
  72. </method>
  73. <method name="set_default_length">
  74. <return type="void" />
  75. <argument index="0" name="default_length" type="float" />
  76. <description>
  77. Deprecated. Please use [code]set_length[/code] instead.
  78. </description>
  79. </method>
  80. <method name="set_length">
  81. <return type="void" />
  82. <argument index="0" name="length" type="float" />
  83. <description>
  84. Sets the length of the bone in the [code]Bone2D[/code] node.
  85. </description>
  86. </method>
  87. </methods>
  88. <members>
  89. <member name="rest" type="Transform2D" setter="set_rest" getter="get_rest" default="Transform2D(0, 0, 0, 0, 0, 0)">
  90. Rest transform of the bone. You can reset the node's transforms to this value using [method apply_rest].
  91. </member>
  92. </members>
  93. </class>