Attachment* Skeleton_getAttachmentForSlotIndex (const Skeleton* self, int slotIndex, const char* attachmentName) { if (slotIndex == -1) return 0; if (self->skin) { Attachment *attachment = Skin_getAttachment(self->skin, slotIndex, attachmentName); if (attachment) return attachment; } if (self->data->defaultSkin) { Attachment *attachment = Skin_getAttachment(self->data->defaultSkin, slotIndex, attachmentName); if (attachment) return attachment; } return 0; }
void Skin_attachAll (const Skin* self, Skeleton* skeleton, const Skin* oldSkin) { const _Entry *entry = SUB_CAST(_Internal, oldSkin) ->entries; while (entry) { Slot *slot = skeleton->slots[entry->slotIndex]; if (slot->attachment == entry->attachment) { Attachment *attachment = Skin_getAttachment(self, entry->slotIndex, entry->name); if (attachment) Slot_setAttachment(slot, attachment); } entry = entry->next; } }