diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2019-11-27 12:47:39 +0300 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2019-11-27 12:50:24 +0300 |
commit | fc1a073bcdc9d2a9ecd4b765724b0f4f4cab4d46 (patch) | |
tree | 015bd0e8271ad333001c250c175534904970deb1 /source/blender/collada/AnimationImporter.cpp | |
parent | 4fd99c949587781529a998d5baa2870c93cd80b4 (diff) |
refactor: collada importer: calculate fcurve index only once when creating an fcurve
Diffstat (limited to 'source/blender/collada/AnimationImporter.cpp')
-rw-r--r-- | source/blender/collada/AnimationImporter.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 1f6bd31d09c..9aebde095aa 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -121,12 +121,13 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) COLLADAFW::FloatOrDoubleArray &outtan = curve->getOutTangentValues(); /* intangent */ - bez.vec[0][0] = bc_get_float_value(intan, (j * 2 * dim) + (2 * i)) * fps; - bez.vec[0][1] = bc_get_float_value(intan, (j * 2 * dim) + (2 * i) + 1); + unsigned int index = 2 * (j * dim + i); + bez.vec[0][0] = bc_get_float_value(intan, index) * fps; + bez.vec[0][1] = bc_get_float_value(intan, index + 1); /* outtangent */ - bez.vec[2][0] = bc_get_float_value(outtan, (j * 2 * dim) + (2 * i)) * fps; - bez.vec[2][1] = bc_get_float_value(outtan, (j * 2 * dim) + (2 * i) + 1); + bez.vec[2][0] = bc_get_float_value(outtan, index) * fps; + bez.vec[2][1] = bc_get_float_value(outtan, index + 1); if (curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER) { bez.ipo = BEZT_IPO_BEZ; bez.h1 = bez.h2 = HD_AUTO_ANIM; |