public void AddEdgeFramesIfMissing(float animationLength) { var lastCurveType = x.length > 0 ? x.GetLastFrame().curveType : CurveTypeValues.SmoothLocal; dirty = x.AddEdgeFramesIfMissing(animationLength, lastCurveType); y.AddEdgeFramesIfMissing(animationLength, lastCurveType); z.AddEdgeFramesIfMissing(animationLength, lastCurveType); rotX.AddEdgeFramesIfMissing(animationLength, lastCurveType); rotY.AddEdgeFramesIfMissing(animationLength, lastCurveType); rotZ.AddEdgeFramesIfMissing(animationLength, lastCurveType); rotW.AddEdgeFramesIfMissing(animationLength, lastCurveType); if (dirty && lastCurveType == CurveTypeValues.CopyPrevious && x.length > 2 && x.keys[x.length - 2].curveType == CurveTypeValues.CopyPrevious) { DeleteFrame(x.keys[x.length - 2].time); } }
public IEnumerable RepairBrokenCurve(TestContext context) { var curve = new BezierAnimationCurve(); curve.SetKeyframe(1, 2, CurveTypeValues.Linear); curve.SetKeyframe(2, 3, CurveTypeValues.Linear); curve.SetKeyframe(3, 4, CurveTypeValues.Linear); if (!context.Assert(curve.keys.Select(k => k.time), new[] { 1f, 2f, 3f }, "Expected broken curve")) { yield break; } curve.AddEdgeFramesIfMissing(5f, CurveTypeValues.Linear); if (!context.Assert(curve.keys.Select(k => k.time), new[] { 0f, 1f, 2f, 3f, 5f }, "Expected repaired curve")) { yield break; } }