mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge branch '3.8' into 3.9-beta
This commit is contained in:
commit
69f78b03e1
@ -121,6 +121,8 @@ void spBone_updateWorldTransformWith (spBone* self, float x, float y, float rota
|
|||||||
float prx, rx, ry, la, lb, lc, ld;
|
float prx, rx, ry, la, lb, lc, ld;
|
||||||
if (s > 0.0001f) {
|
if (s > 0.0001f) {
|
||||||
s = ABS(pa * pd - pb * pc) / s;
|
s = ABS(pa * pd - pb * pc) / s;
|
||||||
|
pa /= self->skeleton->scaleX;
|
||||||
|
pc /= self->skeleton->scaleY;
|
||||||
pb = pc * s;
|
pb = pc * s;
|
||||||
pd = pa * s;
|
pd = pa * s;
|
||||||
prx = ATAN2(pc, pa) * RAD_DEG;
|
prx = ATAN2(pc, pa) * RAD_DEG;
|
||||||
@ -139,7 +141,7 @@ void spBone_updateWorldTransformWith (spBone* self, float x, float y, float rota
|
|||||||
CONST_CAST(float, self->b) = pa * lb - pb * ld;
|
CONST_CAST(float, self->b) = pa * lb - pb * ld;
|
||||||
CONST_CAST(float, self->c) = pc * la + pd * lc;
|
CONST_CAST(float, self->c) = pc * la + pd * lc;
|
||||||
CONST_CAST(float, self->d) = pc * lb + pd * ld;
|
CONST_CAST(float, self->d) = pc * lb + pd * ld;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
case SP_TRANSFORMMODE_NOSCALE:
|
case SP_TRANSFORMMODE_NOSCALE:
|
||||||
case SP_TRANSFORMMODE_NOSCALEORREFLECTION: {
|
case SP_TRANSFORMMODE_NOSCALEORREFLECTION: {
|
||||||
|
|||||||
@ -150,6 +150,8 @@ void Bone::updateWorldTransform(float x, float y, float rotation, float scaleX,
|
|||||||
float prx, rx, ry, la, lb, lc, ld;
|
float prx, rx, ry, la, lb, lc, ld;
|
||||||
if (s > 0.0001f) {
|
if (s > 0.0001f) {
|
||||||
s = MathUtil::abs(pa * pd - pb * pc) / s;
|
s = MathUtil::abs(pa * pd - pb * pc) / s;
|
||||||
|
pa /= _skeleton.getScaleX();
|
||||||
|
pc /= _skeleton.getScaleY();
|
||||||
pb = pc * s;
|
pb = pc * s;
|
||||||
pd = pa * s;
|
pd = pa * s;
|
||||||
prx = MathUtil::atan2(pc, pa) * MathUtil::Rad_Deg;
|
prx = MathUtil::atan2(pc, pa) * MathUtil::Rad_Deg;
|
||||||
@ -168,7 +170,7 @@ void Bone::updateWorldTransform(float x, float y, float rotation, float scaleX,
|
|||||||
_b = pa * lb - pb * ld;
|
_b = pa * lb - pb * ld;
|
||||||
_c = pc * la + pd * lc;
|
_c = pc * la + pd * lc;
|
||||||
_d = pc * lb + pd * ld;
|
_d = pc * lb + pd * ld;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
case TransformMode_NoScale:
|
case TransformMode_NoScale:
|
||||||
case TransformMode_NoScaleOrReflection: {
|
case TransformMode_NoScaleOrReflection: {
|
||||||
|
|||||||
@ -189,6 +189,8 @@ namespace Spine {
|
|||||||
float s = pa * pa + pc * pc, prx;
|
float s = pa * pa + pc * pc, prx;
|
||||||
if (s > 0.0001f) {
|
if (s > 0.0001f) {
|
||||||
s = Math.Abs(pa * pd - pb * pc) / s;
|
s = Math.Abs(pa * pd - pb * pc) / s;
|
||||||
|
pa /= skeleton.ScaleX;
|
||||||
|
pc /= skeleton.ScaleY;
|
||||||
pb = pc * s;
|
pb = pc * s;
|
||||||
pd = pa * s;
|
pd = pa * s;
|
||||||
prx = MathUtils.Atan2(pc, pa) * MathUtils.RadDeg;
|
prx = MathUtils.Atan2(pc, pa) * MathUtils.RadDeg;
|
||||||
@ -207,7 +209,7 @@ namespace Spine {
|
|||||||
b = pa * lb - pb * ld;
|
b = pa * lb - pb * ld;
|
||||||
c = pc * la + pd * lc;
|
c = pc * la + pd * lc;
|
||||||
d = pc * lb + pd * ld;
|
d = pc * lb + pd * ld;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
case TransformMode.NoScale:
|
case TransformMode.NoScale:
|
||||||
case TransformMode.NoScaleOrReflection: {
|
case TransformMode.NoScaleOrReflection: {
|
||||||
|
|||||||
@ -150,6 +150,8 @@ public class Bone implements Updatable {
|
|||||||
float s = pa * pa + pc * pc, prx;
|
float s = pa * pa + pc * pc, prx;
|
||||||
if (s > 0.0001f) {
|
if (s > 0.0001f) {
|
||||||
s = Math.abs(pa * pd - pb * pc) / s;
|
s = Math.abs(pa * pd - pb * pc) / s;
|
||||||
|
pa /= skeleton.scaleX;
|
||||||
|
pc /= skeleton.scaleY;
|
||||||
pb = pc * s;
|
pb = pc * s;
|
||||||
pd = pa * s;
|
pd = pa * s;
|
||||||
prx = atan2(pc, pa) * radDeg;
|
prx = atan2(pc, pa) * radDeg;
|
||||||
@ -168,7 +170,7 @@ public class Bone implements Updatable {
|
|||||||
b = pa * lb - pb * ld;
|
b = pa * lb - pb * ld;
|
||||||
c = pc * la + pd * lc;
|
c = pc * la + pd * lc;
|
||||||
d = pc * lb + pd * ld;
|
d = pc * lb + pd * ld;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
case noScale:
|
case noScale:
|
||||||
case noScaleOrReflection: {
|
case noScaleOrReflection: {
|
||||||
|
|||||||
@ -2564,6 +2564,8 @@ var spine;
|
|||||||
var prx = 0;
|
var prx = 0;
|
||||||
if (s > 0.0001) {
|
if (s > 0.0001) {
|
||||||
s = Math.abs(pa * pd - pb * pc) / s;
|
s = Math.abs(pa * pd - pb * pc) / s;
|
||||||
|
pa /= this.skeleton.scaleX;
|
||||||
|
pc /= this.skeleton.scaleY;
|
||||||
pb = pc * s;
|
pb = pc * s;
|
||||||
pd = pa * s;
|
pd = pa * s;
|
||||||
prx = Math.atan2(pc, pa) * spine.MathUtils.radDeg;
|
prx = Math.atan2(pc, pa) * spine.MathUtils.radDeg;
|
||||||
@ -2583,7 +2585,7 @@ var spine;
|
|||||||
this.b = pa * lb - pb * ld;
|
this.b = pa * lb - pb * ld;
|
||||||
this.c = pc * la + pd * lc;
|
this.c = pc * la + pd * lc;
|
||||||
this.d = pc * lb + pd * ld;
|
this.d = pc * lb + pd * ld;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
case spine.TransformMode.NoScale:
|
case spine.TransformMode.NoScale:
|
||||||
case spine.TransformMode.NoScaleOrReflection: {
|
case spine.TransformMode.NoScaleOrReflection: {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -2564,6 +2564,8 @@ var spine;
|
|||||||
var prx = 0;
|
var prx = 0;
|
||||||
if (s > 0.0001) {
|
if (s > 0.0001) {
|
||||||
s = Math.abs(pa * pd - pb * pc) / s;
|
s = Math.abs(pa * pd - pb * pc) / s;
|
||||||
|
pa /= this.skeleton.scaleX;
|
||||||
|
pc /= this.skeleton.scaleY;
|
||||||
pb = pc * s;
|
pb = pc * s;
|
||||||
pd = pa * s;
|
pd = pa * s;
|
||||||
prx = Math.atan2(pc, pa) * spine.MathUtils.radDeg;
|
prx = Math.atan2(pc, pa) * spine.MathUtils.radDeg;
|
||||||
@ -2583,7 +2585,7 @@ var spine;
|
|||||||
this.b = pa * lb - pb * ld;
|
this.b = pa * lb - pb * ld;
|
||||||
this.c = pc * la + pd * lc;
|
this.c = pc * la + pd * lc;
|
||||||
this.d = pc * lb + pd * ld;
|
this.d = pc * lb + pd * ld;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
case spine.TransformMode.NoScale:
|
case spine.TransformMode.NoScale:
|
||||||
case spine.TransformMode.NoScaleOrReflection: {
|
case spine.TransformMode.NoScaleOrReflection: {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -2564,6 +2564,8 @@ var spine;
|
|||||||
var prx = 0;
|
var prx = 0;
|
||||||
if (s > 0.0001) {
|
if (s > 0.0001) {
|
||||||
s = Math.abs(pa * pd - pb * pc) / s;
|
s = Math.abs(pa * pd - pb * pc) / s;
|
||||||
|
pa /= this.skeleton.scaleX;
|
||||||
|
pc /= this.skeleton.scaleY;
|
||||||
pb = pc * s;
|
pb = pc * s;
|
||||||
pd = pa * s;
|
pd = pa * s;
|
||||||
prx = Math.atan2(pc, pa) * spine.MathUtils.radDeg;
|
prx = Math.atan2(pc, pa) * spine.MathUtils.radDeg;
|
||||||
@ -2583,7 +2585,7 @@ var spine;
|
|||||||
this.b = pa * lb - pb * ld;
|
this.b = pa * lb - pb * ld;
|
||||||
this.c = pc * la + pd * lc;
|
this.c = pc * la + pd * lc;
|
||||||
this.d = pc * lb + pd * ld;
|
this.d = pc * lb + pd * ld;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
case spine.TransformMode.NoScale:
|
case spine.TransformMode.NoScale:
|
||||||
case spine.TransformMode.NoScaleOrReflection: {
|
case spine.TransformMode.NoScaleOrReflection: {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -2564,6 +2564,8 @@ var spine;
|
|||||||
var prx = 0;
|
var prx = 0;
|
||||||
if (s > 0.0001) {
|
if (s > 0.0001) {
|
||||||
s = Math.abs(pa * pd - pb * pc) / s;
|
s = Math.abs(pa * pd - pb * pc) / s;
|
||||||
|
pa /= this.skeleton.scaleX;
|
||||||
|
pc /= this.skeleton.scaleY;
|
||||||
pb = pc * s;
|
pb = pc * s;
|
||||||
pd = pa * s;
|
pd = pa * s;
|
||||||
prx = Math.atan2(pc, pa) * spine.MathUtils.radDeg;
|
prx = Math.atan2(pc, pa) * spine.MathUtils.radDeg;
|
||||||
@ -2583,7 +2585,7 @@ var spine;
|
|||||||
this.b = pa * lb - pb * ld;
|
this.b = pa * lb - pb * ld;
|
||||||
this.c = pc * la + pd * lc;
|
this.c = pc * la + pd * lc;
|
||||||
this.d = pc * lb + pd * ld;
|
this.d = pc * lb + pd * ld;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
case spine.TransformMode.NoScale:
|
case spine.TransformMode.NoScale:
|
||||||
case spine.TransformMode.NoScaleOrReflection: {
|
case spine.TransformMode.NoScaleOrReflection: {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -2564,6 +2564,8 @@ var spine;
|
|||||||
var prx = 0;
|
var prx = 0;
|
||||||
if (s > 0.0001) {
|
if (s > 0.0001) {
|
||||||
s = Math.abs(pa * pd - pb * pc) / s;
|
s = Math.abs(pa * pd - pb * pc) / s;
|
||||||
|
pa /= this.skeleton.scaleX;
|
||||||
|
pc /= this.skeleton.scaleY;
|
||||||
pb = pc * s;
|
pb = pc * s;
|
||||||
pd = pa * s;
|
pd = pa * s;
|
||||||
prx = Math.atan2(pc, pa) * spine.MathUtils.radDeg;
|
prx = Math.atan2(pc, pa) * spine.MathUtils.radDeg;
|
||||||
@ -2583,7 +2585,7 @@ var spine;
|
|||||||
this.b = pa * lb - pb * ld;
|
this.b = pa * lb - pb * ld;
|
||||||
this.c = pc * la + pd * lc;
|
this.c = pc * la + pd * lc;
|
||||||
this.d = pc * lb + pd * ld;
|
this.d = pc * lb + pd * ld;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
case spine.TransformMode.NoScale:
|
case spine.TransformMode.NoScale:
|
||||||
case spine.TransformMode.NoScaleOrReflection: {
|
case spine.TransformMode.NoScaleOrReflection: {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -2564,6 +2564,8 @@ var spine;
|
|||||||
var prx = 0;
|
var prx = 0;
|
||||||
if (s > 0.0001) {
|
if (s > 0.0001) {
|
||||||
s = Math.abs(pa * pd - pb * pc) / s;
|
s = Math.abs(pa * pd - pb * pc) / s;
|
||||||
|
pa /= this.skeleton.scaleX;
|
||||||
|
pc /= this.skeleton.scaleY;
|
||||||
pb = pc * s;
|
pb = pc * s;
|
||||||
pd = pa * s;
|
pd = pa * s;
|
||||||
prx = Math.atan2(pc, pa) * spine.MathUtils.radDeg;
|
prx = Math.atan2(pc, pa) * spine.MathUtils.radDeg;
|
||||||
@ -2583,7 +2585,7 @@ var spine;
|
|||||||
this.b = pa * lb - pb * ld;
|
this.b = pa * lb - pb * ld;
|
||||||
this.c = pc * la + pd * lc;
|
this.c = pc * la + pd * lc;
|
||||||
this.d = pc * lb + pd * ld;
|
this.d = pc * lb + pd * ld;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
case spine.TransformMode.NoScale:
|
case spine.TransformMode.NoScale:
|
||||||
case spine.TransformMode.NoScaleOrReflection: {
|
case spine.TransformMode.NoScaleOrReflection: {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -201,6 +201,8 @@ module spine {
|
|||||||
let prx = 0;
|
let prx = 0;
|
||||||
if (s > 0.0001) {
|
if (s > 0.0001) {
|
||||||
s = Math.abs(pa * pd - pb * pc) / s;
|
s = Math.abs(pa * pd - pb * pc) / s;
|
||||||
|
pa /= this.skeleton.scaleX;
|
||||||
|
pc /= this.skeleton.scaleY;
|
||||||
pb = pc * s;
|
pb = pc * s;
|
||||||
pd = pa * s;
|
pd = pa * s;
|
||||||
prx = Math.atan2(pc, pa) * MathUtils.radDeg;
|
prx = Math.atan2(pc, pa) * MathUtils.radDeg;
|
||||||
@ -219,7 +221,7 @@ module spine {
|
|||||||
this.b = pa * lb - pb * ld;
|
this.b = pa * lb - pb * ld;
|
||||||
this.c = pc * la + pd * lc;
|
this.c = pc * la + pd * lc;
|
||||||
this.d = pc * lb + pd * ld;
|
this.d = pc * lb + pd * ld;
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
case TransformMode.NoScale:
|
case TransformMode.NoScale:
|
||||||
case TransformMode.NoScaleOrReflection: {
|
case TransformMode.NoScaleOrReflection: {
|
||||||
|
|||||||
@ -73,6 +73,11 @@ namespace Spine.Unity.Examples {
|
|||||||
collectedSkin.AddSkin(equipsSkin);
|
collectedSkin.AddSkin(equipsSkin);
|
||||||
|
|
||||||
// 2. Create a repacked skin.
|
// 2. Create a repacked skin.
|
||||||
|
// Note: materials and textures returned by GetRepackedSkin() behave like 'new Texture2D()' and need to be destroyed
|
||||||
|
if (runtimeMaterial)
|
||||||
|
Destroy(runtimeMaterial);
|
||||||
|
if (runtimeAtlas)
|
||||||
|
Destroy(runtimeAtlas);
|
||||||
var repackedSkin = collectedSkin.GetRepackedSkin("Repacked skin", skeletonAnimation.SkeletonDataAsset.atlasAssets[0].PrimaryMaterial, out runtimeMaterial, out runtimeAtlas);
|
var repackedSkin = collectedSkin.GetRepackedSkin("Repacked skin", skeletonAnimation.SkeletonDataAsset.atlasAssets[0].PrimaryMaterial, out runtimeMaterial, out runtimeAtlas);
|
||||||
collectedSkin.Clear();
|
collectedSkin.Clear();
|
||||||
|
|
||||||
|
|||||||
@ -121,6 +121,11 @@ namespace Spine.Unity.Examples {
|
|||||||
var repackedSkin = new Skin("repacked skin");
|
var repackedSkin = new Skin("repacked skin");
|
||||||
repackedSkin.AddSkin(skeleton.Data.DefaultSkin); // Include the "default" skin. (everything outside of skin placeholders)
|
repackedSkin.AddSkin(skeleton.Data.DefaultSkin); // Include the "default" skin. (everything outside of skin placeholders)
|
||||||
repackedSkin.AddSkin(customSkin); // Include your new custom skin.
|
repackedSkin.AddSkin(customSkin); // Include your new custom skin.
|
||||||
|
// Note: materials and textures returned by GetRepackedSkin() behave like 'new Texture2D()' and need to be destroyed
|
||||||
|
if (runtimeMaterial)
|
||||||
|
Destroy(runtimeMaterial);
|
||||||
|
if (runtimeAtlas)
|
||||||
|
Destroy(runtimeAtlas);
|
||||||
repackedSkin = repackedSkin.GetRepackedSkin("repacked skin", sourceMaterial, out runtimeMaterial, out runtimeAtlas); // Pack all the items in the skin.
|
repackedSkin = repackedSkin.GetRepackedSkin("repacked skin", sourceMaterial, out runtimeMaterial, out runtimeAtlas); // Pack all the items in the skin.
|
||||||
skeleton.SetSkin(repackedSkin); // Assign the repacked skin to your Skeleton.
|
skeleton.SetSkin(repackedSkin); // Assign the repacked skin to your Skeleton.
|
||||||
if (bbFollower != null) bbFollower.Initialize(true);
|
if (bbFollower != null) bbFollower.Initialize(true);
|
||||||
|
|||||||
@ -119,6 +119,11 @@ namespace Spine.Unity.Examples {
|
|||||||
var repackedSkin = new Skin("repacked skin");
|
var repackedSkin = new Skin("repacked skin");
|
||||||
repackedSkin.AddSkin(skeleton.Data.DefaultSkin);
|
repackedSkin.AddSkin(skeleton.Data.DefaultSkin);
|
||||||
repackedSkin.AddSkin(customSkin);
|
repackedSkin.AddSkin(customSkin);
|
||||||
|
// Note: materials and textures returned by GetRepackedSkin() behave like 'new Texture2D()' and need to be destroyed
|
||||||
|
if (runtimeMaterial)
|
||||||
|
Destroy(runtimeMaterial);
|
||||||
|
if (runtimeAtlas)
|
||||||
|
Destroy(runtimeAtlas);
|
||||||
repackedSkin = repackedSkin.GetRepackedSkin("repacked skin", sourceMaterial, out runtimeMaterial, out runtimeAtlas);
|
repackedSkin = repackedSkin.GetRepackedSkin("repacked skin", sourceMaterial, out runtimeMaterial, out runtimeAtlas);
|
||||||
skeleton.SetSkin(repackedSkin);
|
skeleton.SetSkin(repackedSkin);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -68,6 +68,7 @@ namespace Spine.Unity.Examples {
|
|||||||
public int colliderLayer = 0;
|
public int colliderLayer = 0;
|
||||||
[Range(0, 1)]
|
[Range(0, 1)]
|
||||||
public float mix = 1;
|
public float mix = 1;
|
||||||
|
public bool oldRagdollBehaviour = true;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
ISkeletonAnimation targetSkeletonComponent;
|
ISkeletonAnimation targetSkeletonComponent;
|
||||||
@ -322,6 +323,12 @@ namespace Spine.Unity.Examples {
|
|||||||
var t = pair.Value;
|
var t = pair.Value;
|
||||||
bool isStartingBone = b == StartingBone;
|
bool isStartingBone = b == StartingBone;
|
||||||
Transform parentTransform = isStartingBone ? ragdollRoot : boneTable[b.Parent];
|
Transform parentTransform = isStartingBone ? ragdollRoot : boneTable[b.Parent];
|
||||||
|
if (!oldRagdollBehaviour && isStartingBone) {
|
||||||
|
if (b != skeleton.RootBone) { // RagdollRoot is not skeleton root.
|
||||||
|
ragdollRoot.localPosition = new Vector3(b.Parent.WorldX, b.Parent.WorldY, 0);
|
||||||
|
ragdollRoot.localRotation = Quaternion.Euler(0, 0, GetPropagatedRotation(b.Parent));
|
||||||
|
}
|
||||||
|
}
|
||||||
Vector3 parentTransformWorldPosition = parentTransform.position;
|
Vector3 parentTransformWorldPosition = parentTransform.position;
|
||||||
Quaternion parentTransformWorldRotation = parentTransform.rotation;
|
Quaternion parentTransformWorldRotation = parentTransform.rotation;
|
||||||
|
|
||||||
|
|||||||
@ -71,6 +71,7 @@ namespace Spine.Unity.Examples {
|
|||||||
public int colliderLayer = 0;
|
public int colliderLayer = 0;
|
||||||
[Range(0, 1)]
|
[Range(0, 1)]
|
||||||
public float mix = 1;
|
public float mix = 1;
|
||||||
|
public bool oldRagdollBehaviour = true;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
ISkeletonAnimation targetSkeletonComponent;
|
ISkeletonAnimation targetSkeletonComponent;
|
||||||
@ -338,6 +339,13 @@ namespace Spine.Unity.Examples {
|
|||||||
var t = pair.Value;
|
var t = pair.Value;
|
||||||
bool isStartingBone = (b == startingBone);
|
bool isStartingBone = (b == startingBone);
|
||||||
Transform parentTransform = isStartingBone ? ragdollRoot : boneTable[b.Parent];
|
Transform parentTransform = isStartingBone ? ragdollRoot : boneTable[b.Parent];
|
||||||
|
if (!oldRagdollBehaviour && isStartingBone) {
|
||||||
|
if (b != skeleton.RootBone) { // RagdollRoot is not skeleton root.
|
||||||
|
ragdollRoot.localPosition = new Vector3(b.Parent.WorldX, b.Parent.WorldY, 0);
|
||||||
|
ragdollRoot.localRotation = Quaternion.Euler(0, 0, GetPropagatedRotation(b.Parent));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Vector3 parentTransformWorldPosition = parentTransform.position;
|
Vector3 parentTransformWorldPosition = parentTransform.position;
|
||||||
Quaternion parentTransformWorldRotation = parentTransform.rotation;
|
Quaternion parentTransformWorldRotation = parentTransform.rotation;
|
||||||
|
|
||||||
|
|||||||
@ -213,14 +213,18 @@ namespace Spine.Unity {
|
|||||||
for (int c = 0; c < clipInfoCount; c++) {
|
for (int c = 0; c < clipInfoCount; c++) {
|
||||||
var info = clipInfo[c];
|
var info = clipInfo[c];
|
||||||
float weight = info.weight * layerWeight; if (weight == 0) continue;
|
float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
previousAnimations.Add(GetAnimation(info.clip));
|
var clip = GetAnimation(info.clip);
|
||||||
|
if (clip != null)
|
||||||
|
previousAnimations.Add(clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasNext) {
|
if (hasNext) {
|
||||||
for (int c = 0; c < nextClipInfoCount; c++) {
|
for (int c = 0; c < nextClipInfoCount; c++) {
|
||||||
var info = nextClipInfo[c];
|
var info = nextClipInfo[c];
|
||||||
float weight = info.weight * layerWeight; if (weight == 0) continue;
|
float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
previousAnimations.Add(GetAnimation(info.clip));
|
var clip = GetAnimation(info.clip);
|
||||||
|
if (clip != null)
|
||||||
|
previousAnimations.Add(clip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +234,9 @@ namespace Spine.Unity {
|
|||||||
var info = interruptingClipInfo[c];
|
var info = interruptingClipInfo[c];
|
||||||
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
||||||
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
||||||
previousAnimations.Add(GetAnimation(info.clip));
|
var clip = GetAnimation(info.clip);
|
||||||
|
if (clip != null)
|
||||||
|
previousAnimations.Add(clip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,12 +267,16 @@ namespace Spine.Unity {
|
|||||||
// Always use Mix instead of Applying the first non-zero weighted clip.
|
// Always use Mix instead of Applying the first non-zero weighted clip.
|
||||||
for (int c = 0; c < clipInfoCount; c++) {
|
for (int c = 0; c < clipInfoCount; c++) {
|
||||||
var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
var clip = GetAnimation(info.clip);
|
||||||
|
if (clip != null)
|
||||||
|
clip.Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
||||||
}
|
}
|
||||||
if (hasNext) {
|
if (hasNext) {
|
||||||
for (int c = 0; c < nextClipInfoCount; c++) {
|
for (int c = 0; c < nextClipInfoCount; c++) {
|
||||||
var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
var clip = GetAnimation(info.clip);
|
||||||
|
if (clip != null)
|
||||||
|
clip.Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isInterruptionActive) {
|
if (isInterruptionActive) {
|
||||||
@ -275,7 +285,9 @@ namespace Spine.Unity {
|
|||||||
var info = interruptingClipInfo[c];
|
var info = interruptingClipInfo[c];
|
||||||
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
||||||
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0),
|
var clip = GetAnimation(info.clip);
|
||||||
|
if (clip != null)
|
||||||
|
clip.Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0),
|
||||||
interruptingStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
interruptingStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -284,13 +296,17 @@ namespace Spine.Unity {
|
|||||||
int c = 0;
|
int c = 0;
|
||||||
for (; c < clipInfoCount; c++) {
|
for (; c < clipInfoCount; c++) {
|
||||||
var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, 1f, layerBlendMode, MixDirection.In);
|
var clip = GetAnimation(info.clip);
|
||||||
|
if (clip != null)
|
||||||
|
clip.Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, 1f, layerBlendMode, MixDirection.In);
|
||||||
++c; break;
|
++c; break;
|
||||||
}
|
}
|
||||||
// Mix the rest
|
// Mix the rest
|
||||||
for (; c < clipInfoCount; c++) {
|
for (; c < clipInfoCount; c++) {
|
||||||
var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
var info = clipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
var clip = GetAnimation(info.clip);
|
||||||
|
if (clip != null)
|
||||||
|
clip.Apply(skeleton, 0, AnimationTime(stateInfo.normalizedTime, info.clip.length, stateInfo.loop, stateInfo.speed < 0), stateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
||||||
}
|
}
|
||||||
|
|
||||||
c = 0;
|
c = 0;
|
||||||
@ -299,14 +315,18 @@ namespace Spine.Unity {
|
|||||||
if (mode == MixMode.Hard) {
|
if (mode == MixMode.Hard) {
|
||||||
for (; c < nextClipInfoCount; c++) {
|
for (; c < nextClipInfoCount; c++) {
|
||||||
var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, 1f, layerBlendMode, MixDirection.In);
|
var clip = GetAnimation(info.clip);
|
||||||
|
if (clip != null)
|
||||||
|
clip.Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, 1f, layerBlendMode, MixDirection.In);
|
||||||
++c; break;
|
++c; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Mix the rest
|
// Mix the rest
|
||||||
for (; c < nextClipInfoCount; c++) {
|
for (; c < nextClipInfoCount; c++) {
|
||||||
var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
var info = nextClipInfo[c]; float weight = info.weight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
var clip = GetAnimation(info.clip);
|
||||||
|
if (clip != null)
|
||||||
|
clip.Apply(skeleton, 0, AnimationTime(nextStateInfo.normalizedTime, info.clip.length, nextStateInfo.speed < 0), nextStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +338,9 @@ namespace Spine.Unity {
|
|||||||
var info = interruptingClipInfo[c];
|
var info = interruptingClipInfo[c];
|
||||||
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
||||||
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0), interruptingStateInfo.loop, null, 1f, layerBlendMode, MixDirection.In);
|
var clip = GetAnimation(info.clip);
|
||||||
|
if (clip != null)
|
||||||
|
clip.Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0), interruptingStateInfo.loop, null, 1f, layerBlendMode, MixDirection.In);
|
||||||
++c; break;
|
++c; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,7 +349,9 @@ namespace Spine.Unity {
|
|||||||
var info = interruptingClipInfo[c];
|
var info = interruptingClipInfo[c];
|
||||||
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
float clipWeight = shallInterpolateWeightTo1 ? (info.weight + 1.0f) * 0.5f : info.weight;
|
||||||
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
float weight = clipWeight * layerWeight; if (weight == 0) continue;
|
||||||
GetAnimation(info.clip).Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0), interruptingStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
var clip = GetAnimation(info.clip);
|
||||||
|
if (clip != null)
|
||||||
|
clip.Apply(skeleton, 0, AnimationTime(interruptingStateInfo.normalizedTime + interruptingClipTimeAddition, info.clip.length, interruptingStateInfo.speed < 0), interruptingStateInfo.loop, null, weight, layerBlendMode, MixDirection.In);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -219,6 +219,8 @@ namespace Spine.Unity.AttachmentTools {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fills the outputAttachments list with new attachment objects based on the attachments in sourceAttachments,
|
/// Fills the outputAttachments list with new attachment objects based on the attachments in sourceAttachments,
|
||||||
/// but mapped to a new single texture using the same material.</summary>
|
/// but mapped to a new single texture using the same material.</summary>
|
||||||
|
/// <remarks>Returned <c>Material</c> and <c>Texture</c> behave like <c>new Texture2D()</c>, thus you need to call <c>Destroy()</c>
|
||||||
|
/// to free resources.</remarks>
|
||||||
/// <param name="sourceAttachments">The list of attachments to be repacked.</param>
|
/// <param name="sourceAttachments">The list of attachments to be repacked.</param>
|
||||||
/// <param name = "outputAttachments">The List(Attachment) to populate with the newly created Attachment objects.
|
/// <param name = "outputAttachments">The List(Attachment) to populate with the newly created Attachment objects.
|
||||||
/// May be equal to <c>sourceAttachments</c> for in-place operation.</param>
|
/// May be equal to <c>sourceAttachments</c> for in-place operation.</param>
|
||||||
@ -257,6 +259,8 @@ namespace Spine.Unity.AttachmentTools {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fills the outputAttachments list with new attachment objects based on the attachments in sourceAttachments,
|
/// Fills the outputAttachments list with new attachment objects based on the attachments in sourceAttachments,
|
||||||
/// but mapped to a new single texture using the same material.</summary>
|
/// but mapped to a new single texture using the same material.</summary>
|
||||||
|
/// <remarks>Returned <c>Material</c> and <c>Texture</c> behave like <c>new Texture2D()</c>, thus you need to call <c>Destroy()</c>
|
||||||
|
/// to free resources.</remarks>
|
||||||
/// <param name="sourceAttachments">The list of attachments to be repacked.</param>
|
/// <param name="sourceAttachments">The list of attachments to be repacked.</param>
|
||||||
/// <param name = "outputAttachments">The List(Attachment) to populate with the newly created Attachment objects.
|
/// <param name = "outputAttachments">The List(Attachment) to populate with the newly created Attachment objects.
|
||||||
/// May be equal to <c>sourceAttachments</c> for in-place operation.</param>
|
/// May be equal to <c>sourceAttachments</c> for in-place operation.</param>
|
||||||
@ -413,7 +417,9 @@ namespace Spine.Unity.AttachmentTools {
|
|||||||
/// Creates and populates a duplicate skin with cloned attachments that are backed by a new packed texture atlas
|
/// Creates and populates a duplicate skin with cloned attachments that are backed by a new packed texture atlas
|
||||||
/// comprised of all the regions from the original skin.</summary>
|
/// comprised of all the regions from the original skin.</summary>
|
||||||
/// <remarks>GetRepackedSkin is an expensive operation, preferably call it at level load time.
|
/// <remarks>GetRepackedSkin is an expensive operation, preferably call it at level load time.
|
||||||
/// No Spine.Atlas object is created so there is no way to find AtlasRegions except through the Attachments using them.</remarks>
|
/// No Spine.Atlas object is created so there is no way to find AtlasRegions except through the Attachments using them.
|
||||||
|
/// Returned <c>Material</c> and <c>Texture</c> behave like <c>new Texture2D()</c>, thus you need to call <c>Destroy()</c>
|
||||||
|
/// to free resources.</remarks>
|
||||||
/// <param name="additionalTexturePropertyIDsToCopy">Optional additional textures (such as normal maps) to copy while repacking.
|
/// <param name="additionalTexturePropertyIDsToCopy">Optional additional textures (such as normal maps) to copy while repacking.
|
||||||
/// To copy e.g. the main texture and normal maps, pass 'new int[] { Shader.PropertyToID("_BumpMap") }' at this parameter.</param>
|
/// To copy e.g. the main texture and normal maps, pass 'new int[] { Shader.PropertyToID("_BumpMap") }' at this parameter.</param>
|
||||||
/// <param name="additionalOutputTextures">When <c>additionalTexturePropertyIDsToCopy</c> is non-null,
|
/// <param name="additionalOutputTextures">When <c>additionalTexturePropertyIDsToCopy</c> is non-null,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user