[c] References for non-nullable arguments and return types, pointers for nullable args and return types

This commit is contained in:
Mario Zechner 2025-07-25 20:21:39 +02:00
parent 3d244f308e
commit 861eac1c1b
93 changed files with 404 additions and 383 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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,

View File

@ -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) {

View File

@ -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,

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -35,16 +35,11 @@ void spine_skeleton_sort_reset(spine_array_bone bones) {
Skeleton::sortReset(*((Array<Bone *> *) 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) {

View File

@ -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);

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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 <a href='https://esotericsoftware.com/spine-applying-animations/#Empty-animations'>Empty animations</a> 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.
///

View File

@ -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();

View File

@ -45,7 +45,7 @@ namespace spine {
const String &getName() const;
virtual Attachment *copy() = 0;
virtual Attachment &copy() = 0;
int getRefCount();

View File

@ -44,7 +44,7 @@ namespace spine {
Color &getColor();
virtual Attachment *copy() override;
virtual Attachment &copy() override;
private:
Color _color;

View File

@ -54,7 +54,7 @@ namespace spine {
Color &getColor();
virtual Attachment *copy() override;
virtual Attachment &copy() override;
private:
SlotData *_endSlot;

View File

@ -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 {

View File

@ -53,9 +53,9 @@ namespace spine {
Array<Array<float>> &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;

View File

@ -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<Event *> _events;

View File

@ -51,7 +51,7 @@ namespace spine {
public:
IkConstraint(IkConstraintData &data, Skeleton &skeleton);
virtual IkConstraint *copy(Skeleton &skeleton);
virtual IkConstraint &copy(Skeleton &skeleton);
virtual void update(Skeleton &skeleton, Physics physics) override;
@ -63,9 +63,9 @@ namespace spine {
Array<BonePose *> &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.

View File

@ -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<BoneData *> &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();

View File

@ -83,7 +83,7 @@ namespace spine {
TextureRegion *getRegion();
void setRegion(TextureRegion *region);
void setRegion(TextureRegion &region);
Sequence *getSequence();
@ -106,9 +106,9 @@ namespace spine {
void setHeight(float inValue);
virtual Attachment *copy() override;
virtual Attachment &copy() override;
MeshAttachment *newLinkedMesh();
MeshAttachment &newLinkedMesh();
private:
TextureRegion *_region;

View File

@ -59,7 +59,7 @@ namespace spine {
Color &getColor();
virtual Attachment *copy() override;
virtual Attachment &copy() override;
private:
Array<float> _lengths;

View File

@ -64,7 +64,7 @@ namespace spine {
PathConstraint(PathConstraintData &data, Skeleton &skeleton);
PathConstraint *copy(Skeleton &skeleton);
PathConstraint &copy(Skeleton &skeleton);
/// Applies the constraint to the constrained bones.
virtual void update(Skeleton &skeleton, Physics physics) override;
@ -77,9 +77,9 @@ namespace spine {
Array<BonePose *> &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;

View File

@ -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<BoneData *> &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();

View File

@ -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 &copy(Skeleton &skeleton);
void reset(Skeleton &skeleton);

View File

@ -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);

View File

@ -71,7 +71,7 @@ namespace spine {
float computeWorldRotation(BonePose &bone);
virtual Attachment *copy() override;
virtual Attachment &copy() override;
private:
float _x, _y, _rotation;

View File

@ -104,7 +104,7 @@ namespace spine {
TextureRegion *getRegion();
void setRegion(TextureRegion *region);
void setRegion(TextureRegion &region);
Sequence *getSequence();
@ -114,7 +114,7 @@ namespace spine {
Array<float> &getUVs();
virtual Attachment *copy() override;
virtual Attachment &copy() override;
private:
static const int BLX;

View File

@ -51,7 +51,7 @@ namespace spine {
~Sequence();
Sequence *copy();
Sequence &copy();
void apply(SlotPose *slot, Attachment *attachment);

View File

@ -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;

View File

@ -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<Bone *> &getBones();

View File

@ -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.

View File

@ -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();

View File

@ -52,7 +52,7 @@ namespace spine {
public:
Slider(SliderData &data, Skeleton &skeleton);
Slider *copy(Skeleton &skeleton);
Slider &copy(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;

View File

@ -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);

View File

@ -49,7 +49,7 @@ namespace spine {
public:
TransformConstraint(TransformConstraintData &data, Skeleton &skeleton);
virtual TransformConstraint *copy(Skeleton &skeleton);
virtual TransformConstraint &copy(Skeleton &skeleton);
/// Applies the constraint to the constrained bones.
void update(Skeleton &skeleton, Physics physics) override;
@ -62,9 +62,9 @@ namespace spine {
Array<BonePose *> &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<BonePose *> _bones;

View File

@ -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<BoneData *> &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();

View File

@ -90,7 +90,7 @@ namespace spine {
void setTimelineAttachment(Attachment *attachment);
void copyTo(VertexAttachment *other);
void copyTo(VertexAttachment &other);
protected:
Array<int> _bones;

View File

@ -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) {

View File

@ -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;

View File

@ -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() {

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -301,10 +301,10 @@ Array<Array<float>> &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;
}

View File

@ -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() {

View File

@ -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<BonePose *> &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 = &target;
}
bool IkConstraint::isSourceActive() {

View File

@ -43,12 +43,12 @@ Array<BoneData *> &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));
}

View File

@ -157,8 +157,8 @@ TextureRegion *MeshAttachment::getRegion() {
return _region;
}
void MeshAttachment::setRegion(TextureRegion *region) {
_region = region;
void MeshAttachment::setRegion(TextureRegion &region) {
_region = &region;
}
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,

View File

@ -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;
}

View File

@ -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<BonePose *> &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<float> &PathConstraint::computeWorldPositions(Skeleton &skeleton, PathAttachment &path, int spacesCount, bool tangents) {

View File

@ -47,12 +47,12 @@ Array<BoneData *> &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));
}

View File

@ -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) {

View File

@ -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));
}

View File

@ -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;
}

View File

@ -242,8 +242,8 @@ TextureRegion *RegionAttachment::getRegion() {
return _region;
}
void RegionAttachment::setRegion(TextureRegion *region) {
_region = region;
void RegionAttachment::setRegion(TextureRegion &region) {
_region = &region;
}
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;
}

View File

@ -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<RegionAttachment *>(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<MeshAttachment *>(attachment);
if (meshAttachment->getRegion() != region) {
meshAttachment->setRegion(region);
meshAttachment->setRegion(*region);
meshAttachment->updateRegion();
}
}

View File

@ -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<PhysicsConstraint *>(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<Bone *> &Skeleton::getBones() {

View File

@ -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<SliderData *>(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);
}

View File

@ -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<float> &vertices = polygon->_vertices;
int nn = polygon->_count;
bool SkeletonBounds::containsPoint(Polygon &polygon, float x, float y) {
Array<float> &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<float> &vertices = polygon->_vertices;
size_t nn = polygon->_count;
bool SkeletonBounds::intersectsSegment(Polygon &polygon, float x1, float y1, float x2, float y2) {
Array<float> &vertices = polygon._vertices;
size_t nn = polygon._count;
float width12 = x1 - x2, height12 = y1 - y2;
float det1 = x1 * y2 - y1 * x2;

View File

@ -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);
}

View File

@ -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))

View File

@ -56,10 +56,10 @@ Slider::Slider(SliderData &data, Skeleton &skeleton) : ConstraintGeneric<Slider,
}
}
Slider *Slider::copy(Skeleton &skeleton) {
Slider &Slider::copy(Skeleton &skeleton) {
Slider *copy = new (__FILE__, __LINE__) Slider(_data, skeleton);
copy->_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;
}

View File

@ -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() {

View File

@ -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<BonePose *> &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;
}

View File

@ -66,12 +66,12 @@ Array<BoneData *> &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));
}

View File

@ -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;
}

View File

@ -4666,6 +4666,39 @@ namespace spine {
void writeTransformConstraintPose(const TransformConstraintPose &obj) {
writeTransformConstraintPose(const_cast<TransformConstraintPose *>(&obj));
}
// Reference versions of abstract type write methods
void writeTimeline(const Timeline &obj) {
writeTimeline(const_cast<Timeline *>(&obj));
}
void writeAttachment(const Attachment &obj) {
writeAttachment(const_cast<Attachment *>(&obj));
}
void writeConstraint(const Constraint &obj) {
writeConstraint(const_cast<Constraint *>(&obj));
}
void writeConstraintData(const ConstraintData &obj) {
writeConstraintData(const_cast<ConstraintData *>(&obj));
}
void writeFromProperty(const FromProperty &obj) {
writeFromProperty(const_cast<FromProperty *>(&obj));
}
void writeToProperty(const ToProperty &obj) {
writeToProperty(const_cast<ToProperty *>(&obj));
}
void writeUpdate(const Update &obj) {
writeUpdate(const_cast<Update *>(&obj));
}
void writeVertexAttachment(const VertexAttachment &obj) {
writeVertexAttachment(const_cast<VertexAttachment *>(&obj));
}
};
}// namespace spine

View File

@ -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<Char>());
}

View File

@ -31140,39 +31140,21 @@ class SpineDartBindings {
_lookup<ffi.NativeFunction<ffi.Void Function(spine_array_bone)>>('spine_skeleton_sort_reset');
late final _spine_skeleton_sort_reset = _spine_skeleton_sort_resetPtr.asFunction<void Function(spine_array_bone)>();
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<ffi.NativeFunction<ffi.Void Function(spine_skeleton, ffi.Int32)>>(
'spine_skeleton_update_world_transform_1');
late final _spine_skeleton_update_world_transform_1 =
_spine_skeleton_update_world_transform_1Ptr.asFunction<void Function(spine_skeleton, int)>();
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<ffi.NativeFunction<ffi.Void Function(spine_skeleton, ffi.Int32, spine_bone_pose)>>(
'spine_skeleton_update_world_transform_2');
late final _spine_skeleton_update_world_transform_2 =
_spine_skeleton_update_world_transform_2Ptr.asFunction<void Function(spine_skeleton, int, spine_bone_pose)>();
'spine_skeleton_update_world_transform');
late final _spine_skeleton_update_world_transform =
_spine_skeleton_update_world_transformPtr.asFunction<void Function(spine_skeleton, int)>();
void spine_skeleton_setup_pose(
spine_skeleton self,

View File

@ -4,4 +4,4 @@ import 'spine_dart.dart';
Future<void> initSpineFlutter({bool useStaticLinkage = false, bool enableMemoryDebugging = false}) async {
await initSpineDart(useStaticLinkage: useStaticLinkage, enableMemoryDebugging: enableMemoryDebugging);
return;
}
}

60
spine-glfw/build.sh Executable file
View File

@ -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"

View File

@ -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);