mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-25 22:23:42 +08:00
[unity] Fixed SkeletonUtilityBone follow-hierarchy producing wrong result with TransformConstraints. Closes #3035.
This commit is contained in:
parent
945be36fea
commit
b1cdc2db29
@ -204,8 +204,8 @@ namespace Spine.Unity {
|
||||
UpdateLocal(skeletonGraphic);
|
||||
UpdateWorld(skeletonGraphic);
|
||||
UpdateComplete(skeletonGraphic);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HideInInspector] public SkeletonRenderer skeletonRenderer;
|
||||
[HideInInspector] public SkeletonGraphic skeletonGraphic;
|
||||
@ -362,16 +362,21 @@ namespace Spine.Unity {
|
||||
if (skeleton == null) return;
|
||||
|
||||
if (boneRoot != null) {
|
||||
List<object> constraintTargets = new List<object>();
|
||||
List<Bone> constrainedBones = new List<Bone>();
|
||||
ExposedList<IConstraint> constraints = skeleton.Constraints;
|
||||
for (int i = 0, n = constraints.Count; i < n; i++) {
|
||||
IConstraint constraint = constraints.Items[i];
|
||||
ExposedList<BonePose> bones = null;
|
||||
if (constraint is IkConstraint)
|
||||
constraintTargets.Add(((IkConstraint)constraint).Bones);
|
||||
bones = ((IkConstraint)constraint).Bones;
|
||||
else if (constraint is TransformConstraint)
|
||||
constraintTargets.Add(((TransformConstraint)constraint).Bones);
|
||||
bones = ((TransformConstraint)constraint).Bones;
|
||||
else if (constraint is PathConstraint)
|
||||
constraintTargets.Add(((PathConstraint)constraint).Bones);
|
||||
bones = ((PathConstraint)constraint).Bones;
|
||||
if (bones != null) {
|
||||
for (int j = 0, m = bones.Count; j < m; j++)
|
||||
constrainedBones.Add(bones.Items[j].bone);
|
||||
}
|
||||
}
|
||||
|
||||
List<SkeletonUtilityBone> boneComponents = this.boneComponents;
|
||||
@ -382,7 +387,7 @@ namespace Spine.Unity {
|
||||
if (b.bone == null) continue;
|
||||
}
|
||||
hasOverrideBones |= (b.mode == SkeletonUtilityBone.Mode.Override);
|
||||
hasConstraintTargetBones |= constraintTargets.Contains(b.bone);
|
||||
hasConstraintTargetBones |= constrainedBones.Contains(b.bone);
|
||||
}
|
||||
|
||||
needToReprocessBones = false;
|
||||
|
||||
@ -54,7 +54,7 @@ namespace Spine.Unity {
|
||||
Complete
|
||||
}
|
||||
|
||||
#region Inspector
|
||||
#region Inspector
|
||||
/// <summary>If a bone isn't set, boneName is used to find the bone.</summary>
|
||||
public string boneName;
|
||||
public Transform parentReference;
|
||||
@ -62,7 +62,7 @@ namespace Spine.Unity {
|
||||
public bool position, rotation, scale, zPosition = true;
|
||||
[Range(0f, 1f)]
|
||||
public float overrideAlpha = 1;
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
public SkeletonUtility hierarchy;
|
||||
[System.NonSerialized] public Bone bone;
|
||||
@ -159,6 +159,7 @@ namespace Spine.Unity {
|
||||
case UpdatePhase.World:
|
||||
case UpdatePhase.Complete:
|
||||
var appliedPose = bone.AppliedPose;
|
||||
appliedPose.ValidateLocalTransform(skeleton);
|
||||
if (position)
|
||||
thisTransform.localPosition = new Vector3(appliedPose.X * positionScale, appliedPose.Y * positionScale,
|
||||
zPosition ? 0 : thisTransform.localPosition.z);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "com.esotericsoftware.spine.spine-unity",
|
||||
"displayName": "spine-unity Runtime",
|
||||
"description": "This plugin provides the spine-unity runtime core and examples. Spine Examples can be installed via the Samples tab.",
|
||||
"version": "4.3.48",
|
||||
"version": "4.3.49",
|
||||
"unity": "2018.3",
|
||||
"author": {
|
||||
"name": "Esoteric Software",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user