mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[csharp] Port of commit 29bf262: Fix track 0 dip mixing to animation with key > frame 0.
This commit is contained in:
parent
7facce33fe
commit
965e074dd8
@ -237,13 +237,13 @@ namespace Spine {
|
||||
if (current == null || current.delay > 0) continue;
|
||||
applied = true;
|
||||
|
||||
// Track 0 animations aren't for layering, so do not show the previously applied animations before the first key.
|
||||
// Track 0 animations aren't for layering, so never use current values before the first key.
|
||||
MixBlend blend = i == 0 ? MixBlend.First : current.mixBlend;
|
||||
|
||||
// Apply mixing from entries first.
|
||||
float alpha = current.alpha;
|
||||
if (current.mixingFrom != null)
|
||||
alpha *= ApplyMixingFrom(current, skeleton, blend);
|
||||
alpha *= ApplyMixingFrom(current, skeleton);
|
||||
else if (current.trackTime >= current.trackEnd && current.next == null) //
|
||||
alpha = 0; // Set to setup pose the last time the entry will be applied.
|
||||
bool attachments = alpha >= current.alphaAttachmentThreshold;
|
||||
@ -279,7 +279,7 @@ namespace Spine {
|
||||
|
||||
for (int ii = 0; ii < timelineCount; ii++) {
|
||||
Timeline timeline = timelines[ii];
|
||||
MixBlend timelineBlend = timelineMode[ii] == AnimationState.Subsequent ? blend : MixBlend.Setup;
|
||||
MixBlend timelineBlend = timelineMode[ii] == AnimationState.Subsequent ? current.mixBlend : MixBlend.Setup;
|
||||
RotateTimeline rotateTimeline = timeline as RotateTimeline;
|
||||
if (!shortestRotation && rotateTimeline != null)
|
||||
ApplyRotateTimeline(rotateTimeline, skeleton, applyTime, alpha, timelineBlend, timelinesRotation,
|
||||
@ -355,18 +355,16 @@ namespace Spine {
|
||||
return applied;
|
||||
}
|
||||
|
||||
private float ApplyMixingFrom (TrackEntry to, Skeleton skeleton, MixBlend blend) {
|
||||
private float ApplyMixingFrom (TrackEntry to, Skeleton skeleton) {
|
||||
TrackEntry from = to.mixingFrom;
|
||||
if (from.mixingFrom != null) ApplyMixingFrom(from, skeleton, blend);
|
||||
if (from.mixingFrom != null) ApplyMixingFrom(from, skeleton);
|
||||
|
||||
float mix;
|
||||
if (to.mixDuration == 0) { // Single frame mix to undo mixingFrom changes.
|
||||
if (to.mixDuration == 0) // Single frame mix to undo mixingFrom changes.
|
||||
mix = 1;
|
||||
if (blend == MixBlend.First) blend = MixBlend.Setup; // Tracks > 0 are transparent and can't reset to setup pose.
|
||||
} else {
|
||||
else {
|
||||
mix = to.mixTime / to.mixDuration;
|
||||
if (mix > 1) mix = 1;
|
||||
if (blend != MixBlend.First) blend = from.mixBlend; // Track 0 ignores track mix blend.
|
||||
}
|
||||
|
||||
bool attachments = mix < from.mixAttachmentThreshold, drawOrder = mix < from.mixDrawOrderThreshold;
|
||||
@ -381,6 +379,7 @@ namespace Spine {
|
||||
if (mix < from.eventThreshold) events = this.events;
|
||||
}
|
||||
|
||||
MixBlend blend = from.mixBlend;
|
||||
if (blend == MixBlend.Add) {
|
||||
for (int i = 0; i < timelineCount; i++)
|
||||
timelines[i].Apply(skeleton, animationLast, applyTime, events, alphaMix, blend, MixDirection.Out, false);
|
||||
@ -1294,8 +1293,6 @@ namespace Spine {
|
||||
/// <para>
|
||||
/// Controls how properties keyed in the animation are mixed with lower tracks. Defaults to <see cref="MixBlend.Replace"/>.
|
||||
/// </para><para>
|
||||
/// Track entries on track 0 ignore this setting and always use <see cref="MixBlend.First"/>.
|
||||
/// </para><para>
|
||||
/// The <c>MixBlend</c> can be set for a new track entry only before <see cref="AnimationState.Apply(Skeleton)"/> is next
|
||||
/// called.</para>
|
||||
/// </summary>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "com.esotericsoftware.spine.spine-csharp",
|
||||
"displayName": "spine-csharp Runtime",
|
||||
"description": "This plugin provides the spine-csharp core runtime. Compatible with skeleton exports from Spine Editor version 4.3.40-beta or later.",
|
||||
"version": "4.3.17",
|
||||
"version": "4.3.18",
|
||||
"unity": "2018.3",
|
||||
"author": {
|
||||
"name": "Esoteric Software",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user