mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
Added Skin_getAttachmentName to enumerate skin attachments for a slot. Thanks James Poag!
This commit is contained in:
parent
69f37c2a48
commit
d1d1c6a638
@ -46,6 +46,9 @@ void Skin_addAttachment (Skin* self, int slotIndex, const char* name, Attachment
|
||||
/* Returns 0 if the attachment was not found. */
|
||||
Attachment* Skin_getAttachment (const Skin* self, int slotIndex, const char* name);
|
||||
|
||||
/* Returns 0 if the slot or attachment was not found. */
|
||||
const char* Skin_getAttachmentName (const Skin* self, int slotIndex, int attachmentIndex);
|
||||
|
||||
/** Attach each attachment in this skin if the corresponding attachment in oldSkin is currently attached. */
|
||||
void Skin_attachAll (const Skin* self, struct Skeleton* skeleton, const Skin* oldSkin);
|
||||
|
||||
|
||||
@ -88,6 +88,19 @@ Attachment* Skin_getAttachment (const Skin* self, int slotIndex, const char* nam
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* Skin_getAttachmentName (const Skin* self, int slotIndex, int attachmentIndex) {
|
||||
const _Entry* entry = SUB_CAST(_Internal, self) ->entries;
|
||||
int i = 0;
|
||||
while (entry) {
|
||||
if (entry->slotIndex == slotIndex) {
|
||||
if (i == attachmentIndex) return entry->name;
|
||||
i++;
|
||||
}
|
||||
entry = entry->next;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Skin_attachAll (const Skin* self, Skeleton* skeleton, const Skin* oldSkin) {
|
||||
const _Entry *entry = SUB_CAST(_Internal, oldSkin) ->entries;
|
||||
while (entry) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user