mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[libgdx] Keep slot deform when changing the attachment if the new attachment is compatible with the deform.
Forum discussion: http://esotericsoftware.com/forum/Swapping-a-linked-mesh-attachment-causes-a-flicker-15869?p=69490#p69490
This commit is contained in:
parent
602aa0f109
commit
14b317008b
@ -105,12 +105,17 @@ public class Slot {
|
|||||||
return attachment;
|
return attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the slot's attachment and, if the attachment changed, resets {@link #attachmentTime} and clears {@link #deform}. */
|
/** Sets the slot's attachment and, if the attachment changed, resets {@link #attachmentTime} and clears the {@link #deform}.
|
||||||
|
* The deform is not cleared if the old attachment has the same {@link VertexAttachment#getDeformAttachment()} as the specified
|
||||||
|
* attachment. */
|
||||||
public void setAttachment (@Null Attachment attachment) {
|
public void setAttachment (@Null Attachment attachment) {
|
||||||
if (this.attachment == attachment) return;
|
if (this.attachment == attachment) return;
|
||||||
|
if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment)
|
||||||
|
|| ((VertexAttachment)attachment).getDeformAttachment() != ((VertexAttachment)this.attachment).getDeformAttachment()) {
|
||||||
|
deform.clear();
|
||||||
|
}
|
||||||
this.attachment = attachment;
|
this.attachment = attachment;
|
||||||
attachmentTime = bone.skeleton.time;
|
attachmentTime = bone.skeleton.time;
|
||||||
deform.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The time that has elapsed since the last time the attachment was set or cleared. Relies on Skeleton
|
/** The time that has elapsed since the last time the attachment was set or cleared. Relies on Skeleton
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user