mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
WIP
attachmentThreshold for alpha setMixDuration changes? delay, delayRemaining
This commit is contained in:
parent
7b4dd81fb7
commit
45c51b0c4f
@ -221,6 +221,7 @@ public class AnimationState {
|
|||||||
mix *= applyMixingFrom(current, skeleton, blend);
|
mix *= applyMixingFrom(current, skeleton, blend);
|
||||||
else if (current.trackTime >= current.trackEnd && current.next == null) //
|
else if (current.trackTime >= current.trackEnd && current.next == null) //
|
||||||
mix = 0; // Set to setup pose the last time the entry will be applied.
|
mix = 0; // Set to setup pose the last time the entry will be applied.
|
||||||
|
boolean attachments = mix < current.attachmentThreshold;
|
||||||
|
|
||||||
// Apply current entry.
|
// Apply current entry.
|
||||||
float animationLast = current.animationLast, animationTime = current.getAnimationTime(), applyTime = animationTime;
|
float animationLast = current.animationLast, animationTime = current.getAnimationTime(), applyTime = animationTime;
|
||||||
@ -232,10 +233,11 @@ public class AnimationState {
|
|||||||
int timelineCount = current.animation.timelines.size;
|
int timelineCount = current.animation.timelines.size;
|
||||||
Object[] timelines = current.animation.timelines.items;
|
Object[] timelines = current.animation.timelines.items;
|
||||||
if ((i == 0 && mix == 1) || blend == MixBlend.add) {
|
if ((i == 0 && mix == 1) || blend == MixBlend.add) {
|
||||||
|
if (i == 0) attachments = true;
|
||||||
for (int ii = 0; ii < timelineCount; ii++) {
|
for (int ii = 0; ii < timelineCount; ii++) {
|
||||||
Object timeline = timelines[ii];
|
Object timeline = timelines[ii];
|
||||||
if (timeline instanceof AttachmentTimeline)
|
if (timeline instanceof AttachmentTimeline)
|
||||||
applyAttachmentTimeline((AttachmentTimeline)timeline, skeleton, applyTime, blend, true);
|
applyAttachmentTimeline((AttachmentTimeline)timeline, skeleton, applyTime, blend, attachments);
|
||||||
else
|
else
|
||||||
((Timeline)timeline).apply(skeleton, animationLast, applyTime, applyEvents, mix, blend, MixDirection.in);
|
((Timeline)timeline).apply(skeleton, animationLast, applyTime, applyEvents, mix, blend, MixDirection.in);
|
||||||
}
|
}
|
||||||
@ -254,7 +256,7 @@ public class AnimationState {
|
|||||||
applyRotateTimeline((RotateTimeline)timeline, skeleton, applyTime, mix, timelineBlend, timelinesRotation,
|
applyRotateTimeline((RotateTimeline)timeline, skeleton, applyTime, mix, timelineBlend, timelinesRotation,
|
||||||
ii << 1, firstFrame);
|
ii << 1, firstFrame);
|
||||||
} else if (timeline instanceof AttachmentTimeline)
|
} else if (timeline instanceof AttachmentTimeline)
|
||||||
applyAttachmentTimeline((AttachmentTimeline)timeline, skeleton, applyTime, blend, true);
|
applyAttachmentTimeline((AttachmentTimeline)timeline, skeleton, applyTime, blend, attachments);
|
||||||
else
|
else
|
||||||
timeline.apply(skeleton, animationLast, applyTime, applyEvents, mix, timelineBlend, MixDirection.in);
|
timeline.apply(skeleton, animationLast, applyTime, applyEvents, mix, timelineBlend, MixDirection.in);
|
||||||
}
|
}
|
||||||
@ -1170,6 +1172,17 @@ public class AnimationState {
|
|||||||
this.mixDuration = mixDuration;
|
this.mixDuration = mixDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Sets both {@link #getMixDuration()} and {@link #getDelay()}.
|
||||||
|
* @param delay If > 0, sets {@link TrackEntry#getDelay()}. If <= 0, the delay set is the duration of the previous track
|
||||||
|
* entry minus the specified mix duration plus the specified <code>delay</code> (ie the mix ends at
|
||||||
|
* (<code>delay</code> = 0) or before (<code>delay</code> < 0) the previous track entry duration). If the previous
|
||||||
|
* entry is looping, its next loop completion is used instead of its duration. */
|
||||||
|
public void setMixDuration (float mixDuration, float delay) {
|
||||||
|
this.mixDuration = mixDuration;
|
||||||
|
if (previous != null && delay <= 0) delay += previous.getTrackComplete() - mixDuration;
|
||||||
|
this.delay = delay;
|
||||||
|
}
|
||||||
|
|
||||||
/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}.
|
/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}.
|
||||||
* <p>
|
* <p>
|
||||||
* Track entries on track 0 ignore this setting and always use {@link MixBlend#first}.
|
* Track entries on track 0 ignore this setting and always use {@link MixBlend#first}.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user