|
@@ -848,7 +848,7 @@ namespace Spine.Unity.Editor {
|
|
|
|
|
|
keys.Add(new Keyframe(0, rotation, 0, 0));
|
|
keys.Add(new Keyframe(0, rotation, 0, 0));
|
|
|
|
|
|
- int listIndex = 1;
|
|
|
|
|
|
+ int listIndex = 0;
|
|
|
|
|
|
float r = rotation;
|
|
float r = rotation;
|
|
|
|
|
|
@@ -865,7 +865,7 @@ namespace Spine.Unity.Editor {
|
|
animation.Apply(skeleton, 0, currentTime, true, null, 1f, MixBlend.Setup, MixDirection.In);
|
|
animation.Apply(skeleton, 0, currentTime, true, null, 1f, MixBlend.Setup, MixDirection.In);
|
|
skeleton.UpdateWorldTransform();
|
|
skeleton.UpdateWorldTransform();
|
|
|
|
|
|
- int pIndex = listIndex - 1;
|
|
|
|
|
|
+ int pIndex = listIndex;
|
|
|
|
|
|
Keyframe pk = keys[pIndex];
|
|
Keyframe pk = keys[pIndex];
|
|
|
|
|
|
@@ -919,16 +919,16 @@ namespace Spine.Unity.Editor {
|
|
xKeys.Add(new Keyframe(timeline.Frames[0], timeline.Frames[1] + boneData.X, 0, 0));
|
|
xKeys.Add(new Keyframe(timeline.Frames[0], timeline.Frames[1] + boneData.X, 0, 0));
|
|
yKeys.Add(new Keyframe(timeline.Frames[0], timeline.Frames[2] + boneData.Y, 0, 0));
|
|
yKeys.Add(new Keyframe(timeline.Frames[0], timeline.Frames[2] + boneData.Y, 0, 0));
|
|
|
|
|
|
- int listIndex = 1;
|
|
|
|
- int frameIndex = 1;
|
|
|
|
|
|
+ int listIndex = 0;
|
|
|
|
+ int frameIndex = 0;
|
|
int f = TranslateTimeline.ENTRIES;
|
|
int f = TranslateTimeline.ENTRIES;
|
|
float[] frames = timeline.Frames;
|
|
float[] frames = timeline.Frames;
|
|
skeleton.SetToSetupPose();
|
|
skeleton.SetToSetupPose();
|
|
float lastTime = 0;
|
|
float lastTime = 0;
|
|
while (currentTime < endTime) {
|
|
while (currentTime < endTime) {
|
|
- int pIndex = listIndex - 1;
|
|
|
|
|
|
+ int pIndex = listIndex;
|
|
|
|
|
|
- float curveType = timeline.GetCurveType(frameIndex - 1);
|
|
|
|
|
|
+ float curveType = timeline.GetCurveType(frameIndex);
|
|
if (curveType == 0) {
|
|
if (curveType == 0) {
|
|
//linear
|
|
//linear
|
|
Keyframe px = xKeys[pIndex];
|
|
Keyframe px = xKeys[pIndex];
|
|
@@ -999,8 +999,8 @@ namespace Spine.Unity.Editor {
|
|
|
|
|
|
timeline.Apply(skeleton, lastTime, currentTime, null, 1, MixBlend.Setup, MixDirection.In);
|
|
timeline.Apply(skeleton, lastTime, currentTime, null, 1, MixBlend.Setup, MixDirection.In);
|
|
|
|
|
|
- px = xKeys[listIndex - 1];
|
|
|
|
- py = yKeys[listIndex - 1];
|
|
|
|
|
|
+ px = xKeys[listIndex];
|
|
|
|
+ py = yKeys[listIndex];
|
|
|
|
|
|
float xOut = (bone.X - px.value) / (currentTime - px.time);
|
|
float xOut = (bone.X - px.value) / (currentTime - px.time);
|
|
float yOut = (bone.Y - py.value) / (currentTime - py.time);
|
|
float yOut = (bone.Y - py.value) / (currentTime - py.time);
|
|
@@ -1011,8 +1011,8 @@ namespace Spine.Unity.Editor {
|
|
xKeys.Add(new Keyframe(currentTime, bone.X, xOut, 0));
|
|
xKeys.Add(new Keyframe(currentTime, bone.X, xOut, 0));
|
|
yKeys.Add(new Keyframe(currentTime, bone.Y, yOut, 0));
|
|
yKeys.Add(new Keyframe(currentTime, bone.Y, yOut, 0));
|
|
|
|
|
|
- xKeys[listIndex - 1] = px;
|
|
|
|
- yKeys[listIndex - 1] = py;
|
|
|
|
|
|
+ xKeys[listIndex] = px;
|
|
|
|
+ yKeys[listIndex] = py;
|
|
|
|
|
|
listIndex++;
|
|
listIndex++;
|
|
lastTime = currentTime;
|
|
lastTime = currentTime;
|
|
@@ -1055,16 +1055,16 @@ namespace Spine.Unity.Editor {
|
|
List<Keyframe> keys = new List<Keyframe>();
|
|
List<Keyframe> keys = new List<Keyframe>();
|
|
keys.Add(new Keyframe(timeline.Frames[0], timeline.Frames[1] + boneDataOffset, 0, 0));
|
|
keys.Add(new Keyframe(timeline.Frames[0], timeline.Frames[1] + boneDataOffset, 0, 0));
|
|
|
|
|
|
- int listIndex = 1;
|
|
|
|
- int frameIndex = 1;
|
|
|
|
|
|
+ int listIndex = 0;
|
|
|
|
+ int frameIndex = 0;
|
|
int f = TranslateXTimeline.ENTRIES;
|
|
int f = TranslateXTimeline.ENTRIES;
|
|
float[] frames = timeline.Frames;
|
|
float[] frames = timeline.Frames;
|
|
skeleton.SetToSetupPose();
|
|
skeleton.SetToSetupPose();
|
|
float lastTime = 0;
|
|
float lastTime = 0;
|
|
while (currentTime < endTime) {
|
|
while (currentTime < endTime) {
|
|
- int pIndex = listIndex - 1;
|
|
|
|
|
|
+ int pIndex = listIndex;
|
|
|
|
|
|
- float curveType = timeline.GetCurveType(frameIndex - 1);
|
|
|
|
|
|
+ float curveType = timeline.GetCurveType(frameIndex);
|
|
if (curveType == 0) {
|
|
if (curveType == 0) {
|
|
//linear
|
|
//linear
|
|
Keyframe p = keys[pIndex];
|
|
Keyframe p = keys[pIndex];
|
|
@@ -1112,13 +1112,13 @@ namespace Spine.Unity.Editor {
|
|
|
|
|
|
timeline.Apply(skeleton, lastTime, currentTime, null, 1, MixBlend.Setup, MixDirection.In);
|
|
timeline.Apply(skeleton, lastTime, currentTime, null, 1, MixBlend.Setup, MixDirection.In);
|
|
|
|
|
|
- p = keys[listIndex - 1];
|
|
|
|
|
|
+ p = keys[listIndex];
|
|
float boneOffset = isXTimeline ? bone.X : bone.Y;
|
|
float boneOffset = isXTimeline ? bone.X : bone.Y;
|
|
float valueOut = (boneOffset - p.value) / (currentTime - p.time);
|
|
float valueOut = (boneOffset - p.value) / (currentTime - p.time);
|
|
p.outTangent = valueOut;
|
|
p.outTangent = valueOut;
|
|
keys.Add(new Keyframe(currentTime, boneOffset, valueOut, 0));
|
|
keys.Add(new Keyframe(currentTime, boneOffset, valueOut, 0));
|
|
|
|
|
|
- keys[listIndex - 1] = p;
|
|
|
|
|
|
+ keys[listIndex] = p;
|
|
|
|
|
|
listIndex++;
|
|
listIndex++;
|
|
lastTime = currentTime;
|
|
lastTime = currentTime;
|
|
@@ -1155,15 +1155,15 @@ namespace Spine.Unity.Editor {
|
|
xKeys.Add(new Keyframe(timeline.Frames[0], timeline.Frames[1] * boneData.ScaleX, 0, 0));
|
|
xKeys.Add(new Keyframe(timeline.Frames[0], timeline.Frames[1] * boneData.ScaleX, 0, 0));
|
|
yKeys.Add(new Keyframe(timeline.Frames[0], timeline.Frames[2] * boneData.ScaleY, 0, 0));
|
|
yKeys.Add(new Keyframe(timeline.Frames[0], timeline.Frames[2] * boneData.ScaleY, 0, 0));
|
|
|
|
|
|
- int listIndex = 1;
|
|
|
|
- int frameIndex = 1;
|
|
|
|
|
|
+ int listIndex = 0;
|
|
|
|
+ int frameIndex = 0;
|
|
int f = ScaleTimeline.ENTRIES;
|
|
int f = ScaleTimeline.ENTRIES;
|
|
float[] frames = timeline.Frames;
|
|
float[] frames = timeline.Frames;
|
|
skeleton.SetToSetupPose();
|
|
skeleton.SetToSetupPose();
|
|
float lastTime = 0;
|
|
float lastTime = 0;
|
|
while (currentTime < endTime) {
|
|
while (currentTime < endTime) {
|
|
- int pIndex = listIndex - 1;
|
|
|
|
- float curveType = timeline.GetCurveType(frameIndex - 1);
|
|
|
|
|
|
+ int pIndex = listIndex;
|
|
|
|
+ float curveType = timeline.GetCurveType(frameIndex);
|
|
if (curveType == 0) {
|
|
if (curveType == 0) {
|
|
//linear
|
|
//linear
|
|
Keyframe px = xKeys[pIndex];
|
|
Keyframe px = xKeys[pIndex];
|
|
@@ -1234,8 +1234,8 @@ namespace Spine.Unity.Editor {
|
|
|
|
|
|
timeline.Apply(skeleton, lastTime, currentTime, null, 1, MixBlend.Setup, MixDirection.In);
|
|
timeline.Apply(skeleton, lastTime, currentTime, null, 1, MixBlend.Setup, MixDirection.In);
|
|
|
|
|
|
- px = xKeys[listIndex - 1];
|
|
|
|
- py = yKeys[listIndex - 1];
|
|
|
|
|
|
+ px = xKeys[listIndex];
|
|
|
|
+ py = yKeys[listIndex];
|
|
|
|
|
|
float xOut = (bone.ScaleX - px.value) / (currentTime - px.time);
|
|
float xOut = (bone.ScaleX - px.value) / (currentTime - px.time);
|
|
float yOut = (bone.ScaleY - py.value) / (currentTime - py.time);
|
|
float yOut = (bone.ScaleY - py.value) / (currentTime - py.time);
|
|
@@ -1246,8 +1246,8 @@ namespace Spine.Unity.Editor {
|
|
xKeys.Add(new Keyframe(currentTime, bone.ScaleX, xOut, 0));
|
|
xKeys.Add(new Keyframe(currentTime, bone.ScaleX, xOut, 0));
|
|
yKeys.Add(new Keyframe(currentTime, bone.ScaleY, yOut, 0));
|
|
yKeys.Add(new Keyframe(currentTime, bone.ScaleY, yOut, 0));
|
|
|
|
|
|
- xKeys[listIndex - 1] = px;
|
|
|
|
- yKeys[listIndex - 1] = py;
|
|
|
|
|
|
+ xKeys[listIndex] = px;
|
|
|
|
+ yKeys[listIndex] = py;
|
|
|
|
|
|
listIndex++;
|
|
listIndex++;
|
|
lastTime = currentTime;
|
|
lastTime = currentTime;
|
|
@@ -1286,15 +1286,15 @@ namespace Spine.Unity.Editor {
|
|
List<Keyframe> keys = new List<Keyframe>();
|
|
List<Keyframe> keys = new List<Keyframe>();
|
|
keys.Add(new Keyframe(timeline.Frames[0], timeline.Frames[1] * boneDataOffset, 0, 0));
|
|
keys.Add(new Keyframe(timeline.Frames[0], timeline.Frames[1] * boneDataOffset, 0, 0));
|
|
|
|
|
|
- int listIndex = 1;
|
|
|
|
- int frameIndex = 1;
|
|
|
|
|
|
+ int listIndex = 0;
|
|
|
|
+ int frameIndex = 0;
|
|
int f = ScaleXTimeline.ENTRIES;
|
|
int f = ScaleXTimeline.ENTRIES;
|
|
float[] frames = timeline.Frames;
|
|
float[] frames = timeline.Frames;
|
|
skeleton.SetToSetupPose();
|
|
skeleton.SetToSetupPose();
|
|
float lastTime = 0;
|
|
float lastTime = 0;
|
|
while (currentTime < endTime) {
|
|
while (currentTime < endTime) {
|
|
- int pIndex = listIndex - 1;
|
|
|
|
- float curveType = timeline.GetCurveType(frameIndex - 1);
|
|
|
|
|
|
+ int pIndex = listIndex;
|
|
|
|
+ float curveType = timeline.GetCurveType(frameIndex);
|
|
if (curveType == 0) {
|
|
if (curveType == 0) {
|
|
//linear
|
|
//linear
|
|
Keyframe p = keys[pIndex];
|
|
Keyframe p = keys[pIndex];
|
|
@@ -1340,14 +1340,14 @@ namespace Spine.Unity.Editor {
|
|
|
|
|
|
timeline.Apply(skeleton, lastTime, currentTime, null, 1, MixBlend.Setup, MixDirection.In);
|
|
timeline.Apply(skeleton, lastTime, currentTime, null, 1, MixBlend.Setup, MixDirection.In);
|
|
|
|
|
|
- p = keys[listIndex - 1];
|
|
|
|
|
|
+ p = keys[listIndex];
|
|
|
|
|
|
float boneScale = isXTimeline ? bone.ScaleX : bone.ScaleY;
|
|
float boneScale = isXTimeline ? bone.ScaleX : bone.ScaleY;
|
|
float valueOut = (boneScale - p.value) / (currentTime - p.time);
|
|
float valueOut = (boneScale - p.value) / (currentTime - p.time);
|
|
p.outTangent = valueOut;
|
|
p.outTangent = valueOut;
|
|
keys.Add(new Keyframe(currentTime, boneScale, valueOut, 0));
|
|
keys.Add(new Keyframe(currentTime, boneScale, valueOut, 0));
|
|
|
|
|
|
- keys[listIndex - 1] = p;
|
|
|
|
|
|
+ keys[listIndex] = p;
|
|
|
|
|
|
listIndex++;
|
|
listIndex++;
|
|
lastTime = currentTime;
|
|
lastTime = currentTime;
|
|
@@ -1382,16 +1382,16 @@ namespace Spine.Unity.Editor {
|
|
|
|
|
|
keys.Add(new Keyframe(timeline.Frames[0], rotation, 0, 0));
|
|
keys.Add(new Keyframe(timeline.Frames[0], rotation, 0, 0));
|
|
|
|
|
|
- int listIndex = 1;
|
|
|
|
- int frameIndex = 1;
|
|
|
|
|
|
+ int listIndex = 0;
|
|
|
|
+ int frameIndex = 0;
|
|
int f = 2;
|
|
int f = 2;
|
|
float[] frames = timeline.Frames;
|
|
float[] frames = timeline.Frames;
|
|
skeleton.SetToSetupPose();
|
|
skeleton.SetToSetupPose();
|
|
float lastTime = 0;
|
|
float lastTime = 0;
|
|
float angle = rotation;
|
|
float angle = rotation;
|
|
while (currentTime < endTime) {
|
|
while (currentTime < endTime) {
|
|
- int pIndex = listIndex - 1;
|
|
|
|
- float curveType = timeline.GetCurveType(frameIndex - 1);
|
|
|
|
|
|
+ int pIndex = listIndex;
|
|
|
|
+ float curveType = timeline.GetCurveType(frameIndex);
|
|
|
|
|
|
if (curveType == 0) {
|
|
if (curveType == 0) {
|
|
//linear
|
|
//linear
|
|
@@ -1464,7 +1464,7 @@ namespace Spine.Unity.Editor {
|
|
|
|
|
|
timeline.Apply(skeleton, lastTime, currentTime, null, 1, MixBlend.Setup, MixDirection.In);
|
|
timeline.Apply(skeleton, lastTime, currentTime, null, 1, MixBlend.Setup, MixDirection.In);
|
|
skeleton.UpdateWorldTransform();
|
|
skeleton.UpdateWorldTransform();
|
|
- pk = keys[listIndex - 1];
|
|
|
|
|
|
+ pk = keys[listIndex];
|
|
|
|
|
|
rotation = bone.Rotation;
|
|
rotation = bone.Rotation;
|
|
angle += Mathf.DeltaAngle(angle, rotation);
|
|
angle += Mathf.DeltaAngle(angle, rotation);
|
|
@@ -1476,7 +1476,7 @@ namespace Spine.Unity.Editor {
|
|
|
|
|
|
keys.Add(new Keyframe(currentTime, r, rOut, 0));
|
|
keys.Add(new Keyframe(currentTime, r, rOut, 0));
|
|
|
|
|
|
- keys[listIndex - 1] = pk;
|
|
|
|
|
|
+ keys[listIndex] = pk;
|
|
|
|
|
|
listIndex++;
|
|
listIndex++;
|
|
lastTime = currentTime;
|
|
lastTime = currentTime;
|
|
@@ -1582,10 +1582,7 @@ namespace Spine.Unity.Editor {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- float currentTime = timeline.Frames[0];
|
|
|
|
- float endTime = frames[frames.Length - 1];
|
|
|
|
- int f = 0;
|
|
|
|
- while (currentTime < endTime) {
|
|
|
|
|
|
+ for (int f = 0, frameCount = frames.Length; f < frameCount; ++f) {
|
|
float time = frames[f];
|
|
float time = frames[f];
|
|
|
|
|
|
int frameIndex = Search(frames, time);
|
|
int frameIndex = Search(frames, time);
|
|
@@ -1602,9 +1599,6 @@ namespace Spine.Unity.Editor {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- currentTime = time;
|
|
|
|
- f += 1;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
foreach (KeyValuePair<string, AnimationCurve> pair in curveTable) {
|
|
foreach (KeyValuePair<string, AnimationCurve> pair in curveTable) {
|