[c][cpp] Call update cache when setting a new skin.

This commit is contained in:
badlogic 2019-06-07 10:40:30 +02:00
parent 48fd1024c0
commit d85e18c5f5
2 changed files with 4 additions and 0 deletions

View File

@ -535,6 +535,7 @@ int spSkeleton_setSkinByName (spSkeleton* self, const char* skinName) {
}
void spSkeleton_setSkin (spSkeleton* self, spSkin* newSkin) {
if (self->skin == newSkin) return;
if (newSkin) {
if (self->skin)
spSkin_attachAll(newSkin, self, self->skin);
@ -551,6 +552,7 @@ void spSkeleton_setSkin (spSkeleton* self, spSkin* newSkin) {
}
}
CONST_CAST(spSkin*, self->skin) = newSkin;
spSkeleton_updateCache(self);
}
spAttachment* spSkeleton_getAttachmentForSlotName (const spSkeleton* self, const char* slotName, const char* attachmentName) {

View File

@ -308,6 +308,7 @@ void Skeleton::setSkin(const String &skinName) {
}
void Skeleton::setSkin(Skin *newSkin) {
if (_skin == newSkin) return;
if (newSkin != NULL) {
if (_skin != NULL) {
Skeleton &thisRef = *this;
@ -328,6 +329,7 @@ void Skeleton::setSkin(Skin *newSkin) {
}
_skin = newSkin;
updateCache();
}
Attachment *Skeleton::getAttachment(const String &slotName, const String &attachmentName) {