[Bf-blender-cvs] [fc1a073bcdc] master: refactor: collada importer: calculate fcurve index only once when creating an fcurve

Gaia Clary noreply at git.blender.org
Wed Nov 27 10:50:56 CET 2019


Commit: fc1a073bcdc9d2a9ecd4b765724b0f4f4cab4d46
Author: Gaia Clary
Date:   Wed Nov 27 10:47:39 2019 +0100
Branches: master
https://developer.blender.org/rBfc1a073bcdc9d2a9ecd4b765724b0f4f4cab4d46

refactor: collada importer: calculate fcurve index only once when creating an fcurve

===================================================================

M	source/blender/collada/AnimationImporter.cpp

===================================================================

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;



More information about the Bf-blender-cvs mailing list