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;
|
if (current == null || current.delay > 0) continue;
|
||||||
applied = true;
|
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;
|
MixBlend blend = i == 0 ? MixBlend.First : current.mixBlend;
|
||||||
|
|
||||||
// Apply mixing from entries first.
|
// Apply mixing from entries first.
|
||||||
float alpha = current.alpha;
|
float alpha = current.alpha;
|
||||||
if (current.mixingFrom != null)
|
if (current.mixingFrom != null)
|
||||||
alpha *= ApplyMixingFrom(current, skeleton, blend);
|
alpha *= ApplyMixingFrom(current, skeleton);
|
||||||
else if (current.trackTime >= current.trackEnd && current.next == null) //
|
else if (current.trackTime >= current.trackEnd && current.next == null) //
|
||||||
alpha = 0; // Set to setup pose the last time the entry will be applied.
|
alpha = 0; // Set to setup pose the last time the entry will be applied.
|
||||||
bool attachments = alpha >= current.alphaAttachmentThreshold;
|
bool attachments = alpha >= current.alphaAttachmentThreshold;
|
||||||
@ -279,7 +279,7 @@ namespace Spine {
|
|||||||
|
|
||||||
for (int ii = 0; ii < timelineCount; ii++) {
|
for (int ii = 0; ii < timelineCount; ii++) {
|
||||||
Timeline timeline = timelines[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;
|
RotateTimeline rotateTimeline = timeline as RotateTimeline;
|
||||||
if (!shortestRotation && rotateTimeline != null)
|
if (!shortestRotation && rotateTimeline != null)
|
||||||
ApplyRotateTimeline(rotateTimeline, skeleton, applyTime, alpha, timelineBlend, timelinesRotation,
|
ApplyRotateTimeline(rotateTimeline, skeleton, applyTime, alpha, timelineBlend, timelinesRotation,
|
||||||
@ -355,18 +355,16 @@ namespace Spine {
|
|||||||
return applied;
|
return applied;
|
||||||
}
|
}
|
||||||
|
|
||||||
private float ApplyMixingFrom (TrackEntry to, Skeleton skeleton, MixBlend blend) {
|
private float ApplyMixingFrom (TrackEntry to, Skeleton skeleton) {
|
||||||
TrackEntry from = to.mixingFrom;
|
TrackEntry from = to.mixingFrom;
|
||||||
if (from.mixingFrom != null) ApplyMixingFrom(from, skeleton, blend);
|
if (from.mixingFrom != null) ApplyMixingFrom(from, skeleton);
|
||||||
|
|
||||||
float mix;
|
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;
|
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;
|
mix = to.mixTime / to.mixDuration;
|
||||||
if (mix > 1) mix = 1;
|
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;
|
bool attachments = mix < from.mixAttachmentThreshold, drawOrder = mix < from.mixDrawOrderThreshold;
|
||||||
@ -381,6 +379,7 @@ namespace Spine {
|
|||||||
if (mix < from.eventThreshold) events = this.events;
|
if (mix < from.eventThreshold) events = this.events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MixBlend blend = from.mixBlend;
|
||||||
if (blend == MixBlend.Add) {
|
if (blend == MixBlend.Add) {
|
||||||
for (int i = 0; i < timelineCount; i++)
|
for (int i = 0; i < timelineCount; i++)
|
||||||
timelines[i].Apply(skeleton, animationLast, applyTime, events, alphaMix, blend, MixDirection.Out, false);
|
timelines[i].Apply(skeleton, animationLast, applyTime, events, alphaMix, blend, MixDirection.Out, false);
|
||||||
@ -1294,8 +1293,6 @@ namespace Spine {
|
|||||||
/// <para>
|
/// <para>
|
||||||
/// Controls how properties keyed in the animation are mixed with lower tracks. Defaults to <see cref="MixBlend.Replace"/>.
|
/// Controls how properties keyed in the animation are mixed with lower tracks. Defaults to <see cref="MixBlend.Replace"/>.
|
||||||
/// </para><para>
|
/// </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
|
/// The <c>MixBlend</c> can be set for a new track entry only before <see cref="AnimationState.Apply(Skeleton)"/> is next
|
||||||
/// called.</para>
|
/// called.</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "com.esotericsoftware.spine.spine-csharp",
|
"name": "com.esotericsoftware.spine.spine-csharp",
|
||||||
"displayName": "spine-csharp Runtime",
|
"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.",
|
"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",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user