[unity] BoneFollowerGraphic does not respect LayoutScaleMode. Closes #2378.

This commit is contained in:
Harald Csaszar 2023-09-21 19:28:57 +02:00
parent a2b80fe761
commit 9487d3a5f3
7 changed files with 9 additions and 24 deletions

View File

@ -99,8 +99,7 @@ namespace Spine.Unity.Editor {
Transform transform = skeletonGraphicComponent.transform;
Skeleton skeleton = skeletonGraphicComponent.Skeleton;
Canvas canvas = skeletonGraphicComponent.canvas;
float positionScale = canvas == null ? 1f : skeletonGraphicComponent.canvas.referencePixelsPerUnit;
float positionScale = skeletonGraphicComponent.MeshScale;
if (string.IsNullOrEmpty(boneName.stringValue)) {
SpineHandles.DrawBones(transform, skeleton, positionScale);

View File

@ -139,9 +139,7 @@ namespace Spine.Unity {
RectTransform thisTransform = this.transform as RectTransform;
if (thisTransform == null) return;
Canvas canvas = skeletonGraphic.canvas;
if (canvas == null) canvas = skeletonGraphic.GetComponentInParent<Canvas>();
float scale = canvas != null ? canvas.referencePixelsPerUnit : 100.0f;
float scale = skeletonGraphic.MeshScale;
float additionalFlipScale = 1;
if (skeletonTransformIsParent) {

View File

@ -125,10 +125,7 @@ namespace Spine.Unity {
int requiredCollidersCount = 0;
PolygonCollider2D[] colliders = GetComponents<PolygonCollider2D>();
if (this.gameObject.activeInHierarchy) {
Canvas canvas = skeletonGraphic.canvas;
if (canvas == null) canvas = skeletonGraphic.GetComponentInParent<Canvas>();
float scale = canvas != null ? canvas.referencePixelsPerUnit : 100.0f;
float scale = skeletonGraphic.MeshScale;
foreach (Skin skin in skeleton.Data.Skins)
AddCollidersForSkin(skin, slotIndex, colliders, scale, ref requiredCollidersCount);

View File

@ -54,7 +54,7 @@ namespace Spine.Unity {
#endregion
AnimationState animationState;
Canvas canvas;
SkeletonGraphic skeletonGraphic;
public override Vector2 GetRemainingRootMotion (int trackIndex) {
TrackEntry track = animationState.GetCurrent(trackIndex);
@ -79,7 +79,7 @@ namespace Spine.Unity {
protected override float AdditionalScale {
get {
return canvas ? canvas.referencePixelsPerUnit : 1.0f;
return skeletonGraphic ? skeletonGraphic.MeshScale : 1.0f;
}
}
@ -93,9 +93,7 @@ namespace Spine.Unity {
IAnimationStateComponent animstateComponent = skeletonComponent as IAnimationStateComponent;
this.animationState = (animstateComponent != null) ? animstateComponent.AnimationState : null;
if (this.GetComponent<CanvasRenderer>() != null) {
canvas = this.GetComponentInParent<Canvas>();
}
skeletonGraphic = this.GetComponent<SkeletonGraphic>();
}
protected override Vector2 CalculateAnimationsMovementDelta () {

View File

@ -483,7 +483,6 @@ namespace Spine.Unity {
int GetConstraintLastPosIndex (int constraintIndex) {
ExposedList<TransformConstraint> constraints = skeletonComponent.Skeleton.TransformConstraints;
TransformConstraint targetConstraint = constraints.Items[constraintIndex];
return transformConstraintIndices.FindIndex(addedIndex => addedIndex == constraintIndex);
}

View File

@ -157,14 +157,13 @@ namespace Spine.Unity {
}
}
if (canvas != null) {
positionScale = canvas.referencePixelsPerUnit;
if (skeletonGraphic != null) {
positionScale = skeletonGraphic.MeshScale;
}
}
[HideInInspector] public SkeletonRenderer skeletonRenderer;
[HideInInspector] public SkeletonGraphic skeletonGraphic;
private Canvas canvas;
[System.NonSerialized] public ISkeletonAnimation skeletonAnimation;
private ISkeletonComponent skeletonComponent;
@ -233,11 +232,6 @@ namespace Spine.Unity {
} else if (skeletonGraphic != null) {
skeletonGraphic.OnRebuild -= HandleRendererReset;
skeletonGraphic.OnRebuild += HandleRendererReset;
canvas = skeletonGraphic.canvas;
if (canvas == null)
canvas = skeletonGraphic.GetComponentInParent<Canvas>();
if (canvas == null)
positionScale = 100.0f;
}
if (skeletonAnimation != null) {

View File

@ -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.1.24",
"version": "4.1.25",
"unity": "2018.3",
"author": {
"name": "Esoteric Software",