SpineBone.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /******************************************************************************
  2. * Spine Runtimes License Agreement
  3. * Last updated April 5, 2025. Replaces all prior versions.
  4. *
  5. * Copyright (c) 2013-2025, Esoteric Software LLC
  6. *
  7. * Integration of the Spine Runtimes into software or otherwise creating
  8. * derivative works of the Spine Runtimes is permitted under the terms and
  9. * conditions of Section 2 of the Spine Editor License Agreement:
  10. * http://esotericsoftware.com/spine-editor-license
  11. *
  12. * Otherwise, it is permitted to integrate the Spine Runtimes into software
  13. * or otherwise create derivative works of the Spine Runtimes (collectively,
  14. * "Products"), provided that each user of the Products must obtain their own
  15. * Spine Editor license and redistribution of the Products in any form must
  16. * include this license and copyright notice.
  17. *
  18. * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
  19. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  20. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
  22. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  23. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
  24. * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
  25. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  27. * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. *****************************************************************************/
  29. #pragma once
  30. #include "SpineCommon.h"
  31. #include "SpineBoneData.h"
  32. #include "SpineConstant.h"
  33. #ifdef SPINE_GODOT_EXTENSION
  34. #include <godot_cpp/classes/node2d.hpp>
  35. #else
  36. #include "scene/2d/node_2d.h"
  37. #endif
  38. #include <spine/Bone.h>
  39. class SpineSkeleton;
  40. class SpineSprite;
  41. class SpineBone : public SpineSpriteOwnedObject<spine::Bone> {
  42. GDCLASS(SpineBone, SpineObjectWrapper)
  43. protected:
  44. static void _bind_methods();
  45. public:
  46. void update_world_transform();
  47. void set_to_setup_pose();
  48. Vector2 world_to_local(Vector2 world_position);
  49. Vector2 world_to_parent(Vector2 world_position);
  50. Vector2 local_to_world(Vector2 local_position);
  51. Vector2 parent_to_world(Vector2 local_position);
  52. float world_to_local_rotation(float world_rotation);
  53. float local_to_world_rotation(float local_rotation);
  54. void rotate_world(float degrees);
  55. float get_world_to_local_rotation_x();
  56. float get_world_to_local_rotation_y();
  57. Ref<SpineBoneData> get_data();
  58. Ref<SpineBone> get_parent();
  59. Array get_children();
  60. float get_x();
  61. void set_x(float v);
  62. float get_y();
  63. void set_y(float v);
  64. float get_rotation();
  65. void set_rotation(float v);
  66. float get_scale_x();
  67. void set_scale_x(float v);
  68. float get_scale_y();
  69. void set_scale_y(float v);
  70. float get_shear_x();
  71. void set_shear_x(float v);
  72. float get_shear_y();
  73. void set_shear_y(float v);
  74. float get_applied_rotation();
  75. void set_applied_rotation(float v);
  76. float get_a_x();
  77. void set_a_x(float v);
  78. float get_a_y();
  79. void set_a_y(float v);
  80. float get_a_scale_x();
  81. void set_a_scale_x(float v);
  82. float get_a_scale_y();
  83. void set_a_scale_y(float v);
  84. float get_a_shear_x();
  85. void set_a_shear_x(float v);
  86. float get_a_shear_y();
  87. void set_a_shear_y(float v);
  88. float get_a();
  89. void set_a(float v);
  90. float get_b();
  91. void set_b(float v);
  92. float get_c();
  93. void set_c(float v);
  94. float get_d();
  95. void set_d(float v);
  96. float get_world_x();
  97. void set_world_x(float v);
  98. float get_world_y();
  99. void set_world_y(float v);
  100. float get_world_rotation_x();
  101. float get_world_rotation_y();
  102. float get_world_scale_x();
  103. float get_world_scale_y();
  104. bool is_active();
  105. void set_active(bool v);
  106. SpineConstant::Inherit get_inherit();
  107. void set_inherit(SpineConstant::Inherit inherit);
  108. // External feature functions
  109. void apply_world_transform_2d(const Variant &o);
  110. Transform2D get_transform();
  111. void set_transform(Transform2D transform);
  112. Transform2D get_global_transform();
  113. void set_global_transform(Transform2D trans);
  114. };