[libgdx] Use linked mesh sequence properties when inheriting a sequence timeline. Also allow a linked mesh with no sequence when the source mesh has one.

This commit is contained in:
Nathan Sweet 2022-06-18 18:48:26 -04:00
parent 81baef0b5b
commit 4efd63f89c

View File

@ -2471,6 +2471,8 @@ public class Animation {
if (!(slotAttachment instanceof VertexAttachment)
|| ((VertexAttachment)slotAttachment).getTimelineAttachment() != attachment) return;
}
Sequence sequence = ((HasTextureRegion)slotAttachment).getSequence();
if (sequence == null) return;
float[] frames = this.frames;
if (time < frames[0]) { // Time is before first frame.
@ -2483,7 +2485,7 @@ public class Animation {
int modeAndIndex = (int)frames[i + MODE];
float delay = frames[i + DELAY];
int index = modeAndIndex >> 4, count = attachment.getSequence().getRegions().length;
int index = modeAndIndex >> 4, count = sequence.getRegions().length;
SequenceMode mode = SequenceMode.values[modeAndIndex & 0xf];
if (mode != SequenceMode.hold) {
index += (time - before) / delay + 0.00001f;