mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[unity] Fixed wrong SkeletonUtilityBone position when used with RootMotion. Closes #2582.
This commit is contained in:
parent
ea1929824f
commit
43e1d624dd
@ -175,6 +175,8 @@
|
||||
- `SkeletonGraphicRenderTexture` example component: `protected RawImage quadRawImage` was changed to `protected SkeletonSubmeshGraphic quadMaskableGraphic` for a bugfix. This is only relevant for subclasses of `SkeletonGraphicRenderTexture` or when querying the `RawImage` component via e.g. `skeletonGraphicRenderTexture.quad.GetComponent<RawImage>()`.
|
||||
- Fixed a bug where when Linear color space is used and `PMA vertex colors` enabled, additive slots add a too dark (too transparent) color value. If you want the old incorrect behaviour (darker additive slots) or are not using Linear but Gamma color space, you can comment-out the define `LINEAR_COLOR_SPACE_FIX_ADDITIVE_ALPHA` in `MeshGenerator.cs` to deactivate the fix or just to skip unnecessary instructions.
|
||||
- Fixed SkeletonRootMotion components ignoring parent bone scale when set by transform constraints. Using applied scale of parent bone now. If you need the old behaviour, comment out the line `#define USE_APPLIED_PARENT_SCALE` in SkeletonRootMotionBase.cs.
|
||||
- Fixed SkeletonUtility callback update order when used with SkeletonRootMotion components so that the position when following a bone is updated after SkeletonRootMotion clears root-bone position. The order of SkeletonUtilityBone callbacks is changed to be later to achieve this. This is a breaking change in the unlikely case that you are using SkeletonRootMotion together with SkeletonUtility and subscribed to `UpdateLocal`, `UpdateWorld` or `UpdateComplete` yourself and relied on a certain callback order. One solution is to then resubscribe your own callback events accordingly by calling
|
||||
`.UpdateLocal -= Callback; .UpdateLocal += Callback;`.
|
||||
|
||||
- **Changes of default values**
|
||||
|
||||
|
||||
@ -183,6 +183,13 @@ namespace Spine.Unity {
|
||||
|
||||
skeletonAnimation.OnAnimationRebuild -= InitializeOnRebuild;
|
||||
skeletonAnimation.OnAnimationRebuild += InitializeOnRebuild;
|
||||
|
||||
SkeletonUtility skeletonUtility = GetComponent<SkeletonUtility>();
|
||||
if (skeletonUtility != null) {
|
||||
// SkeletonUtilityBone shall receive UpdateLocal callbacks for bone-following after root motion
|
||||
// clears the root-bone position.
|
||||
skeletonUtility.ResubscribeEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -238,8 +238,27 @@ namespace Spine.Unity {
|
||||
bool needToReprocessBones;
|
||||
|
||||
public void ResubscribeEvents () {
|
||||
OnDisable();
|
||||
OnEnable();
|
||||
if (skeletonRenderer != null) {
|
||||
skeletonRenderer.OnRebuild -= HandleRendererReset;
|
||||
skeletonRenderer.OnRebuild += HandleRendererReset;
|
||||
} else if (skeletonGraphic != null) {
|
||||
skeletonGraphic.OnRebuild -= HandleRendererReset;
|
||||
skeletonGraphic.OnRebuild += HandleRendererReset;
|
||||
skeletonGraphic.OnPostProcessVertices -= UpdateToMeshScaleAndOffset;
|
||||
skeletonGraphic.OnPostProcessVertices += UpdateToMeshScaleAndOffset;
|
||||
}
|
||||
|
||||
if (skeletonAnimation != null) {
|
||||
skeletonAnimation.UpdateLocal -= UpdateLocal;
|
||||
skeletonAnimation.UpdateWorld -= UpdateWorld;
|
||||
skeletonAnimation.UpdateComplete -= UpdateComplete;
|
||||
|
||||
skeletonAnimation.UpdateLocal += UpdateLocal;
|
||||
if (hasOverrideBones || hasConstraints)
|
||||
skeletonAnimation.UpdateWorld += UpdateWorld;
|
||||
if (hasConstraints)
|
||||
skeletonAnimation.UpdateComplete += UpdateComplete;
|
||||
}
|
||||
}
|
||||
|
||||
void OnEnable () {
|
||||
@ -259,23 +278,8 @@ namespace Spine.Unity {
|
||||
skeletonGraphic != null ? skeletonGraphic.GetComponent<ISkeletonComponent>() :
|
||||
GetComponent<ISkeletonComponent>();
|
||||
}
|
||||
|
||||
if (skeletonRenderer != null) {
|
||||
skeletonRenderer.OnRebuild -= HandleRendererReset;
|
||||
skeletonRenderer.OnRebuild += HandleRendererReset;
|
||||
} else if (skeletonGraphic != null) {
|
||||
skeletonGraphic.OnRebuild -= HandleRendererReset;
|
||||
skeletonGraphic.OnRebuild += HandleRendererReset;
|
||||
skeletonGraphic.OnPostProcessVertices -= UpdateToMeshScaleAndOffset;
|
||||
skeletonGraphic.OnPostProcessVertices += UpdateToMeshScaleAndOffset;
|
||||
}
|
||||
|
||||
if (skeletonAnimation != null) {
|
||||
skeletonAnimation.UpdateLocal -= UpdateLocal;
|
||||
skeletonAnimation.UpdateLocal += UpdateLocal;
|
||||
}
|
||||
|
||||
CollectBones();
|
||||
ResubscribeEvents();
|
||||
}
|
||||
|
||||
void Start () {
|
||||
@ -360,18 +364,6 @@ namespace Spine.Unity {
|
||||
}
|
||||
|
||||
hasConstraints |= constraintComponents.Count > 0;
|
||||
|
||||
if (skeletonAnimation != null) {
|
||||
skeletonAnimation.UpdateWorld -= UpdateWorld;
|
||||
skeletonAnimation.UpdateComplete -= UpdateComplete;
|
||||
|
||||
if (hasOverrideBones || hasConstraints)
|
||||
skeletonAnimation.UpdateWorld += UpdateWorld;
|
||||
|
||||
if (hasConstraints)
|
||||
skeletonAnimation.UpdateComplete += UpdateComplete;
|
||||
}
|
||||
|
||||
needToReprocessBones = false;
|
||||
} else {
|
||||
boneComponents.Clear();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "com.esotericsoftware.spine.spine-unity",
|
||||
"displayName": "spine-unity Runtime",
|
||||
"description": "This plugin provides the spine-unity runtime core.",
|
||||
"version": "4.2.79",
|
||||
"version": "4.2.80",
|
||||
"unity": "2018.3",
|
||||
"author": {
|
||||
"name": "Esoteric Software",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user