diff --git a/spine-csharp/src/AnimationState.cs b/spine-csharp/src/AnimationState.cs index 2adf50a93..7e3bd95f6 100644 --- a/spine-csharp/src/AnimationState.cs +++ b/spine-csharp/src/AnimationState.cs @@ -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 { /// /// Controls how properties keyed in the animation are mixed with lower tracks. Defaults to . /// - /// Track entries on track 0 ignore this setting and always use . - /// /// The MixBlend can be set for a new track entry only before is next /// called. /// diff --git a/spine-csharp/src/package.json b/spine-csharp/src/package.json index bb824c165..fba052d78 100644 --- a/spine-csharp/src/package.json +++ b/spine-csharp/src/package.json @@ -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",