[c] Replace direct assignment of slot->attachment with call to spSlot_setAttachment, fixes #1927

This commit is contained in:
badlogic 2021-08-05 17:10:26 +02:00
parent 8057c114db
commit ac86ef9ce8
2 changed files with 5 additions and 7 deletions

View File

@ -85,7 +85,7 @@ void spAnimation_apply(const spAnimation *self, spSkeleton *skeleton, float last
direction); direction);
} }
static search(spFloatArray static int search(spFloatArray
*values, *values,
float time) { float time) {
int i, n; int i, n;
@ -98,7 +98,7 @@ static search(spFloatArray
return values->size - 1; return values->size - 1;
} }
static search2(spFloatArray static int search2(spFloatArray
*values, *values,
float time, float time,
int step) { int step) {
@ -1628,8 +1628,7 @@ void spRGB2Timeline_setFrame(spRGB2Timeline *self, int frame, float time, float
static void static void
_spSetAttachment(spAttachmentTimeline *timeline, spSkeleton *skeleton, spSlot *slot, const char *attachmentName) { _spSetAttachment(spAttachmentTimeline *timeline, spSkeleton *skeleton, spSlot *slot, const char *attachmentName) {
slot->attachment = spSlot_setAttachment(slot, attachmentName == NULL ? NULL : spSkeleton_getAttachmentForSlotIndex(skeleton, timeline->slotIndex, attachmentName));
attachmentName == NULL ? NULL : spSkeleton_getAttachmentForSlotIndex(skeleton, timeline->slotIndex, attachmentName);
} }
void _spAttachmentTimeline_apply(spTimeline *timeline, spSkeleton *skeleton, float lastTime, float time, void _spAttachmentTimeline_apply(spTimeline *timeline, spSkeleton *skeleton, float lastTime, float time,

View File

@ -456,8 +456,7 @@ int spAnimationState_apply(spAnimationState *self, spSkeleton *skeleton) {
slot = slots[i]; slot = slots[i];
if (slot->attachmentState == setupState) { if (slot->attachmentState == setupState) {
attachmentName = slot->data->attachmentName; attachmentName = slot->data->attachmentName;
slot->attachment = spSlot_setAttachment(slot, attachmentName == NULL ? NULL : spSkeleton_getAttachmentForSlotIndex(skeleton, slot->data->index, attachmentName));
attachmentName == NULL ? NULL : spSkeleton_getAttachmentForSlotIndex(skeleton, slot->data->index, attachmentName);
} }
} }
self->unkeyedState += 2; self->unkeyedState += 2;
@ -588,7 +587,7 @@ float _spAnimationState_applyMixingFrom(spAnimationState *self, spTrackEntry *to
static void static void
_spAnimationState_setAttachment(spAnimationState *self, spSkeleton *skeleton, spSlot *slot, const char *attachmentName, _spAnimationState_setAttachment(spAnimationState *self, spSkeleton *skeleton, spSlot *slot, const char *attachmentName,
int /*bool*/ attachments) { int /*bool*/ attachments) {
slot->attachment = attachmentName == NULL ? NULL : spSkeleton_getAttachmentForSlotIndex(skeleton, slot->data->index, attachmentName); spSlot_setAttachment(slot, attachmentName == NULL ? NULL : spSkeleton_getAttachmentForSlotIndex(skeleton, slot->data->index, attachmentName));
if (attachments) slot->attachmentState = self->unkeyedState + CURRENT; if (attachments) slot->attachmentState = self->unkeyedState + CURRENT;
} }