mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 02:06:03 +08:00
[unity] BoneFollowerGraphic does not respect LayoutScaleMode. Closes #2378.
This commit is contained in:
parent
a2b80fe761
commit
9487d3a5f3
@ -99,8 +99,7 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
Transform transform = skeletonGraphicComponent.transform;
|
Transform transform = skeletonGraphicComponent.transform;
|
||||||
Skeleton skeleton = skeletonGraphicComponent.Skeleton;
|
Skeleton skeleton = skeletonGraphicComponent.Skeleton;
|
||||||
Canvas canvas = skeletonGraphicComponent.canvas;
|
float positionScale = skeletonGraphicComponent.MeshScale;
|
||||||
float positionScale = canvas == null ? 1f : skeletonGraphicComponent.canvas.referencePixelsPerUnit;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(boneName.stringValue)) {
|
if (string.IsNullOrEmpty(boneName.stringValue)) {
|
||||||
SpineHandles.DrawBones(transform, skeleton, positionScale);
|
SpineHandles.DrawBones(transform, skeleton, positionScale);
|
||||||
|
|||||||
@ -139,9 +139,7 @@ namespace Spine.Unity {
|
|||||||
RectTransform thisTransform = this.transform as RectTransform;
|
RectTransform thisTransform = this.transform as RectTransform;
|
||||||
if (thisTransform == null) return;
|
if (thisTransform == null) return;
|
||||||
|
|
||||||
Canvas canvas = skeletonGraphic.canvas;
|
float scale = skeletonGraphic.MeshScale;
|
||||||
if (canvas == null) canvas = skeletonGraphic.GetComponentInParent<Canvas>();
|
|
||||||
float scale = canvas != null ? canvas.referencePixelsPerUnit : 100.0f;
|
|
||||||
|
|
||||||
float additionalFlipScale = 1;
|
float additionalFlipScale = 1;
|
||||||
if (skeletonTransformIsParent) {
|
if (skeletonTransformIsParent) {
|
||||||
|
|||||||
@ -125,10 +125,7 @@ namespace Spine.Unity {
|
|||||||
int requiredCollidersCount = 0;
|
int requiredCollidersCount = 0;
|
||||||
PolygonCollider2D[] colliders = GetComponents<PolygonCollider2D>();
|
PolygonCollider2D[] colliders = GetComponents<PolygonCollider2D>();
|
||||||
if (this.gameObject.activeInHierarchy) {
|
if (this.gameObject.activeInHierarchy) {
|
||||||
Canvas canvas = skeletonGraphic.canvas;
|
float scale = skeletonGraphic.MeshScale;
|
||||||
if (canvas == null) canvas = skeletonGraphic.GetComponentInParent<Canvas>();
|
|
||||||
float scale = canvas != null ? canvas.referencePixelsPerUnit : 100.0f;
|
|
||||||
|
|
||||||
foreach (Skin skin in skeleton.Data.Skins)
|
foreach (Skin skin in skeleton.Data.Skins)
|
||||||
AddCollidersForSkin(skin, slotIndex, colliders, scale, ref requiredCollidersCount);
|
AddCollidersForSkin(skin, slotIndex, colliders, scale, ref requiredCollidersCount);
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,7 @@ namespace Spine.Unity {
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
AnimationState animationState;
|
AnimationState animationState;
|
||||||
Canvas canvas;
|
SkeletonGraphic skeletonGraphic;
|
||||||
|
|
||||||
public override Vector2 GetRemainingRootMotion (int trackIndex) {
|
public override Vector2 GetRemainingRootMotion (int trackIndex) {
|
||||||
TrackEntry track = animationState.GetCurrent(trackIndex);
|
TrackEntry track = animationState.GetCurrent(trackIndex);
|
||||||
@ -79,7 +79,7 @@ namespace Spine.Unity {
|
|||||||
|
|
||||||
protected override float AdditionalScale {
|
protected override float AdditionalScale {
|
||||||
get {
|
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;
|
IAnimationStateComponent animstateComponent = skeletonComponent as IAnimationStateComponent;
|
||||||
this.animationState = (animstateComponent != null) ? animstateComponent.AnimationState : null;
|
this.animationState = (animstateComponent != null) ? animstateComponent.AnimationState : null;
|
||||||
|
|
||||||
if (this.GetComponent<CanvasRenderer>() != null) {
|
skeletonGraphic = this.GetComponent<SkeletonGraphic>();
|
||||||
canvas = this.GetComponentInParent<Canvas>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Vector2 CalculateAnimationsMovementDelta () {
|
protected override Vector2 CalculateAnimationsMovementDelta () {
|
||||||
|
|||||||
@ -483,7 +483,6 @@ namespace Spine.Unity {
|
|||||||
|
|
||||||
int GetConstraintLastPosIndex (int constraintIndex) {
|
int GetConstraintLastPosIndex (int constraintIndex) {
|
||||||
ExposedList<TransformConstraint> constraints = skeletonComponent.Skeleton.TransformConstraints;
|
ExposedList<TransformConstraint> constraints = skeletonComponent.Skeleton.TransformConstraints;
|
||||||
TransformConstraint targetConstraint = constraints.Items[constraintIndex];
|
|
||||||
return transformConstraintIndices.FindIndex(addedIndex => addedIndex == constraintIndex);
|
return transformConstraintIndices.FindIndex(addedIndex => addedIndex == constraintIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -157,14 +157,13 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canvas != null) {
|
if (skeletonGraphic != null) {
|
||||||
positionScale = canvas.referencePixelsPerUnit;
|
positionScale = skeletonGraphic.MeshScale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HideInInspector] public SkeletonRenderer skeletonRenderer;
|
[HideInInspector] public SkeletonRenderer skeletonRenderer;
|
||||||
[HideInInspector] public SkeletonGraphic skeletonGraphic;
|
[HideInInspector] public SkeletonGraphic skeletonGraphic;
|
||||||
private Canvas canvas;
|
|
||||||
[System.NonSerialized] public ISkeletonAnimation skeletonAnimation;
|
[System.NonSerialized] public ISkeletonAnimation skeletonAnimation;
|
||||||
|
|
||||||
private ISkeletonComponent skeletonComponent;
|
private ISkeletonComponent skeletonComponent;
|
||||||
@ -233,11 +232,6 @@ namespace Spine.Unity {
|
|||||||
} else if (skeletonGraphic != null) {
|
} else if (skeletonGraphic != null) {
|
||||||
skeletonGraphic.OnRebuild -= HandleRendererReset;
|
skeletonGraphic.OnRebuild -= HandleRendererReset;
|
||||||
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) {
|
if (skeletonAnimation != null) {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "com.esotericsoftware.spine.spine-unity",
|
"name": "com.esotericsoftware.spine.spine-unity",
|
||||||
"displayName": "spine-unity Runtime",
|
"displayName": "spine-unity Runtime",
|
||||||
"description": "This plugin provides the spine-unity runtime core.",
|
"description": "This plugin provides the spine-unity runtime core.",
|
||||||
"version": "4.1.24",
|
"version": "4.1.25",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user