mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[c][cpp] Call update cache when setting a new skin.
This commit is contained in:
parent
48fd1024c0
commit
d85e18c5f5
@ -535,6 +535,7 @@ int spSkeleton_setSkinByName (spSkeleton* self, const char* skinName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void spSkeleton_setSkin (spSkeleton* self, spSkin* newSkin) {
|
void spSkeleton_setSkin (spSkeleton* self, spSkin* newSkin) {
|
||||||
|
if (self->skin == newSkin) return;
|
||||||
if (newSkin) {
|
if (newSkin) {
|
||||||
if (self->skin)
|
if (self->skin)
|
||||||
spSkin_attachAll(newSkin, self, 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;
|
CONST_CAST(spSkin*, self->skin) = newSkin;
|
||||||
|
spSkeleton_updateCache(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
spAttachment* spSkeleton_getAttachmentForSlotName (const spSkeleton* self, const char* slotName, const char* attachmentName) {
|
spAttachment* spSkeleton_getAttachmentForSlotName (const spSkeleton* self, const char* slotName, const char* attachmentName) {
|
||||||
|
|||||||
@ -308,6 +308,7 @@ void Skeleton::setSkin(const String &skinName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Skeleton::setSkin(Skin *newSkin) {
|
void Skeleton::setSkin(Skin *newSkin) {
|
||||||
|
if (_skin == newSkin) return;
|
||||||
if (newSkin != NULL) {
|
if (newSkin != NULL) {
|
||||||
if (_skin != NULL) {
|
if (_skin != NULL) {
|
||||||
Skeleton &thisRef = *this;
|
Skeleton &thisRef = *this;
|
||||||
@ -328,6 +329,7 @@ void Skeleton::setSkin(Skin *newSkin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_skin = newSkin;
|
_skin = newSkin;
|
||||||
|
updateCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
Attachment *Skeleton::getAttachment(const String &slotName, const String &attachmentName) {
|
Attachment *Skeleton::getAttachment(const String &slotName, const String &attachmentName) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user