[Bf-blender-cvs] [baa84c6b5a4] collada: Feature Collada: Add support for Continuous Acceleration (Fcurve handles)

Gaia Clary noreply at git.blender.org
Thu Apr 19 18:56:38 CEST 2018


Commit: baa84c6b5a42b1668c56104b6d4b480e4adfb339
Author: Gaia Clary
Date:   Thu Apr 19 18:52:31 2018 +0200
Branches: collada
https://developer.blender.org/rBbaa84c6b5a42b1668c56104b6d4b480e4adfb339

Feature Collada: Add support for Continuous Acceleration (Fcurve handles)

This allows us to create smoother FCurves during importing Collada
Animation curves. Possibly this should become an option ionstead of
a fixed import feature.

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

M	source/blender/collada/AnimationImporter.cpp

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

diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index 52328843d5c..257e5c9f0a7 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -107,11 +107,9 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
 				FCurve *fcu = (FCurve *)MEM_callocN(sizeof(FCurve), "FCurve");
 
 				fcu->flag = (FCURVE_VISIBLE | FCURVE_AUTO_HANDLES | FCURVE_SELECTED);
-				// fcu->rna_path = BLI_strdupn(path, strlen(path));
 				fcu->array_index = 0;
-				//fcu->totvert = curve->getKeyCount();
+				fcu->auto_smoothing = FCURVE_SMOOTH_CONT_ACCEL;
 
-				// create beztriple for each key
 				for (unsigned int j = 0; j < curve->getKeyCount(); j++) {
 					BezTriple bez;
 					memset(&bez, 0, sizeof(BezTriple));
@@ -120,7 +118,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
 					// input, output
 					bez.vec[1][0] = bc_get_float_value(input, j) * fps; 
 					bez.vec[1][1] = bc_get_float_value(output, j * dim + i);
-
+					bez.h1 = bez.h2 = HD_AUTO;
 
 					if (curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER ||
 					    curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_STEP)
@@ -135,14 +133,15 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
 						// 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);
-						if (curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER) 
+						if (curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER) {
 							bez.ipo = BEZT_IPO_BEZ;
-						else 
+							bez.h1 = bez.h2 = HD_AUTO_ANIM;
+						}
+						else {
 							bez.ipo = BEZT_IPO_CONST;
-						//bez.h1 = bez.h2 = HD_AUTO;
+						}
 					}
 					else {
-						bez.h1 = bez.h2 = HD_AUTO; 
 						bez.ipo = BEZT_IPO_LIN;
 					}
 					// bez.ipo = U.ipo_new; /* use default interpolation mode here... */



More information about the Bf-blender-cvs mailing list