[unity] Adapted spine-unity to commit 73fc786 "Made Skeleton.scaleX/scaleY private".

This commit is contained in:
Harald Csaszar 2019-06-24 15:21:28 +02:00
parent 73fc7867d8
commit bad82f81be
9 changed files with 20 additions and 20 deletions

View File

@ -177,7 +177,7 @@ namespace Spine.Unity {
}
Vector3 localScale = followLocalScale ? new Vector3(bone.scaleX, bone.scaleY, 1f) : new Vector3(1f, 1f, 1f);
if (followSkeletonFlip) localScale.y *= Mathf.Sign(bone.skeleton.scaleX * bone.skeleton.scaleY);
if (followSkeletonFlip) localScale.y *= Mathf.Sign(bone.skeleton.ScaleX * bone.skeleton.ScaleY);
thisTransform.localScale = localScale;
}
}

View File

@ -150,7 +150,7 @@ namespace Spine.Unity {
if (followSkeletonFlip) {
Vector3 localScale = thisTransform.localScale;
localScale.y = Mathf.Abs(localScale.y) * Mathf.Sign(bone.skeleton.scaleX * bone.skeleton.scaleY);
localScale.y = Mathf.Abs(localScale.y) * Mathf.Sign(bone.skeleton.ScaleX * bone.skeleton.ScaleY);
thisTransform.localScale = localScale;
}
}

View File

@ -291,8 +291,8 @@ namespace Spine.Unity {
rendererBuffers.Initialize();
skeleton = new Skeleton(skeletonData) {
scaleX = initialFlipX ? -1 : 1,
scaleY = initialFlipY ? -1 : 1
ScaleX = initialFlipX ? -1 : 1,
ScaleY = initialFlipY ? -1 : 1
};
if (!string.IsNullOrEmpty(initialSkinName) && !string.Equals(initialSkinName, "default", System.StringComparison.Ordinal))

View File

@ -159,7 +159,7 @@ namespace Spine.Unity {
}
Vector3 localScale = followLocalScale ? new Vector3(bone.scaleX, bone.scaleY, 1f) : new Vector3(1f, 1f, 1f);
if (followSkeletonFlip) localScale.y *= Mathf.Sign(bone.skeleton.scaleX * bone.skeleton.scaleY);
if (followSkeletonFlip) localScale.y *= Mathf.Sign(bone.skeleton.ScaleX * bone.skeleton.ScaleY);
thisTransform.localScale = localScale;
}

View File

@ -89,8 +89,8 @@ namespace Spine.Unity {
// Only provide visual feedback to inspector changes in Unity Editor Edit mode.
if (!Application.isPlaying) {
skeleton.scaleX = this.initialFlipX ? -1 : 1;
skeleton.scaleY = this.initialFlipY ? -1 : 1;
skeleton.ScaleX = this.initialFlipX ? -1 : 1;
skeleton.ScaleY = this.initialFlipY ? -1 : 1;
state.ClearTrack(0);
skeleton.SetToSetupPose();
@ -267,8 +267,8 @@ namespace Spine.Unity {
}
this.skeleton = new Skeleton(skeletonData) {
scaleX = this.initialFlipX ? -1 : 1,
scaleY = this.initialFlipY ? -1 : 1
ScaleX = this.initialFlipX ? -1 : 1,
ScaleY = this.initialFlipY ? -1 : 1
};
meshBuffers = new DoubleBuffered<MeshRendererBuffers.SmartMesh>();

View File

@ -82,14 +82,14 @@ namespace Spine.Unity.Playables {
}
if (currentInputs != 1 && 1f - totalWeight > greatestWeight) {
skeleton.scaleX = originalScaleX;
skeleton.scaleY = originalScaleY;
skeleton.ScaleX = originalScaleX;
skeleton.ScaleY = originalScaleY;
}
}
public void SetSkeletonScaleFromFlip (Skeleton skeleton, bool flipX, bool flipY) {
skeleton.scaleX = flipX ? -baseScaleX : baseScaleX;
skeleton.scaleY = flipY ? -baseScaleY : baseScaleY;
skeleton.ScaleX = flipX ? -baseScaleX : baseScaleX;
skeleton.ScaleY = flipY ? -baseScaleY : baseScaleY;
}
public override void OnGraphStop (Playable playable) {
@ -99,8 +99,8 @@ namespace Spine.Unity.Playables {
return;
var skeleton = playableHandle.Skeleton;
skeleton.scaleX = originalScaleX;
skeleton.scaleY = originalScaleY;
skeleton.ScaleX = originalScaleX;
skeleton.ScaleY = originalScaleY;
}
}

View File

@ -100,8 +100,8 @@ namespace Spine.Unity {
#region Skeleton
/// <summary>Sets the Skeleton's local scale using a UnityEngine.Vector2. If only individual components need to be set, set Skeleton.ScaleX or Skeleton.ScaleY.</summary>
public static void SetLocalScale (this Skeleton skeleton, Vector2 scale) {
skeleton.scaleX = scale.x;
skeleton.scaleY = scale.y;
skeleton.ScaleX = scale.x;
skeleton.ScaleY = scale.y;
}
/// <summary>Gets the internal bone matrix as a Unity bonespace-to-skeletonspace transformation matrix.</summary>
@ -171,7 +171,7 @@ namespace Spine.Unity {
/// <summary>Returns the Skeleton's local scale as a UnityEngine.Vector2. If only individual components are needed, use Skeleton.ScaleX or Skeleton.ScaleY.</summary>
public static Vector2 GetLocalScale (this Skeleton skeleton) {
return new Vector2(skeleton.scaleX, skeleton.scaleY);
return new Vector2(skeleton.ScaleX, skeleton.ScaleY);
}
/// <summary>Calculates a 2x2 Transformation Matrix that can convert a skeleton-space position to a bone-local position.</summary>

View File

@ -128,7 +128,7 @@ namespace Spine.Unity {
void Update () {
var skeleton = skeletonRenderer.skeleton;
if (skeleton != null && boneRoot != null) {
boneRoot.localScale = new Vector3(skeleton.scaleX, skeleton.scaleY, 1f);
boneRoot.localScale = new Vector3(skeleton.ScaleX, skeleton.ScaleY, 1f);
}
}

View File

@ -121,7 +121,7 @@ namespace Spine.Unity {
}
var thisTransform = cachedTransform;
float skeletonFlipRotation = Mathf.Sign(skeleton.scaleX * skeleton.scaleY);
float skeletonFlipRotation = Mathf.Sign(skeleton.ScaleX * skeleton.ScaleY);
if (mode == Mode.Follow) {
switch (phase) {
case UpdatePhase.Local: