in our application, artist desing 2 skin to preset a hero's two status,
the Skin_A is normal Status, the Skin_B is Transform Status of hero, so u can image that
Skin_B may have some equipment A dont.
for example Skin_B have helmet and Skin_A dont.
Artist Attach a Helmet on Skin_B and leave Skin_A empty.
when i switch Skin_B to Skin_A , the helmet dont hide. then i check the runtime code.
i found two function cause this behavior.
void spSkeleton_setSkin (spSkeleton* self, spSkin* newSkin) {
if (newSkin) {
if (self->skin)
spSkin_attachAll(newSkin, self, self->skin);
else {
/* No previous skin, attach setup pose attachments. /
int i;
for (i = 0; i < self->slotsCount; ++i) {
spSlot slot = self->slots;
if (slot->data->attachmentName) {
spAttachment* attachment = spSkin_getAttachment(newSkin, i, slot->data->attachmentName);
/*if (attachment) /spSlot_setAttachment(slot, attachment);
}
}
}
}
CONST_CAST(spSkin, self->skin) = newSkin;
}
void spSkin_attachAll (const spSkin* self, spSkeleton* skeleton, const spSkin* oldSkin) {
const Entry *entry = SUB_CAST(spSkin, oldSkin)->entries;
while (entry) {
spSlot *slot = skeleton->slots[entry->slotIndex];
if (slot->attachment == entry->attachment) {
spAttachment attachment = spSkin_getAttachment(self, entry->slotIndex, entry->name);
/if (attachment)*/ spSlot_setAttachment(slot, attachment);
}
entry = entry->next;
}
/if (attachment)/ is mark by my self, may i just mark as i do? or may cause uncontroll problem?
or i need just tell artist to fill a "solid empty pic" in Skin_A?