pinguin

Hi

I'm using the C runtime and I need a list of all Point Attachment Names.
Is it possible to get the names via runtime?

Can someone post a code snippet or other hints?

Thanks a lot.
Kolja
pinguin
  • 記事: 5

Mario

This does the trick, including if you have more than 1 skin in your skeleton:
for (int i = 0; i < skeleton->data->skinsCount; i++) {
spSkin* skin = skeleton->data->skins[i];
spSkinEntry *entry = spSkin_getAttachments(skin);
while (entry) {
if (entry->attachment && entry->attachment->type == SP_ATTACHMENT_POINT) {
printf("%s\n", entry->attachment->name);
}
entry = entry->next;
}
}
アバター
Mario

Mario
  • 記事: 3082

pinguin

Hi Marion,

thanks a lot it's working like expected.
Do you know, is there a guaranteed order for the attachments?

Kolja
pinguin
  • 記事: 5

Nate

Attachments in a skin are stored in a hash map, so the order is undefined. Attachments are sorted by name in the JSON and binary data format, but that order is lost when the data is loaded and the attachment is added to a skin.
アバター
Nate

Nate
  • 記事: 11939

pinguin

Thanks for the info. Makes sense.
pinguin
  • 記事: 5


Return to Runtimes