Skip to content

Commit

Permalink
fix Quaternion/Vector4 mismatch, fix nullref in key access
Browse files Browse the repository at this point in the history
  • Loading branch information
hybridherbst committed Oct 19, 2022
1 parent 15b31c9 commit 0404941
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ private bool BakePropertyAnimation(PropertyCurve prop, float length, float bakin
if (i == nbSamples - 1) t = length;

for (var k = 0; k < curveCount; k++)
while (keyframes[k][keyframeIndex[k]].time < t)
while (keyframeIndex[k] < keyframes[k].Length - 1 && keyframes[k][keyframeIndex[k]].time < t)
keyframeIndex[k]++;

var isConstant = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void AddAnimationData(Object animatedObject, string propertyName, GLTFAni

// TODO should skip property switches that are not supported without KHR_animation_pointer
// TODO should probably start with the transform check below and stop afterwards if KHR_animation_pointer is off

// if (!settings.UseAnimationPointer)
// {
// Debug.LogWarning("Trying to export arbitrary animation (" + propertyName + ") - this requires KHR_animation_pointer", animatedObject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public AnimationData(Transform tr, double time, bool zeroScale = false, bool rec
exportPlans.Add(new ExportPlan("rotation", typeof(Quaternion), x => x, (tr, _) =>
{
var q = tr.localRotation;
return new Vector4(q.x, q.y, q.z, q.w);
return new Quaternion(q.x, q.y, q.z, q.w);
}));
exportPlans.Add(new ExportPlan("scale", typeof(Vector3), x => x, (tr, _) => tr.localScale));

Expand Down

0 comments on commit 0404941

Please sign in to comment.