Skip to content

Commit

Permalink
fix: curve sorting has to happen before checking r,g,b,a existance
Browse files Browse the repository at this point in the history
  • Loading branch information
hybridherbst committed Nov 13, 2023
1 parent 982a341 commit 8cfe314
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Runtime/Scripts/SceneExporter/ExporterAnimation.cs
Expand Up @@ -1294,6 +1294,7 @@ private bool BakePropertyAnimation(PropertyCurve prop, float length, float bakin
times = null;
values = null;

prop.SortCurves();
if (!prop.Validate()) return false;

var nbSamples = Mathf.Max(1, Mathf.CeilToInt(length * bakingFramerate));
Expand All @@ -1305,11 +1306,7 @@ private bool BakePropertyAnimation(PropertyCurve prop, float length, float bakin
var curveCount = prop.curve.Count;
var keyframes = prop.curve.Select(x => x.keys).ToArray();
var keyframeIndex = new int[curveCount];

prop.SortCurves();

var vector3Scale = SchemaExtensions.CoordinateSpaceConversionScale.ToUnityVector3Raw();


// Assuming all the curves exist now
for (var i = 0; i < nbSamples; ++i)
{
Expand Down Expand Up @@ -1369,7 +1366,6 @@ bool AddValue(float t)
}
else if (typeof(Color) == type)
{
// TODO should actually access r,g,b,a separately since any of these can have curves assigned.
var r = prop.Evaluate(t, 0);
var g = prop.Evaluate(t, 1);
var b = prop.Evaluate(t, 2);
Expand Down

0 comments on commit 8cfe314

Please sign in to comment.