[unity] Fix AnimationStateClip first frame mesh.

This commit is contained in:
John 2018-05-25 11:59:11 +08:00 committed by GitHub
parent d11ebfeded
commit 41024db6eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,9 +50,9 @@ namespace Spine.Unity.Playables {
var state = spineComponent.AnimationState; var state = spineComponent.AnimationState;
if (!Application.isPlaying) { if (!Application.isPlaying) {
#if SPINE_EDITMODEPOSE #if SPINE_EDITMODEPOSE
PreviewEditModePose(playable, spineComponent); PreviewEditModePose(playable, spineComponent);
#endif #endif
return; return;
} }
@ -81,7 +81,6 @@ namespace Spine.Unity.Playables {
if (clipData.animationReference == null) { if (clipData.animationReference == null) {
float mixDuration = clipData.customDuration ? clipData.mixDuration : state.Data.DefaultMix; float mixDuration = clipData.customDuration ? clipData.mixDuration : state.Data.DefaultMix;
state.SetEmptyAnimation(0, mixDuration); state.SetEmptyAnimation(0, mixDuration);
continue;
} else { } else {
if (clipData.animationReference.Animation != null) { if (clipData.animationReference.Animation != null) {
Spine.TrackEntry trackEntry = state.SetAnimation(0, clipData.animationReference.Animation, clipData.loop); Spine.TrackEntry trackEntry = state.SetAnimation(0, clipData.animationReference.Animation, clipData.loop);
@ -96,11 +95,15 @@ namespace Spine.Unity.Playables {
} }
//else Debug.LogWarningFormat("Animation named '{0}' not found", clipData.animationName); //else Debug.LogWarningFormat("Animation named '{0}' not found", clipData.animationName);
} }
// Ensure that the first frame ends with an updated mesh.
spineComponent.Update(0);
spineComponent.LateUpdate();
} }
} }
} }
#if SPINE_EDITMODEPOSE #if SPINE_EDITMODEPOSE
public void PreviewEditModePose (Playable playable, SkeletonAnimation spineComponent) { public void PreviewEditModePose (Playable playable, SkeletonAnimation spineComponent) {
if (Application.isPlaying) return; if (Application.isPlaying) return;
if (spineComponent == null) return; if (spineComponent == null) return;
@ -160,7 +163,7 @@ namespace Spine.Unity.Playables {
// Do nothing outside of the first clip and the last clip. // Do nothing outside of the first clip and the last clip.
} }
#endif #endif
} }