mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
setSkin should attach setup pose attachments if there was no old skin.
This commit is contained in:
parent
cf9a3a4109
commit
ca9274539e
@ -163,7 +163,17 @@ int spSkeleton_setSkinByName (spSkeleton* self, const char* skinName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void spSkeleton_setSkin (spSkeleton* self, spSkin* newSkin) {
|
void spSkeleton_setSkin (spSkeleton* self, spSkin* newSkin) {
|
||||||
if (self->skin && newSkin) spSkin_attachAll(newSkin, self, self->skin);
|
if (!self->skin) {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < self->slotCount; ++i) {
|
||||||
|
spSlot* slot = self->slots[i];
|
||||||
|
if (slot->data->attachmentName) {
|
||||||
|
spAttachment* attachment = spSkin_getAttachment(newSkin, i, slot->data->attachmentName);
|
||||||
|
if (attachment) spSlot_setAttachment(slot, attachment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (newSkin) /**/
|
||||||
|
spSkin_attachAll(newSkin, self, self->skin);
|
||||||
CONST_CAST(spSkin*, self->skin) = newSkin;
|
CONST_CAST(spSkin*, self->skin) = newSkin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user