From 861eac1c1bb26f50369101edb16e75c8acb48abb Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Fri, 25 Jul 2025 20:21:39 +0200 Subject: [PATCH] [c] References for non-nullable arguments and return types, pointers for nullable args and return types --- spine-c/src/generated/animation_state.cpp | 12 ++-- .../src/generated/animation_state_data.cpp | 6 +- spine-c/src/generated/attachment.cpp | 2 +- .../src/generated/bounding_box_attachment.cpp | 4 +- spine-c/src/generated/clipping_attachment.cpp | 4 +- spine-c/src/generated/constraint_data.cpp | 2 +- spine-c/src/generated/deform_timeline.cpp | 4 +- spine-c/src/generated/event_timeline.cpp | 2 +- spine-c/src/generated/ik_constraint.cpp | 6 +- spine-c/src/generated/ik_constraint_data.cpp | 6 +- spine-c/src/generated/mesh_attachment.cpp | 8 +-- spine-c/src/generated/path_attachment.cpp | 4 +- spine-c/src/generated/path_constraint.cpp | 6 +- .../src/generated/path_constraint_data.cpp | 6 +- spine-c/src/generated/physics_constraint.cpp | 2 +- .../src/generated/physics_constraint_data.cpp | 6 +- spine-c/src/generated/point_attachment.cpp | 2 +- spine-c/src/generated/region_attachment.cpp | 4 +- spine-c/src/generated/sequence.cpp | 2 +- spine-c/src/generated/sequence_timeline.cpp | 2 +- spine-c/src/generated/skeleton.cpp | 9 +-- spine-c/src/generated/skeleton.h | 3 +- spine-c/src/generated/skeleton_bounds.cpp | 4 +- spine-c/src/generated/skin.cpp | 6 +- spine-c/src/generated/slider.cpp | 6 +- spine-c/src/generated/slider_data.cpp | 6 +- spine-c/src/generated/track_entry.cpp | 4 +- .../src/generated/transform_constraint.cpp | 6 +- .../generated/transform_constraint_data.cpp | 6 +- spine-c/src/generated/vertex_attachment.cpp | 4 +- spine-cpp/include/spine/AnimationState.h | 16 ++--- spine-cpp/include/spine/AnimationStateData.h | 6 +- spine-cpp/include/spine/Attachment.h | 2 +- .../include/spine/BoundingBoxAttachment.h | 2 +- spine-cpp/include/spine/ClippingAttachment.h | 2 +- spine-cpp/include/spine/ConstraintData.h | 4 +- spine-cpp/include/spine/DeformTimeline.h | 4 +- spine-cpp/include/spine/EventTimeline.h | 2 +- spine-cpp/include/spine/IkConstraint.h | 6 +- spine-cpp/include/spine/IkConstraintData.h | 6 +- spine-cpp/include/spine/MeshAttachment.h | 6 +- spine-cpp/include/spine/PathAttachment.h | 2 +- spine-cpp/include/spine/PathConstraint.h | 6 +- spine-cpp/include/spine/PathConstraintData.h | 6 +- spine-cpp/include/spine/PhysicsConstraint.h | 2 +- .../include/spine/PhysicsConstraintData.h | 6 +- spine-cpp/include/spine/PointAttachment.h | 2 +- spine-cpp/include/spine/RegionAttachment.h | 4 +- spine-cpp/include/spine/Sequence.h | 2 +- spine-cpp/include/spine/SequenceTimeline.h | 4 +- spine-cpp/include/spine/Skeleton.h | 3 +- spine-cpp/include/spine/SkeletonBounds.h | 4 +- spine-cpp/include/spine/Skin.h | 6 +- spine-cpp/include/spine/Slider.h | 6 +- spine-cpp/include/spine/SliderData.h | 6 +- spine-cpp/include/spine/TransformConstraint.h | 6 +- .../include/spine/TransformConstraintData.h | 6 +- spine-cpp/include/spine/VertexAttachment.h | 2 +- spine-cpp/spine-cpp-lite/spine-cpp-lite.cpp | 4 +- spine-cpp/src/spine/AnimationState.cpp | 47 +++++++-------- spine-cpp/src/spine/AnimationStateData.cpp | 22 +++---- spine-cpp/src/spine/AtlasAttachmentLoader.cpp | 4 +- spine-cpp/src/spine/BoundingBoxAttachment.cpp | 6 +- spine-cpp/src/spine/ClippingAttachment.cpp | 6 +- spine-cpp/src/spine/DeformTimeline.cpp | 8 +-- spine-cpp/src/spine/EventTimeline.cpp | 6 +- spine-cpp/src/spine/IkConstraint.cpp | 12 ++-- spine-cpp/src/spine/IkConstraintData.cpp | 12 ++-- spine-cpp/src/spine/MeshAttachment.cpp | 20 +++---- spine-cpp/src/spine/PathAttachment.cpp | 6 +- spine-cpp/src/spine/PathConstraint.cpp | 16 ++--- spine-cpp/src/spine/PathConstraintData.cpp | 12 ++-- spine-cpp/src/spine/PhysicsConstraint.cpp | 4 +- spine-cpp/src/spine/PhysicsConstraintData.cpp | 12 ++-- spine-cpp/src/spine/PointAttachment.cpp | 4 +- spine-cpp/src/spine/RegionAttachment.cpp | 10 ++-- spine-cpp/src/spine/Sequence.cpp | 8 +-- spine-cpp/src/spine/Skeleton.cpp | 40 +------------ spine-cpp/src/spine/SkeletonBinary.cpp | 6 +- spine-cpp/src/spine/SkeletonBounds.cpp | 16 ++--- spine-cpp/src/spine/SkeletonJson.cpp | 4 +- spine-cpp/src/spine/Skin.cpp | 31 +++++----- spine-cpp/src/spine/Slider.cpp | 12 ++-- spine-cpp/src/spine/SliderData.cpp | 12 ++-- spine-cpp/src/spine/TransformConstraint.cpp | 12 ++-- .../src/spine/TransformConstraintData.cpp | 12 ++-- spine-cpp/src/spine/VertexAttachment.cpp | 10 ++-- spine-cpp/tests/SkeletonSerializer.h | 33 ++++++++++ spine-flutter/lib/generated/skeleton.dart | 13 ++-- .../spine_dart_bindings_generated.dart | 30 ++-------- spine-flutter/lib/spine_flutter.dart | 2 +- spine-glfw/build.sh | 60 +++++++++++++++++++ spine-glfw/example/main-c.cpp | 2 +- 93 files changed, 404 insertions(+), 383 deletions(-) create mode 100755 spine-glfw/build.sh diff --git a/spine-c/src/generated/animation_state.cpp b/spine-c/src/generated/animation_state.cpp index b4a7a9d8f..a5cd2c351 100644 --- a/spine-c/src/generated/animation_state.cpp +++ b/spine-c/src/generated/animation_state.cpp @@ -33,34 +33,34 @@ void spine_animation_state_clear_track(spine_animation_state self, size_t trackI spine_track_entry spine_animation_state_set_animation_1(spine_animation_state self, size_t trackIndex, const char *animationName, bool loop) { AnimationState *_self = (AnimationState *) self; - return (spine_track_entry) _self->setAnimation(trackIndex, String(animationName), loop); + return (spine_track_entry) &_self->setAnimation(trackIndex, String(animationName), loop); } spine_track_entry spine_animation_state_set_animation_2(spine_animation_state self, size_t trackIndex, spine_animation animation, bool loop) { AnimationState *_self = (AnimationState *) self; - return (spine_track_entry) _self->setAnimation(trackIndex, (Animation *) animation, loop); + return (spine_track_entry) &_self->setAnimation(trackIndex, (Animation *) animation, loop); } spine_track_entry spine_animation_state_add_animation_1(spine_animation_state self, size_t trackIndex, const char *animationName, bool loop, float delay) { AnimationState *_self = (AnimationState *) self; - return (spine_track_entry) _self->addAnimation(trackIndex, String(animationName), loop, delay); + return (spine_track_entry) &_self->addAnimation(trackIndex, String(animationName), loop, delay); } spine_track_entry spine_animation_state_add_animation_2(spine_animation_state self, size_t trackIndex, spine_animation animation, bool loop, float delay) { AnimationState *_self = (AnimationState *) self; - return (spine_track_entry) _self->addAnimation(trackIndex, (Animation *) animation, loop, delay); + return (spine_track_entry) &_self->addAnimation(trackIndex, (Animation *) animation, loop, delay); } spine_track_entry spine_animation_state_set_empty_animation(spine_animation_state self, size_t trackIndex, float mixDuration) { AnimationState *_self = (AnimationState *) self; - return (spine_track_entry) _self->setEmptyAnimation(trackIndex, mixDuration); + return (spine_track_entry) &_self->setEmptyAnimation(trackIndex, mixDuration); } spine_track_entry spine_animation_state_add_empty_animation(spine_animation_state self, size_t trackIndex, float mixDuration, float delay) { AnimationState *_self = (AnimationState *) self; - return (spine_track_entry) _self->addEmptyAnimation(trackIndex, mixDuration, delay); + return (spine_track_entry) &_self->addEmptyAnimation(trackIndex, mixDuration, delay); } void spine_animation_state_set_empty_animations(spine_animation_state self, float mixDuration) { diff --git a/spine-c/src/generated/animation_state_data.cpp b/spine-c/src/generated/animation_state_data.cpp index b10cb54ed..36e047dfb 100644 --- a/spine-c/src/generated/animation_state_data.cpp +++ b/spine-c/src/generated/animation_state_data.cpp @@ -13,7 +13,7 @@ void spine_animation_state_data_dispose(spine_animation_state_data self) { spine_skeleton_data spine_animation_state_data_get_skeleton_data(spine_animation_state_data self) { AnimationStateData *_self = (AnimationStateData *) self; - return (spine_skeleton_data) _self->getSkeletonData(); + return (spine_skeleton_data) &_self->getSkeletonData(); } float spine_animation_state_data_get_default_mix(spine_animation_state_data self) { @@ -33,12 +33,12 @@ void spine_animation_state_data_set_mix_1(spine_animation_state_data self, const void spine_animation_state_data_set_mix_2(spine_animation_state_data self, spine_animation from, spine_animation to, float duration) { AnimationStateData *_self = (AnimationStateData *) self; - _self->setMix((Animation *) from, (Animation *) to, duration); + _self->setMix(*((Animation *) from), *((Animation *) to), duration); } float spine_animation_state_data_get_mix(spine_animation_state_data self, spine_animation from, spine_animation to) { AnimationStateData *_self = (AnimationStateData *) self; - return _self->getMix((Animation *) from, (Animation *) to); + return _self->getMix(*((Animation *) from), *((Animation *) to)); } void spine_animation_state_data_clear(spine_animation_state_data self) { diff --git a/spine-c/src/generated/attachment.cpp b/spine-c/src/generated/attachment.cpp index cc2cdef1a..0ba7c162f 100644 --- a/spine-c/src/generated/attachment.cpp +++ b/spine-c/src/generated/attachment.cpp @@ -19,7 +19,7 @@ const char *spine_attachment_get_name(spine_attachment self) { spine_attachment spine_attachment_copy(spine_attachment self) { Attachment *_self = (Attachment *) self; - return (spine_attachment) _self->copy(); + return (spine_attachment) &_self->copy(); } int spine_attachment_get_ref_count(spine_attachment self) { diff --git a/spine-c/src/generated/bounding_box_attachment.cpp b/spine-c/src/generated/bounding_box_attachment.cpp index f994d6d5c..0286004f1 100644 --- a/spine-c/src/generated/bounding_box_attachment.cpp +++ b/spine-c/src/generated/bounding_box_attachment.cpp @@ -23,7 +23,7 @@ spine_color spine_bounding_box_attachment_get_color(spine_bounding_box_attachmen spine_attachment spine_bounding_box_attachment_copy(spine_bounding_box_attachment self) { BoundingBoxAttachment *_self = (BoundingBoxAttachment *) self; - return (spine_attachment) _self->copy(); + return (spine_attachment) &_self->copy(); } void spine_bounding_box_attachment_compute_world_vertices_1(spine_bounding_box_attachment self, spine_skeleton skeleton, spine_slot slot, @@ -86,7 +86,7 @@ void spine_bounding_box_attachment_set_timeline_attachment(spine_bounding_box_at void spine_bounding_box_attachment_copy_to(spine_bounding_box_attachment self, spine_vertex_attachment other) { VertexAttachment *_self = (VertexAttachment *) (BoundingBoxAttachment *) self; - _self->copyTo((VertexAttachment *) other); + _self->copyTo(*((VertexAttachment *) other)); } const char *spine_bounding_box_attachment_get_name(spine_bounding_box_attachment self) { diff --git a/spine-c/src/generated/clipping_attachment.cpp b/spine-c/src/generated/clipping_attachment.cpp index 160af68e5..fbc4e34a7 100644 --- a/spine-c/src/generated/clipping_attachment.cpp +++ b/spine-c/src/generated/clipping_attachment.cpp @@ -33,7 +33,7 @@ spine_color spine_clipping_attachment_get_color(spine_clipping_attachment self) spine_attachment spine_clipping_attachment_copy(spine_clipping_attachment self) { ClippingAttachment *_self = (ClippingAttachment *) self; - return (spine_attachment) _self->copy(); + return (spine_attachment) &_self->copy(); } void spine_clipping_attachment_compute_world_vertices_1(spine_clipping_attachment self, spine_skeleton skeleton, spine_slot slot, size_t start, @@ -95,7 +95,7 @@ void spine_clipping_attachment_set_timeline_attachment(spine_clipping_attachment void spine_clipping_attachment_copy_to(spine_clipping_attachment self, spine_vertex_attachment other) { VertexAttachment *_self = (VertexAttachment *) (ClippingAttachment *) self; - _self->copyTo((VertexAttachment *) other); + _self->copyTo(*((VertexAttachment *) other)); } const char *spine_clipping_attachment_get_name(spine_clipping_attachment self) { diff --git a/spine-c/src/generated/constraint_data.cpp b/spine-c/src/generated/constraint_data.cpp index 6c8eb1900..bc1182d16 100644 --- a/spine-c/src/generated/constraint_data.cpp +++ b/spine-c/src/generated/constraint_data.cpp @@ -14,7 +14,7 @@ spine_rtti spine_constraint_data_get_rtti(spine_constraint_data self) { spine_constraint spine_constraint_data_create_method(spine_constraint_data self, spine_skeleton skeleton) { ConstraintData *_self = (ConstraintData *) self; - return (spine_constraint) _self->create(*((Skeleton *) skeleton)); + return (spine_constraint) &_self->create(*((Skeleton *) skeleton)); } const char *spine_constraint_data_get_name(spine_constraint_data self) { diff --git a/spine-c/src/generated/deform_timeline.cpp b/spine-c/src/generated/deform_timeline.cpp index fe7e2041f..66179e38e 100644 --- a/spine-c/src/generated/deform_timeline.cpp +++ b/spine-c/src/generated/deform_timeline.cpp @@ -23,12 +23,12 @@ void spine_deform_timeline_set_frame(spine_deform_timeline self, int frameIndex, spine_vertex_attachment spine_deform_timeline_get_attachment(spine_deform_timeline self) { DeformTimeline *_self = (DeformTimeline *) self; - return (spine_vertex_attachment) _self->getAttachment(); + return (spine_vertex_attachment) &_self->getAttachment(); } void spine_deform_timeline_set_attachment(spine_deform_timeline self, spine_vertex_attachment inValue) { DeformTimeline *_self = (DeformTimeline *) self; - _self->setAttachment((VertexAttachment *) inValue); + _self->setAttachment(*((VertexAttachment *) inValue)); } void spine_deform_timeline_set_bezier(spine_deform_timeline self, size_t bezier, size_t frame, float value, float time1, float value1, float cx1, diff --git a/spine-c/src/generated/event_timeline.cpp b/spine-c/src/generated/event_timeline.cpp index 6aa48f358..870c9ad36 100644 --- a/spine-c/src/generated/event_timeline.cpp +++ b/spine-c/src/generated/event_timeline.cpp @@ -35,7 +35,7 @@ spine_array_event spine_event_timeline_get_events(spine_event_timeline self) { void spine_event_timeline_set_frame(spine_event_timeline self, size_t frame, spine_event event) { EventTimeline *_self = (EventTimeline *) self; - _self->setFrame(frame, (Event *) event); + _self->setFrame(frame, *((Event *) event)); } size_t spine_event_timeline_get_frame_entries(spine_event_timeline self) { diff --git a/spine-c/src/generated/ik_constraint.cpp b/spine-c/src/generated/ik_constraint.cpp index 4056edb41..62b9589dc 100644 --- a/spine-c/src/generated/ik_constraint.cpp +++ b/spine-c/src/generated/ik_constraint.cpp @@ -18,7 +18,7 @@ spine_rtti spine_ik_constraint_get_rtti(spine_ik_constraint self) { spine_ik_constraint spine_ik_constraint_copy(spine_ik_constraint self, spine_skeleton skeleton) { IkConstraint *_self = (IkConstraint *) self; - return (spine_ik_constraint) _self->copy(*((Skeleton *) skeleton)); + return (spine_ik_constraint) &_self->copy(*((Skeleton *) skeleton)); } void spine_ik_constraint_update(spine_ik_constraint self, spine_skeleton skeleton, spine_physics physics) { @@ -48,12 +48,12 @@ spine_array_bone_pose spine_ik_constraint_get_bones(spine_ik_constraint self) { spine_bone spine_ik_constraint_get_target(spine_ik_constraint self) { IkConstraint *_self = (IkConstraint *) self; - return (spine_bone) _self->getTarget(); + return (spine_bone) &_self->getTarget(); } void spine_ik_constraint_set_target(spine_ik_constraint self, spine_bone inValue) { IkConstraint *_self = (IkConstraint *) self; - _self->setTarget((Bone *) inValue); + _self->setTarget(*((Bone *) inValue)); } void spine_ik_constraint_apply_1(spine_skeleton skeleton, spine_bone_pose bone, float targetX, float targetY, bool compress, bool stretch, diff --git a/spine-c/src/generated/ik_constraint_data.cpp b/spine-c/src/generated/ik_constraint_data.cpp index a6ceb5c49..8bd68ffc2 100644 --- a/spine-c/src/generated/ik_constraint_data.cpp +++ b/spine-c/src/generated/ik_constraint_data.cpp @@ -18,7 +18,7 @@ spine_rtti spine_ik_constraint_data_get_rtti(spine_ik_constraint_data self) { spine_constraint spine_ik_constraint_data_create_method(spine_ik_constraint_data self, spine_skeleton skeleton) { IkConstraintData *_self = (IkConstraintData *) self; - return (spine_constraint) _self->create(*((Skeleton *) skeleton)); + return (spine_constraint) &_self->create(*((Skeleton *) skeleton)); } spine_array_bone_data spine_ik_constraint_data_get_bones(spine_ik_constraint_data self) { @@ -28,12 +28,12 @@ spine_array_bone_data spine_ik_constraint_data_get_bones(spine_ik_constraint_dat spine_bone_data spine_ik_constraint_data_get_target(spine_ik_constraint_data self) { IkConstraintData *_self = (IkConstraintData *) self; - return (spine_bone_data) _self->getTarget(); + return (spine_bone_data) &_self->getTarget(); } void spine_ik_constraint_data_set_target(spine_ik_constraint_data self, spine_bone_data inValue) { IkConstraintData *_self = (IkConstraintData *) self; - _self->setTarget((BoneData *) inValue); + _self->setTarget(*((BoneData *) inValue)); } bool spine_ik_constraint_data_get_uniform(spine_ik_constraint_data self) { diff --git a/spine-c/src/generated/mesh_attachment.cpp b/spine-c/src/generated/mesh_attachment.cpp index 9040db41c..2d8e779d8 100644 --- a/spine-c/src/generated/mesh_attachment.cpp +++ b/spine-c/src/generated/mesh_attachment.cpp @@ -90,7 +90,7 @@ spine_texture_region spine_mesh_attachment_get_region(spine_mesh_attachment self void spine_mesh_attachment_set_region(spine_mesh_attachment self, spine_texture_region region) { MeshAttachment *_self = (MeshAttachment *) self; - _self->setRegion((TextureRegion *) region); + _self->setRegion(*((TextureRegion *) region)); } spine_sequence spine_mesh_attachment_get_sequence(spine_mesh_attachment self) { @@ -145,12 +145,12 @@ void spine_mesh_attachment_set_height(spine_mesh_attachment self, float inValue) spine_attachment spine_mesh_attachment_copy(spine_mesh_attachment self) { MeshAttachment *_self = (MeshAttachment *) self; - return (spine_attachment) _self->copy(); + return (spine_attachment) &_self->copy(); } spine_mesh_attachment spine_mesh_attachment_new_linked_mesh(spine_mesh_attachment self) { MeshAttachment *_self = (MeshAttachment *) self; - return (spine_mesh_attachment) _self->newLinkedMesh(); + return (spine_mesh_attachment) &_self->newLinkedMesh(); } int spine_mesh_attachment_get_id(spine_mesh_attachment self) { @@ -200,7 +200,7 @@ void spine_mesh_attachment_set_timeline_attachment(spine_mesh_attachment self, s void spine_mesh_attachment_copy_to(spine_mesh_attachment self, spine_vertex_attachment other) { VertexAttachment *_self = (VertexAttachment *) (MeshAttachment *) self; - _self->copyTo((VertexAttachment *) other); + _self->copyTo(*((VertexAttachment *) other)); } const char *spine_mesh_attachment_get_name(spine_mesh_attachment self) { diff --git a/spine-c/src/generated/path_attachment.cpp b/spine-c/src/generated/path_attachment.cpp index dd70bd58b..7ec488f09 100644 --- a/spine-c/src/generated/path_attachment.cpp +++ b/spine-c/src/generated/path_attachment.cpp @@ -53,7 +53,7 @@ spine_color spine_path_attachment_get_color(spine_path_attachment self) { spine_attachment spine_path_attachment_copy(spine_path_attachment self) { PathAttachment *_self = (PathAttachment *) self; - return (spine_attachment) _self->copy(); + return (spine_attachment) &_self->copy(); } void spine_path_attachment_compute_world_vertices_1(spine_path_attachment self, spine_skeleton skeleton, spine_slot slot, size_t start, size_t count, @@ -115,7 +115,7 @@ void spine_path_attachment_set_timeline_attachment(spine_path_attachment self, s void spine_path_attachment_copy_to(spine_path_attachment self, spine_vertex_attachment other) { VertexAttachment *_self = (VertexAttachment *) (PathAttachment *) self; - _self->copyTo((VertexAttachment *) other); + _self->copyTo(*((VertexAttachment *) other)); } const char *spine_path_attachment_get_name(spine_path_attachment self) { diff --git a/spine-c/src/generated/path_constraint.cpp b/spine-c/src/generated/path_constraint.cpp index 948c53ba6..65a61c164 100644 --- a/spine-c/src/generated/path_constraint.cpp +++ b/spine-c/src/generated/path_constraint.cpp @@ -18,7 +18,7 @@ spine_rtti spine_path_constraint_get_rtti(spine_path_constraint self) { spine_path_constraint spine_path_constraint_copy(spine_path_constraint self, spine_skeleton skeleton) { PathConstraint *_self = (PathConstraint *) self; - return (spine_path_constraint) _self->copy(*((Skeleton *) skeleton)); + return (spine_path_constraint) &_self->copy(*((Skeleton *) skeleton)); } void spine_path_constraint_update(spine_path_constraint self, spine_skeleton skeleton, spine_physics physics) { @@ -43,12 +43,12 @@ spine_array_bone_pose spine_path_constraint_get_bones(spine_path_constraint self spine_slot spine_path_constraint_get_slot(spine_path_constraint self) { PathConstraint *_self = (PathConstraint *) self; - return (spine_slot) _self->getSlot(); + return (spine_slot) &_self->getSlot(); } void spine_path_constraint_set_slot(spine_path_constraint self, spine_slot slot) { PathConstraint *_self = (PathConstraint *) self; - _self->setSlot((Slot *) slot); + _self->setSlot(*((Slot *) slot)); } spine_path_constraint_data spine_path_constraint_get_data(spine_path_constraint self) { diff --git a/spine-c/src/generated/path_constraint_data.cpp b/spine-c/src/generated/path_constraint_data.cpp index cc617792e..18419a407 100644 --- a/spine-c/src/generated/path_constraint_data.cpp +++ b/spine-c/src/generated/path_constraint_data.cpp @@ -18,7 +18,7 @@ spine_rtti spine_path_constraint_data_get_rtti(spine_path_constraint_data self) spine_constraint spine_path_constraint_data_create_method(spine_path_constraint_data self, spine_skeleton skeleton) { PathConstraintData *_self = (PathConstraintData *) self; - return (spine_constraint) _self->create(*((Skeleton *) skeleton)); + return (spine_constraint) &_self->create(*((Skeleton *) skeleton)); } spine_array_bone_data spine_path_constraint_data_get_bones(spine_path_constraint_data self) { @@ -28,12 +28,12 @@ spine_array_bone_data spine_path_constraint_data_get_bones(spine_path_constraint spine_slot_data spine_path_constraint_data_get_slot(spine_path_constraint_data self) { PathConstraintData *_self = (PathConstraintData *) self; - return (spine_slot_data) _self->getSlot(); + return (spine_slot_data) &_self->getSlot(); } void spine_path_constraint_data_set_slot(spine_path_constraint_data self, spine_slot_data slot) { PathConstraintData *_self = (PathConstraintData *) self; - _self->setSlot((SlotData *) slot); + _self->setSlot(*((SlotData *) slot)); } spine_position_mode spine_path_constraint_data_get_position_mode(spine_path_constraint_data self) { diff --git a/spine-c/src/generated/physics_constraint.cpp b/spine-c/src/generated/physics_constraint.cpp index 2b0df2197..148683bf3 100644 --- a/spine-c/src/generated/physics_constraint.cpp +++ b/spine-c/src/generated/physics_constraint.cpp @@ -33,7 +33,7 @@ bool spine_physics_constraint_is_source_active(spine_physics_constraint self) { spine_physics_constraint spine_physics_constraint_copy(spine_physics_constraint self, spine_skeleton skeleton) { PhysicsConstraint *_self = (PhysicsConstraint *) self; - return (spine_physics_constraint) _self->copy(*((Skeleton *) skeleton)); + return (spine_physics_constraint) &_self->copy(*((Skeleton *) skeleton)); } void spine_physics_constraint_reset(spine_physics_constraint self, spine_skeleton skeleton) { diff --git a/spine-c/src/generated/physics_constraint_data.cpp b/spine-c/src/generated/physics_constraint_data.cpp index 73e0d0d90..0381ebf56 100644 --- a/spine-c/src/generated/physics_constraint_data.cpp +++ b/spine-c/src/generated/physics_constraint_data.cpp @@ -18,17 +18,17 @@ spine_rtti spine_physics_constraint_data_get_rtti(spine_physics_constraint_data spine_constraint spine_physics_constraint_data_create_method(spine_physics_constraint_data self, spine_skeleton skeleton) { PhysicsConstraintData *_self = (PhysicsConstraintData *) self; - return (spine_constraint) _self->create(*((Skeleton *) skeleton)); + return (spine_constraint) &_self->create(*((Skeleton *) skeleton)); } spine_bone_data spine_physics_constraint_data_get_bone(spine_physics_constraint_data self) { PhysicsConstraintData *_self = (PhysicsConstraintData *) self; - return (spine_bone_data) _self->getBone(); + return (spine_bone_data) &_self->getBone(); } void spine_physics_constraint_data_set_bone(spine_physics_constraint_data self, spine_bone_data bone) { PhysicsConstraintData *_self = (PhysicsConstraintData *) self; - _self->setBone((BoneData *) bone); + _self->setBone(*((BoneData *) bone)); } float spine_physics_constraint_data_get_step(spine_physics_constraint_data self) { diff --git a/spine-c/src/generated/point_attachment.cpp b/spine-c/src/generated/point_attachment.cpp index 2aa902500..9c3fd9644 100644 --- a/spine-c/src/generated/point_attachment.cpp +++ b/spine-c/src/generated/point_attachment.cpp @@ -63,7 +63,7 @@ float spine_point_attachment_compute_world_rotation(spine_point_attachment self, spine_attachment spine_point_attachment_copy(spine_point_attachment self) { PointAttachment *_self = (PointAttachment *) self; - return (spine_attachment) _self->copy(); + return (spine_attachment) &_self->copy(); } const char *spine_point_attachment_get_name(spine_point_attachment self) { diff --git a/spine-c/src/generated/region_attachment.cpp b/spine-c/src/generated/region_attachment.cpp index d24923adf..d7e83a63c 100644 --- a/spine-c/src/generated/region_attachment.cpp +++ b/spine-c/src/generated/region_attachment.cpp @@ -125,7 +125,7 @@ spine_texture_region spine_region_attachment_get_region(spine_region_attachment void spine_region_attachment_set_region(spine_region_attachment self, spine_texture_region region) { RegionAttachment *_self = (RegionAttachment *) self; - _self->setRegion((TextureRegion *) region); + _self->setRegion(*((TextureRegion *) region)); } spine_sequence spine_region_attachment_get_sequence(spine_region_attachment self) { @@ -150,7 +150,7 @@ spine_array_float spine_region_attachment_get_u_vs(spine_region_attachment self) spine_attachment spine_region_attachment_copy(spine_region_attachment self) { RegionAttachment *_self = (RegionAttachment *) self; - return (spine_attachment) _self->copy(); + return (spine_attachment) &_self->copy(); } const char *spine_region_attachment_get_name(spine_region_attachment self) { diff --git a/spine-c/src/generated/sequence.cpp b/spine-c/src/generated/sequence.cpp index 3a95df08a..61635ad37 100644 --- a/spine-c/src/generated/sequence.cpp +++ b/spine-c/src/generated/sequence.cpp @@ -13,7 +13,7 @@ void spine_sequence_dispose(spine_sequence self) { spine_sequence spine_sequence_copy(spine_sequence self) { Sequence *_self = (Sequence *) self; - return (spine_sequence) _self->copy(); + return (spine_sequence) &_self->copy(); } void spine_sequence_apply(spine_sequence self, spine_slot_pose slot, spine_attachment attachment) { diff --git a/spine-c/src/generated/sequence_timeline.cpp b/spine-c/src/generated/sequence_timeline.cpp index c005adcd6..47d9f3492 100644 --- a/spine-c/src/generated/sequence_timeline.cpp +++ b/spine-c/src/generated/sequence_timeline.cpp @@ -30,7 +30,7 @@ void spine_sequence_timeline_set_frame(spine_sequence_timeline self, int frame, spine_attachment spine_sequence_timeline_get_attachment(spine_sequence_timeline self) { SequenceTimeline *_self = (SequenceTimeline *) self; - return (spine_attachment) _self->getAttachment(); + return (spine_attachment) &_self->getAttachment(); } int spine_sequence_timeline_get_slot_index(spine_sequence_timeline self) { diff --git a/spine-c/src/generated/skeleton.cpp b/spine-c/src/generated/skeleton.cpp index 8e63bc386..de04e654e 100644 --- a/spine-c/src/generated/skeleton.cpp +++ b/spine-c/src/generated/skeleton.cpp @@ -35,16 +35,11 @@ void spine_skeleton_sort_reset(spine_array_bone bones) { Skeleton::sortReset(*((Array *) bones)); } -void spine_skeleton_update_world_transform_1(spine_skeleton self, spine_physics physics) { +void spine_skeleton_update_world_transform(spine_skeleton self, spine_physics physics) { Skeleton *_self = (Skeleton *) self; _self->updateWorldTransform((Physics) physics); } -void spine_skeleton_update_world_transform_2(spine_skeleton self, spine_physics physics, spine_bone_pose parent) { - Skeleton *_self = (Skeleton *) self; - _self->updateWorldTransform((Physics) physics, (BonePose *) parent); -} - void spine_skeleton_setup_pose(spine_skeleton self) { Skeleton *_self = (Skeleton *) self; _self->setupPose(); @@ -62,7 +57,7 @@ void spine_skeleton_setup_pose_slots(spine_skeleton self) { spine_skeleton_data spine_skeleton_get_data(spine_skeleton self) { Skeleton *_self = (Skeleton *) self; - return (spine_skeleton_data) _self->getData(); + return (spine_skeleton_data) &_self->getData(); } spine_array_bone spine_skeleton_get_bones(spine_skeleton self) { diff --git a/spine-c/src/generated/skeleton.h b/spine-c/src/generated/skeleton.h index a1a0d069e..ff57d10eb 100644 --- a/spine-c/src/generated/skeleton.h +++ b/spine-c/src/generated/skeleton.h @@ -18,8 +18,7 @@ SPINE_C_API void spine_skeleton_print_update_cache(spine_skeleton self); SPINE_C_API void spine_skeleton_constrained(spine_skeleton self, spine_posed object); SPINE_C_API void spine_skeleton_sort_bone(spine_skeleton self, spine_bone bone); SPINE_C_API void spine_skeleton_sort_reset(spine_array_bone bones); -SPINE_C_API void spine_skeleton_update_world_transform_1(spine_skeleton self, spine_physics physics); -SPINE_C_API void spine_skeleton_update_world_transform_2(spine_skeleton self, spine_physics physics, spine_bone_pose parent); +SPINE_C_API void spine_skeleton_update_world_transform(spine_skeleton self, spine_physics physics); SPINE_C_API void spine_skeleton_setup_pose(spine_skeleton self); SPINE_C_API void spine_skeleton_setup_pose_bones(spine_skeleton self); SPINE_C_API void spine_skeleton_setup_pose_slots(spine_skeleton self); diff --git a/spine-c/src/generated/skeleton_bounds.cpp b/spine-c/src/generated/skeleton_bounds.cpp index 0775ae3e6..bc6572f49 100644 --- a/spine-c/src/generated/skeleton_bounds.cpp +++ b/spine-c/src/generated/skeleton_bounds.cpp @@ -33,7 +33,7 @@ bool spine_skeleton_bounds_aabb_intersects_skeleton(spine_skeleton_bounds self, bool spine_skeleton_bounds_contains_point_1(spine_skeleton_bounds self, spine_polygon polygon, float x, float y) { SkeletonBounds *_self = (SkeletonBounds *) self; - return _self->containsPoint((Polygon *) polygon, x, y); + return _self->containsPoint(*((Polygon *) polygon), x, y); } spine_bounding_box_attachment spine_skeleton_bounds_contains_point_2(spine_skeleton_bounds self, float x, float y) { @@ -48,7 +48,7 @@ spine_bounding_box_attachment spine_skeleton_bounds_intersects_segment_1(spine_s bool spine_skeleton_bounds_intersects_segment_2(spine_skeleton_bounds self, spine_polygon polygon, float x1, float y1, float x2, float y2) { SkeletonBounds *_self = (SkeletonBounds *) self; - return _self->intersectsSegment((Polygon *) polygon, x1, y1, x2, y2); + return _self->intersectsSegment(*((Polygon *) polygon), x1, y1, x2, y2); } spine_polygon spine_skeleton_bounds_get_polygon(spine_skeleton_bounds self, spine_bounding_box_attachment attachment) { diff --git a/spine-c/src/generated/skin.cpp b/spine-c/src/generated/skin.cpp index 7b83d355d..93dd9234b 100644 --- a/spine-c/src/generated/skin.cpp +++ b/spine-c/src/generated/skin.cpp @@ -13,7 +13,7 @@ void spine_skin_dispose(spine_skin self) { void spine_skin_set_attachment(spine_skin self, size_t slotIndex, const char *name, spine_attachment attachment) { Skin *_self = (Skin *) self; - _self->setAttachment(slotIndex, String(name), (Attachment *) attachment); + _self->setAttachment(slotIndex, String(name), *((Attachment *) attachment)); } spine_attachment spine_skin_get_attachment(spine_skin self, size_t slotIndex, const char *name) { @@ -38,12 +38,12 @@ const char *spine_skin_get_name(spine_skin self) { void spine_skin_add_skin(spine_skin self, spine_skin other) { Skin *_self = (Skin *) self; - _self->addSkin((Skin *) other); + _self->addSkin(*((Skin *) other)); } void spine_skin_copy_skin(spine_skin self, spine_skin other) { Skin *_self = (Skin *) self; - _self->copySkin((Skin *) other); + _self->copySkin(*((Skin *) other)); } spine_array_bone_data spine_skin_get_bones(spine_skin self) { diff --git a/spine-c/src/generated/slider.cpp b/spine-c/src/generated/slider.cpp index f358dd411..2463018b5 100644 --- a/spine-c/src/generated/slider.cpp +++ b/spine-c/src/generated/slider.cpp @@ -18,7 +18,7 @@ spine_rtti spine_slider_get_rtti(spine_slider self) { spine_slider spine_slider_copy(spine_slider self, spine_skeleton skeleton) { Slider *_self = (Slider *) self; - return (spine_slider) _self->copy(*((Skeleton *) skeleton)); + return (spine_slider) &_self->copy(*((Skeleton *) skeleton)); } void spine_slider_update(spine_slider self, spine_skeleton skeleton, spine_physics physics) { @@ -38,12 +38,12 @@ bool spine_slider_is_source_active(spine_slider self) { spine_bone spine_slider_get_bone(spine_slider self) { Slider *_self = (Slider *) self; - return (spine_bone) _self->getBone(); + return (spine_bone) &_self->getBone(); } void spine_slider_set_bone(spine_slider self, spine_bone bone) { Slider *_self = (Slider *) self; - _self->setBone((Bone *) bone); + _self->setBone(*((Bone *) bone)); } spine_slider_data spine_slider_get_data(spine_slider self) { diff --git a/spine-c/src/generated/slider_data.cpp b/spine-c/src/generated/slider_data.cpp index 989055886..672ec264f 100644 --- a/spine-c/src/generated/slider_data.cpp +++ b/spine-c/src/generated/slider_data.cpp @@ -18,17 +18,17 @@ spine_rtti spine_slider_data_get_rtti(spine_slider_data self) { spine_constraint spine_slider_data_create_method(spine_slider_data self, spine_skeleton skeleton) { SliderData *_self = (SliderData *) self; - return (spine_constraint) _self->create(*((Skeleton *) skeleton)); + return (spine_constraint) &_self->create(*((Skeleton *) skeleton)); } spine_animation spine_slider_data_get_animation(spine_slider_data self) { SliderData *_self = (SliderData *) self; - return (spine_animation) _self->getAnimation(); + return (spine_animation) &_self->getAnimation(); } void spine_slider_data_set_animation(spine_slider_data self, spine_animation animation) { SliderData *_self = (SliderData *) self; - _self->setAnimation((Animation *) animation); + _self->setAnimation(*((Animation *) animation)); } bool spine_slider_data_get_additive(spine_slider_data self) { diff --git a/spine-c/src/generated/track_entry.cpp b/spine-c/src/generated/track_entry.cpp index 78bfd388e..77089c7c4 100644 --- a/spine-c/src/generated/track_entry.cpp +++ b/spine-c/src/generated/track_entry.cpp @@ -18,12 +18,12 @@ int spine_track_entry_get_track_index(spine_track_entry self) { spine_animation spine_track_entry_get_animation(spine_track_entry self) { TrackEntry *_self = (TrackEntry *) self; - return (spine_animation) _self->getAnimation(); + return (spine_animation) &_self->getAnimation(); } void spine_track_entry_set_animation(spine_track_entry self, spine_animation animation) { TrackEntry *_self = (TrackEntry *) self; - _self->setAnimation((Animation *) animation); + _self->setAnimation(*((Animation *) animation)); } spine_track_entry spine_track_entry_get_previous(spine_track_entry self) { diff --git a/spine-c/src/generated/transform_constraint.cpp b/spine-c/src/generated/transform_constraint.cpp index 0184c1858..7921b718f 100644 --- a/spine-c/src/generated/transform_constraint.cpp +++ b/spine-c/src/generated/transform_constraint.cpp @@ -18,7 +18,7 @@ spine_rtti spine_transform_constraint_get_rtti(spine_transform_constraint self) spine_transform_constraint spine_transform_constraint_copy(spine_transform_constraint self, spine_skeleton skeleton) { TransformConstraint *_self = (TransformConstraint *) self; - return (spine_transform_constraint) _self->copy(*((Skeleton *) skeleton)); + return (spine_transform_constraint) &_self->copy(*((Skeleton *) skeleton)); } void spine_transform_constraint_update(spine_transform_constraint self, spine_skeleton skeleton, spine_physics physics) { @@ -43,12 +43,12 @@ spine_array_bone_pose spine_transform_constraint_get_bones(spine_transform_const spine_bone spine_transform_constraint_get_source(spine_transform_constraint self) { TransformConstraint *_self = (TransformConstraint *) self; - return (spine_bone) _self->getSource(); + return (spine_bone) &_self->getSource(); } void spine_transform_constraint_set_source(spine_transform_constraint self, spine_bone source) { TransformConstraint *_self = (TransformConstraint *) self; - _self->setSource((Bone *) source); + _self->setSource(*((Bone *) source)); } spine_transform_constraint_data spine_transform_constraint_get_data(spine_transform_constraint self) { diff --git a/spine-c/src/generated/transform_constraint_data.cpp b/spine-c/src/generated/transform_constraint_data.cpp index d1ec6db89..24e15985b 100644 --- a/spine-c/src/generated/transform_constraint_data.cpp +++ b/spine-c/src/generated/transform_constraint_data.cpp @@ -18,7 +18,7 @@ spine_rtti spine_transform_constraint_data_get_rtti(spine_transform_constraint_d spine_constraint spine_transform_constraint_data_create_method(spine_transform_constraint_data self, spine_skeleton skeleton) { TransformConstraintData *_self = (TransformConstraintData *) self; - return (spine_constraint) _self->create(*((Skeleton *) skeleton)); + return (spine_constraint) &_self->create(*((Skeleton *) skeleton)); } spine_array_bone_data spine_transform_constraint_data_get_bones(spine_transform_constraint_data self) { @@ -28,12 +28,12 @@ spine_array_bone_data spine_transform_constraint_data_get_bones(spine_transform_ spine_bone_data spine_transform_constraint_data_get_source(spine_transform_constraint_data self) { TransformConstraintData *_self = (TransformConstraintData *) self; - return (spine_bone_data) _self->getSource(); + return (spine_bone_data) &_self->getSource(); } void spine_transform_constraint_data_set_source(spine_transform_constraint_data self, spine_bone_data source) { TransformConstraintData *_self = (TransformConstraintData *) self; - _self->setSource((BoneData *) source); + _self->setSource(*((BoneData *) source)); } float spine_transform_constraint_data_get_offset_rotation(spine_transform_constraint_data self) { diff --git a/spine-c/src/generated/vertex_attachment.cpp b/spine-c/src/generated/vertex_attachment.cpp index 5f2f908e0..77c38d208 100644 --- a/spine-c/src/generated/vertex_attachment.cpp +++ b/spine-c/src/generated/vertex_attachment.cpp @@ -71,7 +71,7 @@ void spine_vertex_attachment_set_timeline_attachment(spine_vertex_attachment sel void spine_vertex_attachment_copy_to(spine_vertex_attachment self, spine_vertex_attachment other) { VertexAttachment *_self = (VertexAttachment *) self; - _self->copyTo((VertexAttachment *) other); + _self->copyTo(*((VertexAttachment *) other)); } const char *spine_vertex_attachment_get_name(spine_vertex_attachment self) { @@ -81,7 +81,7 @@ const char *spine_vertex_attachment_get_name(spine_vertex_attachment self) { spine_attachment spine_vertex_attachment_copy(spine_vertex_attachment self) { Attachment *_self = (Attachment *) (VertexAttachment *) self; - return (spine_attachment) _self->copy(); + return (spine_attachment) &_self->copy(); } int spine_vertex_attachment_get_ref_count(spine_vertex_attachment self) { diff --git a/spine-cpp/include/spine/AnimationState.h b/spine-cpp/include/spine/AnimationState.h index fa398a11a..715e006e9 100644 --- a/spine-cpp/include/spine/AnimationState.h +++ b/spine-cpp/include/spine/AnimationState.h @@ -104,10 +104,10 @@ namespace spine { int getTrackIndex(); /// The animation to apply for this track entry. - Animation *getAnimation(); + Animation &getAnimation(); /// Sets the animation for this track entry. - void setAnimation(Animation *animation); + void setAnimation(Animation &animation); TrackEntry *getPrevious(); @@ -425,7 +425,7 @@ namespace spine { /// Sets an animation by name. /// /// See setAnimation(int, Animation, bool). - TrackEntry *setAnimation(size_t trackIndex, const String &animationName, bool loop); + TrackEntry &setAnimation(size_t trackIndex, const String &animationName, bool loop); /// Sets the current animation for a track, discarding any queued animations. /// @@ -437,12 +437,12 @@ namespace spine { /// @return /// A track entry to allow further customization of animation playback. References to the track entry must not be kept /// after AnimationState.Dispose. - TrackEntry *setAnimation(size_t trackIndex, Animation *animation, bool loop); + TrackEntry &setAnimation(size_t trackIndex, Animation *animation, bool loop); /// Queues an animation by name. /// /// See addAnimation(int, Animation, bool, float). - TrackEntry *addAnimation(size_t trackIndex, const String &animationName, bool loop, float delay); + TrackEntry &addAnimation(size_t trackIndex, const String &animationName, bool loop, float delay); /// Adds an animation to be played delay seconds after the current or last queued animation /// for a track. If the track has no entries, this is equivalent to calling setAnimation. @@ -452,7 +452,7 @@ namespace spine { /// /// @return A track entry to allow further customization of animation playback. References to the track entry must not be kept /// after AnimationState.Dispose - TrackEntry *addAnimation(size_t trackIndex, Animation *animation, bool loop, float delay); + TrackEntry &addAnimation(size_t trackIndex, Animation *animation, bool loop, float delay); /// Sets an empty animation for a track, discarding any queued animations, and sets the track entry's /// TrackEntry::getMixDuration(). An empty animation has no timelines and serves as a placeholder for mixing in or out. @@ -471,7 +471,7 @@ namespace spine { /// /// See Empty animations in the Spine /// Runtimes Guide. - TrackEntry *setEmptyAnimation(size_t trackIndex, float mixDuration); + TrackEntry &setEmptyAnimation(size_t trackIndex, float mixDuration); /// Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's /// TrackEntry::getMixDuration(). If the track has no entries, it is equivalent to calling @@ -486,7 +486,7 @@ namespace spine { /// loop completion is used instead of its duration. /// @return A track entry to allow further customization of animation playback. References to the track entry must not be kept /// after the AnimationStateListener::dispose(TrackEntry) event occurs. - TrackEntry *addEmptyAnimation(size_t trackIndex, float mixDuration, float delay); + TrackEntry &addEmptyAnimation(size_t trackIndex, float mixDuration, float delay); /// Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix duration. /// diff --git a/spine-cpp/include/spine/AnimationStateData.h b/spine-cpp/include/spine/AnimationStateData.h index a315e7695..be57f1a64 100644 --- a/spine-cpp/include/spine/AnimationStateData.h +++ b/spine-cpp/include/spine/AnimationStateData.h @@ -49,7 +49,7 @@ namespace spine { explicit AnimationStateData(SkeletonData *skeletonData); /// The SkeletonData to look up animations when they are specified by name. - SkeletonData *getSkeletonData(); + SkeletonData &getSkeletonData(); /// The mix duration to use when no mix duration has been specifically defined between two animations. float getDefaultMix(); @@ -61,11 +61,11 @@ namespace spine { /// Sets a mix duration when changing from the specified animation to the other. /// See TrackEntry.MixDuration. - void setMix(Animation *from, Animation *to, float duration); + void setMix(Animation &from, Animation &to, float duration); /// The mix duration to use when changing from the specified animation to the other, /// or the DefaultMix if no mix duration has been set. - float getMix(Animation *from, Animation *to); + float getMix(Animation &from, Animation &to); /// Removes all mixes and sets the default mix to 0. void clear(); diff --git a/spine-cpp/include/spine/Attachment.h b/spine-cpp/include/spine/Attachment.h index dd58d2b6f..879c7b316 100644 --- a/spine-cpp/include/spine/Attachment.h +++ b/spine-cpp/include/spine/Attachment.h @@ -45,7 +45,7 @@ namespace spine { const String &getName() const; - virtual Attachment *copy() = 0; + virtual Attachment ©() = 0; int getRefCount(); diff --git a/spine-cpp/include/spine/BoundingBoxAttachment.h b/spine-cpp/include/spine/BoundingBoxAttachment.h index ab76a71fc..3ec328430 100644 --- a/spine-cpp/include/spine/BoundingBoxAttachment.h +++ b/spine-cpp/include/spine/BoundingBoxAttachment.h @@ -44,7 +44,7 @@ namespace spine { Color &getColor(); - virtual Attachment *copy() override; + virtual Attachment ©() override; private: Color _color; diff --git a/spine-cpp/include/spine/ClippingAttachment.h b/spine-cpp/include/spine/ClippingAttachment.h index f85f460b2..3e5136178 100644 --- a/spine-cpp/include/spine/ClippingAttachment.h +++ b/spine-cpp/include/spine/ClippingAttachment.h @@ -54,7 +54,7 @@ namespace spine { Color &getColor(); - virtual Attachment *copy() override; + virtual Attachment ©() override; private: SlotData *_endSlot; diff --git a/spine-cpp/include/spine/ConstraintData.h b/spine-cpp/include/spine/ConstraintData.h index 44880ac19..659450b8a 100644 --- a/spine-cpp/include/spine/ConstraintData.h +++ b/spine-cpp/include/spine/ConstraintData.h @@ -50,7 +50,7 @@ namespace spine { virtual ~ConstraintData() { } - virtual Constraint *create(Skeleton &skeleton) = 0; + virtual Constraint &create(Skeleton &skeleton) = 0; virtual const String &getName() const = 0; @@ -66,7 +66,7 @@ namespace spine { virtual ~ConstraintDataGeneric() { } - virtual Constraint *create(Skeleton &skeleton) override = 0; + virtual Constraint &create(Skeleton &skeleton) override = 0; // Resolve ambiguity by forwarding to PosedData's implementation virtual const String &getName() const override { diff --git a/spine-cpp/include/spine/DeformTimeline.h b/spine-cpp/include/spine/DeformTimeline.h index 35caae6d0..d776cc450 100644 --- a/spine-cpp/include/spine/DeformTimeline.h +++ b/spine-cpp/include/spine/DeformTimeline.h @@ -53,9 +53,9 @@ namespace spine { Array> &getVertices(); /// The attachment that will be deformed. - VertexAttachment *getAttachment(); + VertexAttachment &getAttachment(); - void setAttachment(VertexAttachment *inValue); + void setAttachment(VertexAttachment &inValue); virtual void setBezier(size_t bezier, size_t frame, float value, float time1, float value1, float cx1, float cy1, float cx2, float cy2, float time2, float value2) override; diff --git a/spine-cpp/include/spine/EventTimeline.h b/spine-cpp/include/spine/EventTimeline.h index 17e66490e..18f5c4b00 100644 --- a/spine-cpp/include/spine/EventTimeline.h +++ b/spine-cpp/include/spine/EventTimeline.h @@ -57,7 +57,7 @@ namespace spine { /// Sets the time and event for the specified frame. /// @param frame Between 0 and frameCount, inclusive. - void setFrame(size_t frame, Event *event); + void setFrame(size_t frame, Event &event); private: Array _events; diff --git a/spine-cpp/include/spine/IkConstraint.h b/spine-cpp/include/spine/IkConstraint.h index a5742883b..304106e24 100644 --- a/spine-cpp/include/spine/IkConstraint.h +++ b/spine-cpp/include/spine/IkConstraint.h @@ -51,7 +51,7 @@ namespace spine { public: IkConstraint(IkConstraintData &data, Skeleton &skeleton); - virtual IkConstraint *copy(Skeleton &skeleton); + virtual IkConstraint ©(Skeleton &skeleton); virtual void update(Skeleton &skeleton, Physics physics) override; @@ -63,9 +63,9 @@ namespace spine { Array &getBones(); - Bone *getTarget(); + Bone &getTarget(); - void setTarget(Bone *inValue); + void setTarget(Bone &inValue); /// Adjusts the bone rotation so the tip is as close to the target position as possible. The target is specified /// in the world coordinate system. diff --git a/spine-cpp/include/spine/IkConstraintData.h b/spine-cpp/include/spine/IkConstraintData.h index 22a50db0f..eb15d32ea 100644 --- a/spine-cpp/include/spine/IkConstraintData.h +++ b/spine-cpp/include/spine/IkConstraintData.h @@ -57,15 +57,15 @@ namespace spine { public: explicit IkConstraintData(const String &name); - virtual Constraint *create(Skeleton &skeleton) override; + virtual Constraint &create(Skeleton &skeleton) override; /// The bones that are constrained by this IK Constraint. Array &getBones(); /// The bone that is the IK target. - BoneData *getTarget(); + BoneData &getTarget(); - void setTarget(BoneData *inValue); + void setTarget(BoneData &inValue); /// When true and IkConstraintPose compress or stretch is used, the bone is scaled on both the X and Y axes. bool getUniform(); diff --git a/spine-cpp/include/spine/MeshAttachment.h b/spine-cpp/include/spine/MeshAttachment.h index a125df51f..4fd991f80 100644 --- a/spine-cpp/include/spine/MeshAttachment.h +++ b/spine-cpp/include/spine/MeshAttachment.h @@ -83,7 +83,7 @@ namespace spine { TextureRegion *getRegion(); - void setRegion(TextureRegion *region); + void setRegion(TextureRegion ®ion); Sequence *getSequence(); @@ -106,9 +106,9 @@ namespace spine { void setHeight(float inValue); - virtual Attachment *copy() override; + virtual Attachment ©() override; - MeshAttachment *newLinkedMesh(); + MeshAttachment &newLinkedMesh(); private: TextureRegion *_region; diff --git a/spine-cpp/include/spine/PathAttachment.h b/spine-cpp/include/spine/PathAttachment.h index 9653565cc..f0ebbcc1d 100644 --- a/spine-cpp/include/spine/PathAttachment.h +++ b/spine-cpp/include/spine/PathAttachment.h @@ -59,7 +59,7 @@ namespace spine { Color &getColor(); - virtual Attachment *copy() override; + virtual Attachment ©() override; private: Array _lengths; diff --git a/spine-cpp/include/spine/PathConstraint.h b/spine-cpp/include/spine/PathConstraint.h index 85b431c7d..b6d720ec6 100644 --- a/spine-cpp/include/spine/PathConstraint.h +++ b/spine-cpp/include/spine/PathConstraint.h @@ -64,7 +64,7 @@ namespace spine { PathConstraint(PathConstraintData &data, Skeleton &skeleton); - PathConstraint *copy(Skeleton &skeleton); + PathConstraint ©(Skeleton &skeleton); /// Applies the constraint to the constrained bones. virtual void update(Skeleton &skeleton, Physics physics) override; @@ -77,9 +77,9 @@ namespace spine { Array &getBones(); /// The slot whose path attachment will be used to constrained the bones. - Slot *getSlot(); + Slot &getSlot(); - void setSlot(Slot *slot); + void setSlot(Slot &slot); virtual PathConstraintData &getData() override; diff --git a/spine-cpp/include/spine/PathConstraintData.h b/spine-cpp/include/spine/PathConstraintData.h index d2d4dde74..008c4bf47 100644 --- a/spine-cpp/include/spine/PathConstraintData.h +++ b/spine-cpp/include/spine/PathConstraintData.h @@ -67,16 +67,16 @@ namespace spine { public: explicit PathConstraintData(const String &name); - virtual Constraint *create(Skeleton &skeleton) override; + virtual Constraint &create(Skeleton &skeleton) override; /// The bones that will be modified by this path constraint. Array &getBones(); /// The slot whose path attachment will be used to constrained the bones. - SlotData *getSlot(); + SlotData &getSlot(); - void setSlot(SlotData *slot); + void setSlot(SlotData &slot); /// The mode for positioning the first bone on the path. PositionMode getPositionMode(); diff --git a/spine-cpp/include/spine/PhysicsConstraint.h b/spine-cpp/include/spine/PhysicsConstraint.h index fc7335be1..121a4148b 100644 --- a/spine-cpp/include/spine/PhysicsConstraint.h +++ b/spine-cpp/include/spine/PhysicsConstraint.h @@ -64,7 +64,7 @@ namespace spine { void update(Skeleton &skeleton, Physics physics) override; void sort(Skeleton &skeleton) override; bool isSourceActive() override; - PhysicsConstraint *copy(Skeleton &skeleton); + PhysicsConstraint ©(Skeleton &skeleton); void reset(Skeleton &skeleton); diff --git a/spine-cpp/include/spine/PhysicsConstraintData.h b/spine-cpp/include/spine/PhysicsConstraintData.h index 209661e80..33f3bf827 100644 --- a/spine-cpp/include/spine/PhysicsConstraintData.h +++ b/spine-cpp/include/spine/PhysicsConstraintData.h @@ -51,11 +51,11 @@ namespace spine { public: explicit PhysicsConstraintData(const String &name); - virtual Constraint *create(Skeleton &skeleton) override; + virtual Constraint &create(Skeleton &skeleton) override; /// The bone constrained by this physics constraint. - BoneData *getBone(); - void setBone(BoneData *bone); + BoneData &getBone(); + void setBone(BoneData &bone); float getStep(); void setStep(float step); diff --git a/spine-cpp/include/spine/PointAttachment.h b/spine-cpp/include/spine/PointAttachment.h index c99addd85..5e162b487 100644 --- a/spine-cpp/include/spine/PointAttachment.h +++ b/spine-cpp/include/spine/PointAttachment.h @@ -71,7 +71,7 @@ namespace spine { float computeWorldRotation(BonePose &bone); - virtual Attachment *copy() override; + virtual Attachment ©() override; private: float _x, _y, _rotation; diff --git a/spine-cpp/include/spine/RegionAttachment.h b/spine-cpp/include/spine/RegionAttachment.h index bc8230548..72bee3a6e 100644 --- a/spine-cpp/include/spine/RegionAttachment.h +++ b/spine-cpp/include/spine/RegionAttachment.h @@ -104,7 +104,7 @@ namespace spine { TextureRegion *getRegion(); - void setRegion(TextureRegion *region); + void setRegion(TextureRegion ®ion); Sequence *getSequence(); @@ -114,7 +114,7 @@ namespace spine { Array &getUVs(); - virtual Attachment *copy() override; + virtual Attachment ©() override; private: static const int BLX; diff --git a/spine-cpp/include/spine/Sequence.h b/spine-cpp/include/spine/Sequence.h index 347f1f5f3..6b4554edd 100644 --- a/spine-cpp/include/spine/Sequence.h +++ b/spine-cpp/include/spine/Sequence.h @@ -51,7 +51,7 @@ namespace spine { ~Sequence(); - Sequence *copy(); + Sequence ©(); void apply(SlotPose *slot, Attachment *attachment); diff --git a/spine-cpp/include/spine/SequenceTimeline.h b/spine-cpp/include/spine/SequenceTimeline.h index 288c76cc0..57c630d08 100644 --- a/spine-cpp/include/spine/SequenceTimeline.h +++ b/spine-cpp/include/spine/SequenceTimeline.h @@ -59,8 +59,8 @@ namespace spine { /// @param delay Seconds between frames. void setFrame(int frame, float time, SequenceMode mode, int index, float delay); - Attachment *getAttachment() { - return (Attachment *) _attachment; + Attachment &getAttachment() { + return *(Attachment *) _attachment; } virtual int getSlotIndex() override; diff --git a/spine-cpp/include/spine/Skeleton.h b/spine-cpp/include/spine/Skeleton.h index a23547ad8..302216326 100644 --- a/spine-cpp/include/spine/Skeleton.h +++ b/spine-cpp/include/spine/Skeleton.h @@ -173,7 +173,6 @@ namespace spine { /// Runtimes Guide. void updateWorldTransform(Physics physics); - void updateWorldTransform(Physics physics, BonePose *parent); /// Sets the bones, constraints, and slots to their setup pose values. void setupPose(); @@ -183,7 +182,7 @@ namespace spine { void setupPoseSlots(); - SkeletonData *getData(); + SkeletonData &getData(); Array &getBones(); diff --git a/spine-cpp/include/spine/SkeletonBounds.h b/spine-cpp/include/spine/SkeletonBounds.h index 809397a62..2593410f4 100644 --- a/spine-cpp/include/spine/SkeletonBounds.h +++ b/spine-cpp/include/spine/SkeletonBounds.h @@ -68,7 +68,7 @@ namespace spine { bool aabbIntersectsSkeleton(SkeletonBounds &bounds); /// Returns true if the polygon contains the point. - bool containsPoint(Polygon *polygon, float x, float y); + bool containsPoint(Polygon &polygon, float x, float y); /// Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more /// efficient to only call this method if aabbContainsPoint(float, float) returns true. @@ -79,7 +79,7 @@ namespace spine { BoundingBoxAttachment *intersectsSegment(float x1, float y1, float x2, float y2); /// Returns true if the polygon contains any part of the line segment. - bool intersectsSegment(Polygon *polygon, float x1, float y1, float x2, float y2); + bool intersectsSegment(Polygon &polygon, float x1, float y1, float x2, float y2); /// Returns the polygon for the given bounding box attachment or null if no /// polygon can be found for the attachment. Requires a call to update() first. diff --git a/spine-cpp/include/spine/Skin.h b/spine-cpp/include/spine/Skin.h index deb0ab755..bf645e2eb 100644 --- a/spine-cpp/include/spine/Skin.h +++ b/spine-cpp/include/spine/Skin.h @@ -118,7 +118,7 @@ namespace spine { /// Adds an attachment to the skin for the specified slot index and name. /// If the name already exists for the slot, the previous value is replaced. - void setAttachment(size_t slotIndex, const String &name, Attachment *attachment); + void setAttachment(size_t slotIndex, const String &name, Attachment &attachment); /// Returns the attachment for the specified slot index and name, or NULL. Attachment *getAttachment(size_t slotIndex, const String &name); @@ -139,10 +139,10 @@ namespace spine { const String &getName(); /// Adds all attachments, bones, and constraints from the specified skin to this skin. - void addSkin(Skin *other); + void addSkin(Skin &other); /// Adds all attachments, bones, and constraints from the specified skin to this skin. Attachments are deep copied. - void copySkin(Skin *other); + void copySkin(Skin &other); AttachmentMap::Entries getAttachments(); diff --git a/spine-cpp/include/spine/Slider.h b/spine-cpp/include/spine/Slider.h index a760946fd..67c8a1d9b 100644 --- a/spine-cpp/include/spine/Slider.h +++ b/spine-cpp/include/spine/Slider.h @@ -52,7 +52,7 @@ namespace spine { public: Slider(SliderData &data, Skeleton &skeleton); - Slider *copy(Skeleton &skeleton); + Slider ©(Skeleton &skeleton); virtual void update(Skeleton &skeleton, Physics physics) override; @@ -60,9 +60,9 @@ namespace spine { virtual bool isSourceActive() override; - Bone *getBone(); + Bone &getBone(); - void setBone(Bone *bone); + void setBone(Bone &bone); private: Bone *_bone; diff --git a/spine-cpp/include/spine/SliderData.h b/spine-cpp/include/spine/SliderData.h index 4218c07f1..94aec7bfe 100644 --- a/spine-cpp/include/spine/SliderData.h +++ b/spine-cpp/include/spine/SliderData.h @@ -56,10 +56,10 @@ namespace spine { explicit SliderData(const String &name); /// Creates a slider instance. - virtual Constraint *create(Skeleton &skeleton) override; + virtual Constraint &create(Skeleton &skeleton) override; - Animation *getAnimation(); - void setAnimation(Animation *animation); + Animation &getAnimation(); + void setAnimation(Animation &animation); bool getAdditive(); void setAdditive(bool additive); diff --git a/spine-cpp/include/spine/TransformConstraint.h b/spine-cpp/include/spine/TransformConstraint.h index 7a2d17e0f..ecd803318 100644 --- a/spine-cpp/include/spine/TransformConstraint.h +++ b/spine-cpp/include/spine/TransformConstraint.h @@ -49,7 +49,7 @@ namespace spine { public: TransformConstraint(TransformConstraintData &data, Skeleton &skeleton); - virtual TransformConstraint *copy(Skeleton &skeleton); + virtual TransformConstraint ©(Skeleton &skeleton); /// Applies the constraint to the constrained bones. void update(Skeleton &skeleton, Physics physics) override; @@ -62,9 +62,9 @@ namespace spine { Array &getBones(); /// The bone whose world transform will be copied to the constrained bones. - Bone *getSource(); + Bone &getSource(); - void setSource(Bone *source); + void setSource(Bone &source); private: Array _bones; diff --git a/spine-cpp/include/spine/TransformConstraintData.h b/spine-cpp/include/spine/TransformConstraintData.h index d0592214a..29817b9eb 100644 --- a/spine-cpp/include/spine/TransformConstraintData.h +++ b/spine-cpp/include/spine/TransformConstraintData.h @@ -257,14 +257,14 @@ namespace spine { explicit TransformConstraintData(const String &name); ~TransformConstraintData(); - virtual Constraint *create(Skeleton &skeleton) override; + virtual Constraint &create(Skeleton &skeleton) override; /// The bones that will be modified by this transform constraint. Array &getBones(); /// The bone whose world transform will be copied to the constrained bones. - BoneData *getSource(); - void setSource(BoneData *source); + BoneData &getSource(); + void setSource(BoneData &source); /// An offset added to the constrained bone rotation. float getOffsetRotation(); diff --git a/spine-cpp/include/spine/VertexAttachment.h b/spine-cpp/include/spine/VertexAttachment.h index 8bd8841a0..51ef93d47 100644 --- a/spine-cpp/include/spine/VertexAttachment.h +++ b/spine-cpp/include/spine/VertexAttachment.h @@ -90,7 +90,7 @@ namespace spine { void setTimelineAttachment(Attachment *attachment); - void copyTo(VertexAttachment *other); + void copyTo(VertexAttachment &other); protected: Array _bones; diff --git a/spine-cpp/spine-cpp-lite/spine-cpp-lite.cpp b/spine-cpp/spine-cpp-lite/spine-cpp-lite.cpp index 1f65d1269..3f124357d 100644 --- a/spine-cpp/spine-cpp-lite/spine-cpp-lite.cpp +++ b/spine-cpp/spine-cpp-lite/spine-cpp-lite.cpp @@ -3272,13 +3272,13 @@ spine_bone *spine_ik_constraint_get_bones(spine_ik_constraint constraint) { spine_bone spine_ik_constraint_get_target(spine_ik_constraint constraint) { if (constraint == nullptr) return nullptr; IkConstraint *_constraint = (IkConstraint *) constraint; - return (spine_bone) _constraint->getTarget(); + return (spine_bone) &_constraint->getTarget(); } void spine_ik_constraint_set_target(spine_ik_constraint constraint, spine_bone target) { if (constraint == nullptr) return; IkConstraint *_constraint = (IkConstraint *) constraint; - _constraint->setTarget((Bone *) target); + _constraint->setTarget(*(Bone *) target); } int32_t spine_ik_constraint_get_bend_direction(spine_ik_constraint constraint) { diff --git a/spine-cpp/src/spine/AnimationState.cpp b/spine-cpp/src/spine/AnimationState.cpp index 02f15b6d4..5c177ce85 100644 --- a/spine-cpp/src/spine/AnimationState.cpp +++ b/spine-cpp/src/spine/AnimationState.cpp @@ -68,15 +68,12 @@ int TrackEntry::getTrackIndex() { return _trackIndex; } -Animation *TrackEntry::getAnimation() { - return _animation; +Animation &TrackEntry::getAnimation() { + return *_animation; } -void TrackEntry::setAnimation(Animation *animation) { - if (animation == NULL) { - return; - } - _animation = animation; +void TrackEntry::setAnimation(Animation &animation) { + _animation = &animation; } TrackEntry *TrackEntry::getPrevious() { @@ -652,13 +649,13 @@ void AnimationState::clearTrack(size_t trackIndex) { _queue->drain(); } -TrackEntry *AnimationState::setAnimation(size_t trackIndex, const String &animationName, bool loop) { +TrackEntry &AnimationState::setAnimation(size_t trackIndex, const String &animationName, bool loop) { Animation *animation = _data->_skeletonData->findAnimation(animationName); assert(animation != NULL); return setAnimation(trackIndex, animation, loop); } -TrackEntry *AnimationState::setAnimation(size_t trackIndex, Animation *animation, bool loop) { +TrackEntry &AnimationState::setAnimation(size_t trackIndex, Animation *animation, bool loop) { assert(animation != NULL); bool interrupt = true; @@ -681,16 +678,16 @@ TrackEntry *AnimationState::setAnimation(size_t trackIndex, Animation *animation setCurrent(trackIndex, entry, interrupt); _queue->drain(); - return entry; + return *entry; } -TrackEntry *AnimationState::addAnimation(size_t trackIndex, const String &animationName, bool loop, float delay) { +TrackEntry &AnimationState::addAnimation(size_t trackIndex, const String &animationName, bool loop, float delay) { Animation *animation = _data->_skeletonData->findAnimation(animationName); assert(animation != NULL); return addAnimation(trackIndex, animation, loop, delay); } -TrackEntry *AnimationState::addAnimation(size_t trackIndex, Animation *animation, bool loop, float delay) { +TrackEntry &AnimationState::addAnimation(size_t trackIndex, Animation *animation, bool loop, float delay) { assert(animation != NULL); TrackEntry *last = expandToIndex(trackIndex); @@ -711,21 +708,21 @@ TrackEntry *AnimationState::addAnimation(size_t trackIndex, Animation *animation } entry->_delay = delay; + return *entry; +} + +TrackEntry &AnimationState::setEmptyAnimation(size_t trackIndex, float mixDuration) { + TrackEntry &entry = setAnimation(trackIndex, AnimationState::getEmptyAnimation(), false); + entry._mixDuration = mixDuration; + entry._trackEnd = mixDuration; return entry; } -TrackEntry *AnimationState::setEmptyAnimation(size_t trackIndex, float mixDuration) { - TrackEntry *entry = setAnimation(trackIndex, AnimationState::getEmptyAnimation(), false); - entry->_mixDuration = mixDuration; - entry->_trackEnd = mixDuration; - return entry; -} - -TrackEntry *AnimationState::addEmptyAnimation(size_t trackIndex, float mixDuration, float delay) { - TrackEntry *entry = addAnimation(trackIndex, AnimationState::getEmptyAnimation(), false, delay); - if (delay <= 0) entry->_delay = MathUtil::max(entry->_delay + entry->_mixDuration - mixDuration, 0.0f); - entry->_mixDuration = mixDuration; - entry->_trackEnd = mixDuration; +TrackEntry &AnimationState::addEmptyAnimation(size_t trackIndex, float mixDuration, float delay) { + TrackEntry &entry = addAnimation(trackIndex, AnimationState::getEmptyAnimation(), false, delay); + if (delay <= 0) entry._delay = MathUtil::max(entry._delay + entry._mixDuration - mixDuration, 0.0f); + entry._mixDuration = mixDuration; + entry._trackEnd = mixDuration; return entry; } @@ -1109,7 +1106,7 @@ TrackEntry *AnimationState::newTrackEntry(size_t trackIndex, Animation *animatio entry._alpha = 1; entry._mixTime = 0; - entry._mixDuration = (last == NULL) ? 0 : _data->getMix(last->_animation, animation); + entry._mixDuration = (last == NULL) ? 0 : _data->getMix(*last->_animation, *animation); entry._interruptAlpha = 1; entry._totalAlpha = 0; entry._mixBlend = MixBlend_Replace; diff --git a/spine-cpp/src/spine/AnimationStateData.cpp b/spine-cpp/src/spine/AnimationStateData.cpp index 9ba25ca69..5a27ba6d1 100644 --- a/spine-cpp/src/spine/AnimationStateData.cpp +++ b/spine-cpp/src/spine/AnimationStateData.cpp @@ -39,30 +39,26 @@ AnimationStateData::AnimationStateData(SkeletonData *skeletonData) : _skeletonDa void AnimationStateData::setMix(const String &fromName, const String &toName, float duration) { Animation *from = _skeletonData->findAnimation(fromName); Animation *to = _skeletonData->findAnimation(toName); - - setMix(from, to, duration); -} - -void AnimationStateData::setMix(Animation *from, Animation *to, float duration) { assert(from != NULL); assert(to != NULL); - AnimationPair key(from, to); + setMix(*from, *to, duration); +} + +void AnimationStateData::setMix(Animation &from, Animation &to, float duration) { + AnimationPair key(&from, &to); _animationToMixTime.put(key, duration); } -float AnimationStateData::getMix(Animation *from, Animation *to) { - assert(from != NULL); - assert(to != NULL); - - AnimationPair key(from, to); +float AnimationStateData::getMix(Animation &from, Animation &to) { + AnimationPair key(&from, &to); if (_animationToMixTime.containsKey(key)) return _animationToMixTime[key]; return _defaultMix; } -SkeletonData *AnimationStateData::getSkeletonData() { - return _skeletonData; +SkeletonData &AnimationStateData::getSkeletonData() { + return *_skeletonData; } float AnimationStateData::getDefaultMix() { diff --git a/spine-cpp/src/spine/AtlasAttachmentLoader.cpp b/spine-cpp/src/spine/AtlasAttachmentLoader.cpp index ba41e0104..f12019262 100644 --- a/spine-cpp/src/spine/AtlasAttachmentLoader.cpp +++ b/spine-cpp/src/spine/AtlasAttachmentLoader.cpp @@ -61,7 +61,7 @@ RegionAttachment *AtlasAttachmentLoader::newRegionAttachment(Skin &skin, const S } else { AtlasRegion *region = findRegion(path); if (!region) return NULL; - attachment->setRegion(region); + attachment->setRegion(*region); } return attachment; } @@ -75,7 +75,7 @@ MeshAttachment *AtlasAttachmentLoader::newMeshAttachment(Skin &skin, const Strin } else { AtlasRegion *region = findRegion(path); if (!region) return NULL; - attachment->setRegion(region); + attachment->setRegion(*region); } return attachment; } diff --git a/spine-cpp/src/spine/BoundingBoxAttachment.cpp b/spine-cpp/src/spine/BoundingBoxAttachment.cpp index ffc8cb26e..ffe8663e6 100644 --- a/spine-cpp/src/spine/BoundingBoxAttachment.cpp +++ b/spine-cpp/src/spine/BoundingBoxAttachment.cpp @@ -40,8 +40,8 @@ Color &BoundingBoxAttachment::getColor() { return _color; } -Attachment *BoundingBoxAttachment::copy() { +Attachment &BoundingBoxAttachment::copy() { BoundingBoxAttachment *copy = new (__FILE__, __LINE__) BoundingBoxAttachment(getName()); - copyTo(copy); - return copy; + copyTo(*copy); + return *copy; } diff --git a/spine-cpp/src/spine/ClippingAttachment.cpp b/spine-cpp/src/spine/ClippingAttachment.cpp index 90f5c141b..0ce830490 100644 --- a/spine-cpp/src/spine/ClippingAttachment.cpp +++ b/spine-cpp/src/spine/ClippingAttachment.cpp @@ -50,9 +50,9 @@ Color &ClippingAttachment::getColor() { return _color; } -Attachment *ClippingAttachment::copy() { +Attachment &ClippingAttachment::copy() { ClippingAttachment *copy = new (__FILE__, __LINE__) ClippingAttachment(getName()); - copyTo(copy); + copyTo(*copy); copy->_endSlot = _endSlot; - return copy; + return *copy; } diff --git a/spine-cpp/src/spine/DeformTimeline.cpp b/spine-cpp/src/spine/DeformTimeline.cpp index 60ce4f603..a4b0d8b99 100644 --- a/spine-cpp/src/spine/DeformTimeline.cpp +++ b/spine-cpp/src/spine/DeformTimeline.cpp @@ -301,10 +301,10 @@ Array> &DeformTimeline::getVertices() { return _vertices; } -VertexAttachment *DeformTimeline::getAttachment() { - return _attachment; +VertexAttachment &DeformTimeline::getAttachment() { + return *_attachment; } -void DeformTimeline::setAttachment(VertexAttachment *inValue) { - _attachment = inValue; +void DeformTimeline::setAttachment(VertexAttachment &inValue) { + _attachment = &inValue; } diff --git a/spine-cpp/src/spine/EventTimeline.cpp b/spine-cpp/src/spine/EventTimeline.cpp index c5ba0388c..f584ec772 100644 --- a/spine-cpp/src/spine/EventTimeline.cpp +++ b/spine-cpp/src/spine/EventTimeline.cpp @@ -90,9 +90,9 @@ void EventTimeline::apply(Skeleton &skeleton, float lastTime, float time, Array< for (; (size_t) i < frameCount && time >= _frames[i]; i++) events.add(_events[i]); } -void EventTimeline::setFrame(size_t frame, Event *event) { - _frames[frame] = event->getTime(); - _events[frame] = event; +void EventTimeline::setFrame(size_t frame, Event &event) { + _frames[frame] = event.getTime(); + _events[frame] = &event; } size_t EventTimeline::getFrameCount() { diff --git a/spine-cpp/src/spine/IkConstraint.cpp b/spine-cpp/src/spine/IkConstraint.cpp index f0f5cfa24..5a51de4c2 100644 --- a/spine-cpp/src/spine/IkConstraint.cpp +++ b/spine-cpp/src/spine/IkConstraint.cpp @@ -51,10 +51,10 @@ IkConstraint::IkConstraint(IkConstraintData &data, Skeleton &skeleton) } } -IkConstraint *IkConstraint::copy(Skeleton &skeleton) { +IkConstraint &IkConstraint::copy(Skeleton &skeleton) { IkConstraint *copy = new (__FILE__, __LINE__) IkConstraint(_data, skeleton); copy->_pose.set(_pose); - return copy; + return *copy; } void IkConstraint::update(Skeleton &skeleton, Physics physics) { @@ -91,12 +91,12 @@ Array &IkConstraint::getBones() { return _bones; } -Bone *IkConstraint::getTarget() { - return _target; +Bone &IkConstraint::getTarget() { + return *_target; } -void IkConstraint::setTarget(Bone *target) { - _target = target; +void IkConstraint::setTarget(Bone &target) { + _target = ⌖ } bool IkConstraint::isSourceActive() { diff --git a/spine-cpp/src/spine/IkConstraintData.cpp b/spine-cpp/src/spine/IkConstraintData.cpp index 34a0d44c0..2810dd6fe 100644 --- a/spine-cpp/src/spine/IkConstraintData.cpp +++ b/spine-cpp/src/spine/IkConstraintData.cpp @@ -43,12 +43,12 @@ Array &IkConstraintData::getBones() { return _bones; } -BoneData *IkConstraintData::getTarget() { - return _target; +BoneData &IkConstraintData::getTarget() { + return *_target; } -void IkConstraintData::setTarget(BoneData *inValue) { - _target = inValue; +void IkConstraintData::setTarget(BoneData &inValue) { + _target = &inValue; } bool IkConstraintData::getUniform() { @@ -59,6 +59,6 @@ void IkConstraintData::setUniform(bool uniform) { _uniform = uniform; } -Constraint *IkConstraintData::create(Skeleton &skeleton) { - return new (__FILE__, __LINE__) IkConstraint(*this, skeleton); +Constraint &IkConstraintData::create(Skeleton &skeleton) { + return *(new (__FILE__, __LINE__) IkConstraint(*this, skeleton)); } \ No newline at end of file diff --git a/spine-cpp/src/spine/MeshAttachment.cpp b/spine-cpp/src/spine/MeshAttachment.cpp index 4c17a6c6a..6d6a84a95 100644 --- a/spine-cpp/src/spine/MeshAttachment.cpp +++ b/spine-cpp/src/spine/MeshAttachment.cpp @@ -157,8 +157,8 @@ TextureRegion *MeshAttachment::getRegion() { return _region; } -void MeshAttachment::setRegion(TextureRegion *region) { - _region = region; +void MeshAttachment::setRegion(TextureRegion ®ion) { + _region = ®ion; } Sequence *MeshAttachment::getSequence() { @@ -216,16 +216,16 @@ Color &MeshAttachment::getColor() { return _color; } -Attachment *MeshAttachment::copy() { +Attachment &MeshAttachment::copy() { if (_parentMesh) return newLinkedMesh(); MeshAttachment *copy = new (__FILE__, __LINE__) MeshAttachment(getName()); - copy->setRegion(_region); - copy->setSequence(_sequence != NULL ? _sequence->copy() : NULL); + copy->setRegion(*_region); + copy->setSequence(_sequence != NULL ? &_sequence->copy() : NULL); copy->_path = _path; copy->_color.set(_color); - copyTo(copy); + copyTo(*copy); copy->_regionUVs.clearAndAddAll(_regionUVs); copy->_uvs.clearAndAddAll(_uvs); copy->_triangles.clearAndAddAll(_triangles); @@ -235,18 +235,18 @@ Attachment *MeshAttachment::copy() { copy->_edges.clearAndAddAll(_edges); copy->_width = _width; copy->_height = _height; - return copy; + return *copy; } -MeshAttachment *MeshAttachment::newLinkedMesh() { +MeshAttachment &MeshAttachment::newLinkedMesh() { MeshAttachment *copy = new (__FILE__, __LINE__) MeshAttachment(getName()); - copy->setRegion(_region); + copy->setRegion(*_region); copy->_path = _path; copy->_color.set(_color); copy->_timelineAttachment = this->_timelineAttachment; copy->setParentMesh(_parentMesh ? _parentMesh : this); if (copy->_region) copy->updateRegion(); - return copy; + return *copy; } void MeshAttachment::computeWorldVertices(Skeleton &skeleton, Slot &slot, size_t start, size_t count, float *worldVertices, size_t offset, diff --git a/spine-cpp/src/spine/PathAttachment.cpp b/spine-cpp/src/spine/PathAttachment.cpp index 7ccde21b9..76d9804cc 100644 --- a/spine-cpp/src/spine/PathAttachment.cpp +++ b/spine-cpp/src/spine/PathAttachment.cpp @@ -64,11 +64,11 @@ Color &PathAttachment::getColor() { return _color; } -Attachment *PathAttachment::copy() { +Attachment &PathAttachment::copy() { PathAttachment *copy = new (__FILE__, __LINE__) PathAttachment(getName()); - copyTo(copy); + copyTo(*copy); copy->_lengths.clearAndAddAll(_lengths); copy->_closed = _closed; copy->_constantSpeed = _constantSpeed; - return copy; + return *copy; } diff --git a/spine-cpp/src/spine/PathConstraint.cpp b/spine-cpp/src/spine/PathConstraint.cpp index 998881099..339a6508c 100644 --- a/spine-cpp/src/spine/PathConstraint.cpp +++ b/spine-cpp/src/spine/PathConstraint.cpp @@ -64,10 +64,10 @@ PathConstraint::PathConstraint(PathConstraintData &data, Skeleton &skeleton) _segments.setSize(10, 0); } -PathConstraint *PathConstraint::copy(Skeleton &skeleton) { +PathConstraint &PathConstraint::copy(Skeleton &skeleton) { PathConstraint *copy = new (__FILE__, __LINE__) PathConstraint(_data, skeleton); copy->_pose.set(_pose); - return copy; + return *copy; } void PathConstraint::update(Skeleton &skeleton, Physics physics) { @@ -217,8 +217,8 @@ void PathConstraint::sort(Skeleton &skeleton) { int slotIndex = _slot->getData().getIndex(); Bone &slotBone = _slot->getBone(); if (skeleton.getSkin() != NULL) sortPathSlot(skeleton, *skeleton.getSkin(), slotIndex, slotBone); - if (skeleton.getData()->getDefaultSkin() != NULL && skeleton.getData()->getDefaultSkin() != skeleton.getSkin()) - sortPathSlot(skeleton, *skeleton.getData()->getDefaultSkin(), slotIndex, slotBone); + if (skeleton.getData().getDefaultSkin() != NULL && skeleton.getData().getDefaultSkin() != skeleton.getSkin()) + sortPathSlot(skeleton, *skeleton.getData().getDefaultSkin(), slotIndex, slotBone); sortPath(skeleton, _slot->_pose._attachment, slotBone); BonePose **bones = _bones.buffer(); size_t boneCount = _bones.size(); @@ -244,12 +244,12 @@ Array &PathConstraint::getBones() { return _bones; } -Slot *PathConstraint::getSlot() { - return _slot; +Slot &PathConstraint::getSlot() { + return *_slot; } -void PathConstraint::setSlot(Slot *slot) { - _slot = slot; +void PathConstraint::setSlot(Slot &slot) { + _slot = &slot; } Array &PathConstraint::computeWorldPositions(Skeleton &skeleton, PathAttachment &path, int spacesCount, bool tangents) { diff --git a/spine-cpp/src/spine/PathConstraintData.cpp b/spine-cpp/src/spine/PathConstraintData.cpp index 94d85821a..6dfb444ab 100644 --- a/spine-cpp/src/spine/PathConstraintData.cpp +++ b/spine-cpp/src/spine/PathConstraintData.cpp @@ -47,12 +47,12 @@ Array &PathConstraintData::getBones() { return _bones; } -SlotData *PathConstraintData::getSlot() { - return _slot; +SlotData &PathConstraintData::getSlot() { + return *_slot; } -void PathConstraintData::setSlot(SlotData *slot) { - _slot = slot; +void PathConstraintData::setSlot(SlotData &slot) { + _slot = &slot; } PositionMode PathConstraintData::getPositionMode() { @@ -87,6 +87,6 @@ void PathConstraintData::setOffsetRotation(float offsetRotation) { _offsetRotation = offsetRotation; } -Constraint *PathConstraintData::create(Skeleton &skeleton) { - return new (__FILE__, __LINE__) PathConstraint(*this, skeleton); +Constraint &PathConstraintData::create(Skeleton &skeleton) { + return *(new (__FILE__, __LINE__) PathConstraint(*this, skeleton)); } \ No newline at end of file diff --git a/spine-cpp/src/spine/PhysicsConstraint.cpp b/spine-cpp/src/spine/PhysicsConstraint.cpp index 7f55cf0e3..8531600a3 100644 --- a/spine-cpp/src/spine/PhysicsConstraint.cpp +++ b/spine-cpp/src/spine/PhysicsConstraint.cpp @@ -49,10 +49,10 @@ PhysicsConstraint::PhysicsConstraint(PhysicsConstraintData &data, Skeleton &skel _bone = &skeleton._bones[(size_t) data._bone->getIndex()]->_constrained; } -PhysicsConstraint *PhysicsConstraint::copy(Skeleton &skeleton) { +PhysicsConstraint &PhysicsConstraint::copy(Skeleton &skeleton) { PhysicsConstraint *copy = new (__FILE__, __LINE__) PhysicsConstraint(_data, skeleton); copy->_pose.set(_pose); - return copy; + return *copy; } void PhysicsConstraint::reset(Skeleton &skeleton) { diff --git a/spine-cpp/src/spine/PhysicsConstraintData.cpp b/spine-cpp/src/spine/PhysicsConstraintData.cpp index e35d3e40c..461ab4e07 100644 --- a/spine-cpp/src/spine/PhysicsConstraintData.cpp +++ b/spine-cpp/src/spine/PhysicsConstraintData.cpp @@ -42,12 +42,12 @@ PhysicsConstraintData::PhysicsConstraintData(const String &name) _mixGlobal(false) { } -BoneData *PhysicsConstraintData::getBone() { - return _bone; +BoneData &PhysicsConstraintData::getBone() { + return *_bone; } -void PhysicsConstraintData::setBone(BoneData *bone) { - _bone = bone; +void PhysicsConstraintData::setBone(BoneData &bone) { + _bone = &bone; } float PhysicsConstraintData::getStep() { @@ -162,6 +162,6 @@ void PhysicsConstraintData::setMixGlobal(bool mixGlobal) { _mixGlobal = mixGlobal; } -Constraint *PhysicsConstraintData::create(Skeleton &skeleton) { - return new (__FILE__, __LINE__) PhysicsConstraint(*this, skeleton); +Constraint &PhysicsConstraintData::create(Skeleton &skeleton) { + return *(new (__FILE__, __LINE__) PhysicsConstraint(*this, skeleton)); } \ No newline at end of file diff --git a/spine-cpp/src/spine/PointAttachment.cpp b/spine-cpp/src/spine/PointAttachment.cpp index d37be3cba..1142b863d 100644 --- a/spine-cpp/src/spine/PointAttachment.cpp +++ b/spine-cpp/src/spine/PointAttachment.cpp @@ -80,11 +80,11 @@ float PointAttachment::computeWorldRotation(BonePose &bone) { return MathUtil::atan2Deg(y, x); } -Attachment *PointAttachment::copy() { +Attachment &PointAttachment::copy() { PointAttachment *copy = new (__FILE__, __LINE__) PointAttachment(getName()); copy->_x = _x; copy->_y = _y; copy->_rotation = _rotation; copy->_color.set(_color); - return copy; + return *copy; } diff --git a/spine-cpp/src/spine/RegionAttachment.cpp b/spine-cpp/src/spine/RegionAttachment.cpp index 950c6cfb2..7ee802083 100644 --- a/spine-cpp/src/spine/RegionAttachment.cpp +++ b/spine-cpp/src/spine/RegionAttachment.cpp @@ -242,8 +242,8 @@ TextureRegion *RegionAttachment::getRegion() { return _region; } -void RegionAttachment::setRegion(TextureRegion *region) { - _region = region; +void RegionAttachment::setRegion(TextureRegion ®ion) { + _region = ®ion; } Sequence *RegionAttachment::getSequence() { @@ -266,7 +266,7 @@ Color &RegionAttachment::getColor() { return _color; } -Attachment *RegionAttachment::copy() { +Attachment &RegionAttachment::copy() { RegionAttachment *copy = new (__FILE__, __LINE__) RegionAttachment(getName()); copy->_region = _region; copy->_path = _path; @@ -280,6 +280,6 @@ Attachment *RegionAttachment::copy() { copy->_uvs.clearAndAddAll(_uvs); copy->_offset.clearAndAddAll(_offset); copy->_color.set(_color); - copy->_sequence = _sequence != NULL ? _sequence->copy() : NULL; - return copy; + copy->_sequence = _sequence != NULL ? &_sequence->copy() : NULL; + return *copy; } diff --git a/spine-cpp/src/spine/Sequence.cpp b/spine-cpp/src/spine/Sequence.cpp index c7cd7473d..0900f80b3 100644 --- a/spine-cpp/src/spine/Sequence.cpp +++ b/spine-cpp/src/spine/Sequence.cpp @@ -45,7 +45,7 @@ Sequence::Sequence(int count) : _id(nextID()), _regions(), _start(0), _digits(0) Sequence::~Sequence() { } -Sequence *Sequence::copy() { +Sequence &Sequence::copy() { Sequence *copy = new (__FILE__, __LINE__) Sequence((int) _regions.size()); for (size_t i = 0; i < _regions.size(); i++) { copy->_regions[i] = _regions[i]; @@ -53,7 +53,7 @@ Sequence *Sequence::copy() { copy->_start = _start; copy->_digits = _digits; copy->_setupIndex = _setupIndex; - return copy; + return *copy; } void Sequence::apply(SlotPose *slot, Attachment *attachment) { @@ -65,7 +65,7 @@ void Sequence::apply(SlotPose *slot, Attachment *attachment) { if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) { RegionAttachment *regionAttachment = static_cast(attachment); if (regionAttachment->getRegion() != region) { - regionAttachment->setRegion(region); + regionAttachment->setRegion(*region); regionAttachment->updateRegion(); } } @@ -73,7 +73,7 @@ void Sequence::apply(SlotPose *slot, Attachment *attachment) { if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) { MeshAttachment *meshAttachment = static_cast(attachment); if (meshAttachment->getRegion() != region) { - meshAttachment->setRegion(region); + meshAttachment->setRegion(*region); meshAttachment->updateRegion(); } } diff --git a/spine-cpp/src/spine/Skeleton.cpp b/spine-cpp/src/spine/Skeleton.cpp index 4de6004dd..6c9ecf401 100644 --- a/spine-cpp/src/spine/Skeleton.cpp +++ b/spine-cpp/src/spine/Skeleton.cpp @@ -92,7 +92,7 @@ Skeleton::Skeleton(SkeletonData &skeletonData) _constraints.ensureCapacity(_data.getConstraints().size()); for (size_t i = 0; i < _data.getConstraints().size(); ++i) { ConstraintData *constraintData = _data.getConstraints()[i]; - Constraint *constraint = constraintData->create(*this); + Constraint *constraint = &constraintData->create(*this); if (constraint->getRTTI().instanceOf(PhysicsConstraint::rtti)) { _physics.add(static_cast(constraint)); } @@ -224,40 +224,6 @@ void Skeleton::updateWorldTransform(Physics physics) { } } -void Skeleton::updateWorldTransform(Physics physics, BonePose *parent) { - if (parent == NULL) return; - - _update++; - - Posed **resetCache = _resetCache.buffer(); - for (size_t i = 0, n = _resetCache.size(); i < n; i++) { - resetCache[i]->resetConstrained(); - } - - // Apply the parent bone transform to the root bone. The root bone always inherits scale, rotation and reflection. - BonePose *rootBone = getRootBone()->_applied; - float pa = parent->_a, pb = parent->_b, pc = parent->_c, pd = parent->_d; - rootBone->_worldX = pa * _x + pb * _y + parent->_worldX; - rootBone->_worldY = pc * _x + pd * _y + parent->_worldY; - - float rx = (rootBone->_rotation + rootBone->_shearX) * MathUtil::Deg_Rad; - float ry = (rootBone->_rotation + 90 + rootBone->_shearY) * MathUtil::Deg_Rad; - float la = MathUtil::cos(rx) * rootBone->_scaleX; - float lb = MathUtil::cos(ry) * rootBone->_scaleY; - float lc = MathUtil::sin(rx) * rootBone->_scaleX; - float ld = MathUtil::sin(ry) * rootBone->_scaleY; - rootBone->_a = (pa * la + pb * lc) * _scaleX; - rootBone->_b = (pa * lb + pb * ld) * _scaleX; - rootBone->_c = (pc * la + pd * lc) * _scaleY; - rootBone->_d = (pc * lb + pd * ld) * _scaleY; - - // Update everything except root bone. - Update **updateCache = _updateCache.buffer(); - for (size_t i = 0, n = _updateCache.size(); i < n; i++) { - Update *updatable = updateCache[i]; - if (updatable != rootBone) updatable->update(*this, physics); - } -} void Skeleton::setupPose() { setupPoseBones(); @@ -290,8 +256,8 @@ void Skeleton::setupPoseSlots() { } } -SkeletonData *Skeleton::getData() { - return &_data; +SkeletonData &Skeleton::getData() { + return _data; } Array &Skeleton::getBones() { diff --git a/spine-cpp/src/spine/SkeletonBinary.cpp b/spine-cpp/src/spine/SkeletonBinary.cpp index 4ebc2ca09..fe51414f7 100644 --- a/spine-cpp/src/spine/SkeletonBinary.cpp +++ b/spine-cpp/src/spine/SkeletonBinary.cpp @@ -513,7 +513,7 @@ SkeletonData *SkeletonBinary::readSkeletonData(const unsigned char *binary, cons for (int i = 0; i < constraintCount; i++) { if (constraints[i]->getRTTI().instanceOf(SliderData::rtti)) { SliderData *data = static_cast(constraints[i]); - data->setAnimation(animations[input.readInt(true)]); + data->setAnimation(*animations[input.readInt(true)]); } } } @@ -560,7 +560,7 @@ Skin *SkeletonBinary::readSkin(DataInput &input, SkeletonData &skeletonData, boo String name(input.readStringRef()); Attachment *attachment = readAttachment(input, *skin, slotIndex, name, skeletonData, nonessential); if (attachment) - skin->setAttachment(slotIndex, name, attachment); + skin->setAttachment(slotIndex, name, *attachment); else { setError("Error reading attachment: ", name.buffer()); delete skin; @@ -1352,7 +1352,7 @@ Animation *SkeletonBinary::readAnimation(DataInput &input, const String &name, S event->_volume = input.readFloat(); event->_balance = input.readFloat(); } - timeline->setFrame(i, event); + timeline->setFrame(i, *event); } timelines.add(timeline); } diff --git a/spine-cpp/src/spine/SkeletonBounds.cpp b/spine-cpp/src/spine/SkeletonBounds.cpp index a4e633f23..738b05e08 100644 --- a/spine-cpp/src/spine/SkeletonBounds.cpp +++ b/spine-cpp/src/spine/SkeletonBounds.cpp @@ -120,9 +120,9 @@ bool SkeletonBounds::aabbIntersectsSkeleton(SkeletonBounds &bounds) { return _minX < bounds._maxX && _maxX > bounds._minX && _minY < bounds._maxY && _maxY > bounds._minY; } -bool SkeletonBounds::containsPoint(Polygon *polygon, float x, float y) { - Array &vertices = polygon->_vertices; - int nn = polygon->_count; +bool SkeletonBounds::containsPoint(Polygon &polygon, float x, float y) { + Array &vertices = polygon._vertices; + int nn = polygon._count; int prevIndex = nn - 2; bool inside = false; @@ -142,19 +142,19 @@ bool SkeletonBounds::containsPoint(Polygon *polygon, float x, float y) { BoundingBoxAttachment *SkeletonBounds::containsPoint(float x, float y) { for (size_t i = 0, n = _polygons.size(); i < n; ++i) - if (containsPoint(_polygons[i], x, y)) return _boundingBoxes[i]; + if (containsPoint(*_polygons[i], x, y)) return _boundingBoxes[i]; return NULL; } BoundingBoxAttachment *SkeletonBounds::intersectsSegment(float x1, float y1, float x2, float y2) { for (size_t i = 0, n = _polygons.size(); i < n; ++i) - if (intersectsSegment(_polygons[i], x1, y1, x2, y2)) return _boundingBoxes[i]; + if (intersectsSegment(*_polygons[i], x1, y1, x2, y2)) return _boundingBoxes[i]; return NULL; } -bool SkeletonBounds::intersectsSegment(Polygon *polygon, float x1, float y1, float x2, float y2) { - Array &vertices = polygon->_vertices; - size_t nn = polygon->_count; +bool SkeletonBounds::intersectsSegment(Polygon &polygon, float x1, float y1, float x2, float y2) { + Array &vertices = polygon._vertices; + size_t nn = polygon._count; float width12 = x1 - x2, height12 = y1 - y2; float det1 = x1 * y2 - y1 * x2; diff --git a/spine-cpp/src/spine/SkeletonJson.cpp b/spine-cpp/src/spine/SkeletonJson.cpp index cd6a6a63a..a77edb294 100644 --- a/spine-cpp/src/spine/SkeletonJson.cpp +++ b/spine-cpp/src/spine/SkeletonJson.cpp @@ -538,7 +538,7 @@ SkeletonData *SkeletonJson::readSkeletonData(const char *json) { for (Json *entry = slotEntry->_child; entry; entry = entry->_next) { Attachment *attachment = readAttachment(entry, skin, slot->getIndex(), entry->_name, skeletonData); if (attachment) - skin->setAttachment(slot->getIndex(), entry->_name, attachment); + skin->setAttachment(slot->getIndex(), entry->_name, *attachment); else SKELETON_JSON_ERROR(root, "Error reading attachment: ", entry->_name); } @@ -1378,7 +1378,7 @@ Animation *SkeletonJson::readAnimation(Json *map, SkeletonData *skeletonData) { event->_volume = Json::getFloat(keyMap, "volume", eventData->_volume); event->_balance = Json::getFloat(keyMap, "balance", eventData->_balance); } - timeline->setFrame(frame, event); + timeline->setFrame(frame, *event); } timelines.add(timeline); } diff --git a/spine-cpp/src/spine/Skin.cpp b/spine-cpp/src/spine/Skin.cpp index f789196c5..df7f23744 100644 --- a/spine-cpp/src/spine/Skin.cpp +++ b/spine-cpp/src/spine/Skin.cpp @@ -99,9 +99,8 @@ Skin::~Skin() { } } -void Skin::setAttachment(size_t slotIndex, const String &name, Attachment *attachment) { - assert(attachment); - _attachments.put(slotIndex, name, attachment); +void Skin::setAttachment(size_t slotIndex, const String &name, Attachment &attachment) { + _attachments.put(slotIndex, name, &attachment); } Attachment *Skin::getAttachment(size_t slotIndex, const String &name) { @@ -153,28 +152,28 @@ void Skin::attachAll(Skeleton &skeleton, Skin &oldSkin) { } } -void Skin::addSkin(Skin *other) { - for (size_t i = 0; i < other->getBones().size(); i++) - if (!_bones.contains(other->getBones()[i])) _bones.add(other->getBones()[i]); +void Skin::addSkin(Skin &other) { + for (size_t i = 0; i < other.getBones().size(); i++) + if (!_bones.contains(other.getBones()[i])) _bones.add(other.getBones()[i]); - for (size_t i = 0; i < other->getConstraints().size(); i++) - if (!_constraints.contains(other->getConstraints()[i])) _constraints.add(other->getConstraints()[i]); + for (size_t i = 0; i < other.getConstraints().size(); i++) + if (!_constraints.contains(other.getConstraints()[i])) _constraints.add(other.getConstraints()[i]); - AttachmentMap::Entries entries = other->getAttachments(); + AttachmentMap::Entries entries = other.getAttachments(); while (entries.hasNext()) { AttachmentMap::Entry &entry = entries.next(); - setAttachment(entry._slotIndex, entry._name, entry._attachment); + setAttachment(entry._slotIndex, entry._name, *entry._attachment); } } -void Skin::copySkin(Skin *other) { - for (size_t i = 0; i < other->getBones().size(); i++) - if (!_bones.contains(other->getBones()[i])) _bones.add(other->getBones()[i]); +void Skin::copySkin(Skin &other) { + for (size_t i = 0; i < other.getBones().size(); i++) + if (!_bones.contains(other.getBones()[i])) _bones.add(other.getBones()[i]); - for (size_t i = 0; i < other->getConstraints().size(); i++) - if (!_constraints.contains(other->getConstraints()[i])) _constraints.add(other->getConstraints()[i]); + for (size_t i = 0; i < other.getConstraints().size(); i++) + if (!_constraints.contains(other.getConstraints()[i])) _constraints.add(other.getConstraints()[i]); - AttachmentMap::Entries entries = other->getAttachments(); + AttachmentMap::Entries entries = other.getAttachments(); while (entries.hasNext()) { AttachmentMap::Entry &entry = entries.next(); if (entry._attachment->getRTTI().isExactly(MeshAttachment::rtti)) diff --git a/spine-cpp/src/spine/Slider.cpp b/spine-cpp/src/spine/Slider.cpp index b2b7b3f7e..6cdfa9268 100644 --- a/spine-cpp/src/spine/Slider.cpp +++ b/spine-cpp/src/spine/Slider.cpp @@ -56,10 +56,10 @@ Slider::Slider(SliderData &data, Skeleton &skeleton) : ConstraintGeneric_pose.set(_pose); - return copy; + return *copy; } void Slider::update(Skeleton &skeleton, Physics physics) { @@ -126,10 +126,10 @@ bool Slider::isSourceActive() { return _bone == NULL || _bone->isActive(); } -Bone *Slider::getBone() { - return _bone; +Bone &Slider::getBone() { + return *_bone; } -void Slider::setBone(Bone *bone) { - _bone = bone; +void Slider::setBone(Bone &bone) { + _bone = &bone; } \ No newline at end of file diff --git a/spine-cpp/src/spine/SliderData.cpp b/spine-cpp/src/spine/SliderData.cpp index 1b6e0500e..441040296 100644 --- a/spine-cpp/src/spine/SliderData.cpp +++ b/spine-cpp/src/spine/SliderData.cpp @@ -40,16 +40,16 @@ SliderData::SliderData(const String &name) _scale(0.0f), _local(false) { } -Constraint *SliderData::create(Skeleton &skeleton) { - return new (__FILE__, __LINE__) Slider(*this, skeleton); +Constraint &SliderData::create(Skeleton &skeleton) { + return *(new (__FILE__, __LINE__) Slider(*this, skeleton)); } -Animation *SliderData::getAnimation() { - return _animation; +Animation &SliderData::getAnimation() { + return *_animation; } -void SliderData::setAnimation(Animation *animation) { - _animation = animation; +void SliderData::setAnimation(Animation &animation) { + _animation = &animation; } bool SliderData::getAdditive() { diff --git a/spine-cpp/src/spine/TransformConstraint.cpp b/spine-cpp/src/spine/TransformConstraint.cpp index 3d329347f..ecb724c74 100644 --- a/spine-cpp/src/spine/TransformConstraint.cpp +++ b/spine-cpp/src/spine/TransformConstraint.cpp @@ -53,10 +53,10 @@ TransformConstraint::TransformConstraint(TransformConstraintData &data, Skeleton _source = skeleton._bones[data._source->getIndex()]; } -TransformConstraint *TransformConstraint::copy(Skeleton &skeleton) { +TransformConstraint &TransformConstraint::copy(Skeleton &skeleton) { TransformConstraint *copy = new (__FILE__, __LINE__) TransformConstraint(_data, skeleton); copy->_pose.set(_pose); - return copy; + return *copy; } /// Applies the constraint to the constrained bones. @@ -131,10 +131,10 @@ Array &TransformConstraint::getBones() { } /// The bone whose world transform will be copied to the constrained bones. -Bone *TransformConstraint::getSource() { - return _source; +Bone &TransformConstraint::getSource() { + return *_source; } -void TransformConstraint::setSource(Bone *source) { - _source = source; +void TransformConstraint::setSource(Bone &source) { + _source = &source; } \ No newline at end of file diff --git a/spine-cpp/src/spine/TransformConstraintData.cpp b/spine-cpp/src/spine/TransformConstraintData.cpp index 9aacefecf..d0d96e78d 100644 --- a/spine-cpp/src/spine/TransformConstraintData.cpp +++ b/spine-cpp/src/spine/TransformConstraintData.cpp @@ -66,12 +66,12 @@ Array &TransformConstraintData::getBones() { return _bones; } -BoneData *TransformConstraintData::getSource() { - return _source; +BoneData &TransformConstraintData::getSource() { + return *_source; } -void TransformConstraintData::setSource(BoneData *source) { - _source = source; +void TransformConstraintData::setSource(BoneData &source) { + _source = &source; } float TransformConstraintData::getOffsetRotation() { @@ -350,6 +350,6 @@ TransformConstraintData::~TransformConstraintData() { _properties.clear(); } -Constraint *TransformConstraintData::create(Skeleton &skeleton) { - return new (__FILE__, __LINE__) TransformConstraint(*this, skeleton); +Constraint &TransformConstraintData::create(Skeleton &skeleton) { + return *(new (__FILE__, __LINE__) TransformConstraint(*this, skeleton)); } \ No newline at end of file diff --git a/spine-cpp/src/spine/VertexAttachment.cpp b/spine-cpp/src/spine/VertexAttachment.cpp index 4469259ea..43d6326ff 100644 --- a/spine-cpp/src/spine/VertexAttachment.cpp +++ b/spine-cpp/src/spine/VertexAttachment.cpp @@ -158,9 +158,9 @@ int VertexAttachment::getNextID() { return nextID++; } -void VertexAttachment::copyTo(VertexAttachment *other) { - other->_bones.clearAndAddAll(this->_bones); - other->_vertices.clearAndAddAll(this->_vertices); - other->_worldVerticesLength = this->_worldVerticesLength; - other->_timelineAttachment = this->_timelineAttachment; +void VertexAttachment::copyTo(VertexAttachment &other) { + other._bones.clearAndAddAll(this->_bones); + other._vertices.clearAndAddAll(this->_vertices); + other._worldVerticesLength = this->_worldVerticesLength; + other._timelineAttachment = this->_timelineAttachment; } diff --git a/spine-cpp/tests/SkeletonSerializer.h b/spine-cpp/tests/SkeletonSerializer.h index 5dfc539bb..9d021c029 100644 --- a/spine-cpp/tests/SkeletonSerializer.h +++ b/spine-cpp/tests/SkeletonSerializer.h @@ -4666,6 +4666,39 @@ namespace spine { void writeTransformConstraintPose(const TransformConstraintPose &obj) { writeTransformConstraintPose(const_cast(&obj)); } + + // Reference versions of abstract type write methods + void writeTimeline(const Timeline &obj) { + writeTimeline(const_cast(&obj)); + } + + void writeAttachment(const Attachment &obj) { + writeAttachment(const_cast(&obj)); + } + + void writeConstraint(const Constraint &obj) { + writeConstraint(const_cast(&obj)); + } + + void writeConstraintData(const ConstraintData &obj) { + writeConstraintData(const_cast(&obj)); + } + + void writeFromProperty(const FromProperty &obj) { + writeFromProperty(const_cast(&obj)); + } + + void writeToProperty(const ToProperty &obj) { + writeToProperty(const_cast(&obj)); + } + + void writeUpdate(const Update &obj) { + writeUpdate(const_cast(&obj)); + } + + void writeVertexAttachment(const VertexAttachment &obj) { + writeVertexAttachment(const_cast(&obj)); + } }; }// namespace spine diff --git a/spine-flutter/lib/generated/skeleton.dart b/spine-flutter/lib/generated/skeleton.dart index 2a6af9f15..2be734f82 100644 --- a/spine-flutter/lib/generated/skeleton.dart +++ b/spine-flutter/lib/generated/skeleton.dart @@ -36,7 +36,6 @@ import '../spine_bindings.dart'; import 'arrays.dart'; import 'attachment.dart'; import 'bone.dart'; -import 'bone_pose.dart'; import 'bounding_box_attachment.dart'; import 'clipping_attachment.dart'; import 'color.dart'; @@ -88,6 +87,10 @@ class Skeleton { SpineBindings.bindings.spine_skeleton_sort_reset(bones.nativePtr.cast()); } + void updateWorldTransform(Physics physics) { + SpineBindings.bindings.spine_skeleton_update_world_transform(_ptr, physics.value); + } + void setupPose() { SpineBindings.bindings.spine_skeleton_setup_pose(_ptr); } @@ -266,14 +269,6 @@ class Skeleton { SpineBindings.bindings.spine_skeleton_update(_ptr, delta); } - void updateWorldTransform(Physics physics) { - SpineBindings.bindings.spine_skeleton_update_world_transform_1(_ptr, physics.value); - } - - void updateWorldTransform2(Physics physics, BonePose parent) { - SpineBindings.bindings.spine_skeleton_update_world_transform_2(_ptr, physics.value, parent.nativePtr.cast()); - } - void setSkin(String skinName) { SpineBindings.bindings.spine_skeleton_set_skin_1(_ptr, skinName.toNativeUtf8().cast()); } diff --git a/spine-flutter/lib/generated/spine_dart_bindings_generated.dart b/spine-flutter/lib/generated/spine_dart_bindings_generated.dart index ebb887325..e5b8f1cc1 100644 --- a/spine-flutter/lib/generated/spine_dart_bindings_generated.dart +++ b/spine-flutter/lib/generated/spine_dart_bindings_generated.dart @@ -31140,39 +31140,21 @@ class SpineDartBindings { _lookup>('spine_skeleton_sort_reset'); late final _spine_skeleton_sort_reset = _spine_skeleton_sort_resetPtr.asFunction(); - void spine_skeleton_update_world_transform_1( + void spine_skeleton_update_world_transform( spine_skeleton self, int physics, ) { - return _spine_skeleton_update_world_transform_1( + return _spine_skeleton_update_world_transform( self, physics, ); } - late final _spine_skeleton_update_world_transform_1Ptr = + late final _spine_skeleton_update_world_transformPtr = _lookup>( - 'spine_skeleton_update_world_transform_1'); - late final _spine_skeleton_update_world_transform_1 = - _spine_skeleton_update_world_transform_1Ptr.asFunction(); - - void spine_skeleton_update_world_transform_2( - spine_skeleton self, - int physics, - spine_bone_pose parent, - ) { - return _spine_skeleton_update_world_transform_2( - self, - physics, - parent, - ); - } - - late final _spine_skeleton_update_world_transform_2Ptr = - _lookup>( - 'spine_skeleton_update_world_transform_2'); - late final _spine_skeleton_update_world_transform_2 = - _spine_skeleton_update_world_transform_2Ptr.asFunction(); + 'spine_skeleton_update_world_transform'); + late final _spine_skeleton_update_world_transform = + _spine_skeleton_update_world_transformPtr.asFunction(); void spine_skeleton_setup_pose( spine_skeleton self, diff --git a/spine-flutter/lib/spine_flutter.dart b/spine-flutter/lib/spine_flutter.dart index f202f26cc..0d21a46cf 100644 --- a/spine-flutter/lib/spine_flutter.dart +++ b/spine-flutter/lib/spine_flutter.dart @@ -4,4 +4,4 @@ import 'spine_dart.dart'; Future initSpineFlutter({bool useStaticLinkage = false, bool enableMemoryDebugging = false}) async { await initSpineDart(useStaticLinkage: useStaticLinkage, enableMemoryDebugging: enableMemoryDebugging); return; -} \ No newline at end of file +} diff --git a/spine-glfw/build.sh b/spine-glfw/build.sh new file mode 100755 index 000000000..dd3d48cff --- /dev/null +++ b/spine-glfw/build.sh @@ -0,0 +1,60 @@ +#!/bin/bash +set -e + +cd "$(dirname "$0")" + +# Source logging utilities +source ../formatters/logging/logging.sh + +# Parse arguments +BUILD_TYPE="debug" +CLEAN="" + +for arg in "$@"; do + case $arg in + clean) + CLEAN="true" + ;; + release) + BUILD_TYPE="release" + ;; + debug) + BUILD_TYPE="debug" + ;; + *) + log_fail "Unknown argument: $arg" + log_detail "Usage: $0 [clean] [release|debug]" + exit 1 + ;; + esac +done + +log_title "spine-glfw build" + +# Clean if requested +if [ "$CLEAN" = "true" ]; then + log_action "Cleaning build directory" + rm -rf build + log_ok +fi + +# Configure and build +log_action "Configuring $BUILD_TYPE build" +if CMAKE_OUTPUT=$(cmake --preset=$BUILD_TYPE . 2>&1); then + log_ok +else + log_fail + log_error_output "$CMAKE_OUTPUT" + exit 1 +fi + +log_action "Building" +if BUILD_OUTPUT=$(cmake --build --preset=$BUILD_TYPE 2>&1); then + log_ok +else + log_fail + log_error_output "$BUILD_OUTPUT" + exit 1 +fi + +log_summary "✓ Build successful" \ No newline at end of file diff --git a/spine-glfw/example/main-c.cpp b/spine-glfw/example/main-c.cpp index 00eb7665a..5ea3fd309 100644 --- a/spine-glfw/example/main-c.cpp +++ b/spine-glfw/example/main-c.cpp @@ -137,7 +137,7 @@ int main() { spine_skeleton_update(skeleton, delta); // Calculate the new pose - spine_skeleton_update_world_transform_1(skeleton, SPINE_PHYSICS_UPDATE); + spine_skeleton_update_world_transform(skeleton, SPINE_PHYSICS_UPDATE); // Clear the screen gl::glClear(gl::GL_COLOR_BUFFER_BIT);