ik_constraint.dart 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. // AUTO GENERATED FILE, DO NOT EDIT.
  30. import 'dart:ffi';
  31. import 'spine_dart_bindings_generated.dart';
  32. import '../spine_bindings.dart';
  33. import 'rtti.dart';
  34. import 'arrays.dart';
  35. import 'bone.dart';
  36. import 'bone_pose.dart';
  37. import 'constraint.dart';
  38. import 'ik_constraint_data.dart';
  39. import 'ik_constraint_pose.dart';
  40. import 'physics.dart';
  41. import 'posed.dart';
  42. import 'posed_active.dart';
  43. import 'skeleton.dart';
  44. /// IkConstraint wrapper
  45. class IkConstraint extends PosedActive implements Posed, Constraint {
  46. final Pointer<spine_ik_constraint_wrapper> _ptr;
  47. IkConstraint.fromPointer(this._ptr) : super.fromPointer(_ptr.cast());
  48. /// Get the native pointer for FFI calls
  49. @override
  50. Pointer get nativePtr => _ptr;
  51. factory IkConstraint(IkConstraintData data, Skeleton skeleton) {
  52. final ptr = SpineBindings.bindings.spine_ik_constraint_create(data.nativePtr.cast(), skeleton.nativePtr.cast());
  53. return IkConstraint.fromPointer(ptr);
  54. }
  55. @override
  56. void dispose() {
  57. SpineBindings.bindings.spine_ik_constraint_dispose(_ptr);
  58. }
  59. @override
  60. Rtti get rtti {
  61. final result = SpineBindings.bindings.spine_ik_constraint_get_rtti(_ptr);
  62. return Rtti.fromPointer(result);
  63. }
  64. IkConstraint copy(Skeleton skeleton) {
  65. final result = SpineBindings.bindings.spine_ik_constraint_copy(_ptr, skeleton.nativePtr.cast());
  66. return IkConstraint.fromPointer(result);
  67. }
  68. @override
  69. void update(Skeleton skeleton, Physics physics) {
  70. SpineBindings.bindings.spine_ik_constraint_update(_ptr, skeleton.nativePtr.cast(), physics.value);
  71. }
  72. @override
  73. void sort(Skeleton skeleton) {
  74. SpineBindings.bindings.spine_ik_constraint_sort(_ptr, skeleton.nativePtr.cast());
  75. }
  76. @override
  77. bool get isSourceActive {
  78. final result = SpineBindings.bindings.spine_ik_constraint_is_source_active(_ptr);
  79. return result;
  80. }
  81. @override
  82. IkConstraintData get data {
  83. final result = SpineBindings.bindings.spine_ik_constraint_get_data(_ptr);
  84. return IkConstraintData.fromPointer(result);
  85. }
  86. ArrayBonePose get bones {
  87. final result = SpineBindings.bindings.spine_ik_constraint_get_bones(_ptr);
  88. return ArrayBonePose.fromPointer(result);
  89. }
  90. Bone get target {
  91. final result = SpineBindings.bindings.spine_ik_constraint_get_target(_ptr);
  92. return Bone.fromPointer(result);
  93. }
  94. set target(Bone value) {
  95. SpineBindings.bindings.spine_ik_constraint_set_target(_ptr, value.nativePtr.cast());
  96. }
  97. IkConstraintPose get pose {
  98. final result = SpineBindings.bindings.spine_ik_constraint_get_pose(_ptr);
  99. return IkConstraintPose.fromPointer(result);
  100. }
  101. IkConstraintPose get appliedPose {
  102. final result = SpineBindings.bindings.spine_ik_constraint_get_applied_pose(_ptr);
  103. return IkConstraintPose.fromPointer(result);
  104. }
  105. @override
  106. void resetConstrained() {
  107. SpineBindings.bindings.spine_ik_constraint_reset_constrained(_ptr);
  108. }
  109. @override
  110. void constrained() {
  111. SpineBindings.bindings.spine_ik_constraint_constrained(_ptr);
  112. }
  113. @override
  114. bool get isPoseEqualToApplied {
  115. final result = SpineBindings.bindings.spine_ik_constraint_is_pose_equal_to_applied(_ptr);
  116. return result;
  117. }
  118. static Rtti rttiStatic() {
  119. final result = SpineBindings.bindings.spine_ik_constraint_rtti();
  120. return Rtti.fromPointer(result);
  121. }
  122. static void apply(Skeleton skeleton, BonePose bone, double targetX, double targetY, bool compress, bool stretch,
  123. bool uniform, double mix) {
  124. SpineBindings.bindings.spine_ik_constraint_apply_1(
  125. skeleton.nativePtr.cast(), bone.nativePtr.cast(), targetX, targetY, compress, stretch, uniform, mix);
  126. }
  127. static void apply2(Skeleton skeleton, BonePose parent, BonePose child, double targetX, double targetY,
  128. int bendDirection, bool stretch, bool uniform, double softness, double mix) {
  129. SpineBindings.bindings.spine_ik_constraint_apply_2(skeleton.nativePtr.cast(), parent.nativePtr.cast(),
  130. child.nativePtr.cast(), targetX, targetY, bendDirection, stretch, uniform, softness, mix);
  131. }
  132. }