[Bf-blender-cvs] [01c27faed0d] master: Refactor Collada: combined 2 almost identical functions into one
Gaia Clary
noreply at git.blender.org
Sun Mar 11 21:00:03 CET 2018
Commit: 01c27faed0d499374b16ae7fbee4877289608209
Author: Gaia Clary
Date: Sun Mar 11 12:44:02 2018 +0100
Branches: master
https://developer.blender.org/rB01c27faed0d499374b16ae7fbee4877289608209
Refactor Collada: combined 2 almost identical functions into one
The 2 methods add_bezt() and create_bezt() do almost the same.
I combined them both into add_bezt() and added the optional parameter
eBezTriple_Interpolation ipo
===================================================================
M source/blender/collada/AnimationImporter.cpp
M source/blender/collada/AnimationImporter.h
===================================================================
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index ed3d953166f..533090225dc 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -70,14 +70,15 @@ FCurve *AnimationImporter::create_fcurve(int array_index, const char *rna_path)
fcu->array_index = array_index;
return fcu;
}
-
-void AnimationImporter::create_bezt(FCurve *fcu, float frame, float output)
+
+void AnimationImporter::add_bezt(FCurve *fcu, float frame, float value, eBezTriple_Interpolation ipo)
{
+ //float fps = (float)FPS;
BezTriple bez;
memset(&bez, 0, sizeof(BezTriple));
bez.vec[1][0] = frame;
- bez.vec[1][1] = output;
- bez.ipo = U.ipo_new; /* use default interpolation mode here... */
+ bez.vec[1][1] = value;
+ bez.ipo = ipo; /* use default interpolation mode here... */
bez.f1 = bez.f2 = bez.f3 = SELECT;
bez.h1 = bez.h2 = HD_AUTO;
insert_bezt_fcurve(fcu, &bez, 0);
@@ -401,7 +402,7 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act)
eul_to_quat(quat, eul);
for (int k = 0; k < 4; k++)
- create_bezt(quatcu[k], frame, quat[k]);
+ create_bezt(quatcu[k], frame, quat[k], U.ipo_new);
}
}
@@ -2006,19 +2007,6 @@ void AnimationImporter::add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurv
action_groups_add_channel(act, grp, fcu);
}
-void AnimationImporter::add_bezt(FCurve *fcu, float fra, float value)
-{
- //float fps = (float)FPS;
- BezTriple bez;
- memset(&bez, 0, sizeof(BezTriple));
- bez.vec[1][0] = fra;
- bez.vec[1][1] = value;
- bez.ipo = BEZT_IPO_LIN; /* use default interpolation mode here... */
- bez.f1 = bez.f2 = bez.f3 = SELECT;
- bez.h1 = bez.h2 = HD_AUTO;
- insert_bezt_fcurve(fcu, &bez, 0);
- calchandles_fcurve(fcu);
-}
void AnimationImporter::set_import_from_version(std::string import_from_version)
{
diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h
index 15dee8ff5f4..7dc4131dd69 100644
--- a/source/blender/collada/AnimationImporter.h
+++ b/source/blender/collada/AnimationImporter.h
@@ -78,7 +78,7 @@ private:
FCurve *create_fcurve(int array_index, const char *rna_path);
- void create_bezt(FCurve *fcu, float frame, float output);
+ void add_bezt(FCurve *fcu, float frame, float value, eBezTriple_Interpolation ipo=BEZT_IPO_LIN);
// create one or several fcurves depending on the number of parameters being animated
void animation_to_fcurves(COLLADAFW::AnimationCurve *curve);
@@ -214,8 +214,6 @@ public:
void add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurve *fcu);
- void add_bezt(FCurve *fcu, float fra, float value);
-
void extra_data_importer(std::string elementName);
};
More information about the Bf-blender-cvs
mailing list