• Runtimes
  • Point Attachment Names in C Runtime

Related Discussions
...

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

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;
   }
}

Hi Marion,

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

Kolja

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.

5일 후

Thanks for the info. Makes sense.