void SpineDrawable::setSkin(const std::string& skinName) { spSkin* skin = spSkeletonData_findSkin(skeletonData, skinName.c_str()); spSkeleton_setSkin(skeleton, skin); updateMaterials(); updateBoundingBox(); }
int spSkeleton_setSkinByName (spSkeleton* self, const char* skinName) { spSkin *skin; if (!skinName) { spSkeleton_setSkin(self, 0); return 1; } skin = spSkeletonData_findSkin(self->data, skinName); if (!skin) return 0; spSkeleton_setSkin(self, skin); return 1; }
bool SkeletonAnimation::replacementParts(const std::string& skinName, const std::string& attachmentName) { if (skinName.empty()) { return false; } spSkin *skin = spSkeletonData_findSkin(_skeleton->data, skinName.c_str()); if (!skin) return false; // if (_skeleton->skin) // { // const _Entry *entry = reinterpret_cast<_spSkin *>(_skeleton->skin)->entries; // while (entry) // { // spSlot *slot = _skeleton->slots[entry->slotIndex]; // if (strcmp(slot->data->name, attachmentName.c_str()) == 0) // { // spAttachment *attachment = spSkin_getAttachment(skin, entry->slotIndex, entry->name); // if (attachment) spSlot_setAttachment(slot, attachment); // return true; // } // entry = entry->next; // } // } // else // { for (int i = 0; i < _skeleton->slotsCount; ++i) { spSlot* slot = _skeleton->slots[i]; if (strcmp(slot->data->name, attachmentName.c_str()) == 0) { spAttachment* attachment = spSkin_getAttachment(skin, i, slot->data->attachmentName); if (attachment) spSlot_setAttachment(slot, attachment); return true; } } // } return false; }