Cleanup: warning & whitespace
[blender.git] / source / blender / collada / AnimationImporter.cpp
index 3b5b96bc544c1f4a9e6500dba111cf65065cbe03..5cd01eff2633720297086905b51539b99cc75f80 100644 (file)
@@ -38,6 +38,8 @@
 #include "BLI_path_util.h"
 #include "BLI_string.h"
 
+#include "BLT_translation.h"
+
 #include "BKE_action.h"
 #include "BKE_armature.h"
 #include "BKE_fcurve.h"
@@ -136,7 +138,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
                                                        bez.ipo = BEZT_IPO_BEZ;
                                                else 
                                                        bez.ipo = BEZT_IPO_CONST;
-                                               //bez.h1 = bez.h2 = HD_AUTO;    
+                                               //bez.h1 = bez.h2 = HD_AUTO;
                                        }
                                        else {
                                                bez.h1 = bez.h2 = HD_AUTO; 
@@ -151,15 +153,13 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
                                calchandles_fcurve(fcu);
 
                                fcurves.push_back(fcu);
+                               unused_curves.push_back(fcu);
                        }
                }
                break;
                default:
                        fprintf(stderr, "Output dimension of %d is not yet supported (animation id = %s)\n", (int)dim, curve->getOriginalId().c_str());
        }
-
-       for (std::vector<FCurve *>::iterator it = fcurves.begin(); it != fcurves.end(); it++)
-               unused_curves.push_back(*it);
 }
 
 
@@ -173,6 +173,11 @@ void AnimationImporter::fcurve_deg_to_rad(FCurve *cu)
        }
 }
 
+void AnimationImporter::fcurve_is_used(FCurve *fcu)
+{
+       unused_curves.erase(std::remove(unused_curves.begin(), unused_curves.end(), fcu), unused_curves.end());
+}
+
 
 void AnimationImporter::add_fcurves_to_object(Object *ob, std::vector<FCurve *>& curves, char *rna_path, int array_index, Animation *animated)
 {
@@ -217,11 +222,13 @@ void AnimationImporter::add_fcurves_to_object(Object *ob, std::vector<FCurve *>&
                                        BLI_strncpy(grp->name, bone_name, sizeof(grp->name));
                                        
                                        BLI_addtail(&act->groups, grp);
-                                       BLI_uniquename(&act->groups, grp, "Group", '.', offsetof(bActionGroup, name), 64);
+                                       BLI_uniquename(&act->groups, grp, CTX_DATA_(BLT_I18NCONTEXT_ID_ACTION, "Group"), '.',
+                                                      offsetof(bActionGroup, name), 64);
                                }
                                
                                /* add F-Curve to group */
                                action_groups_add_channel(act, grp, fcu);
+                               fcurve_is_used(fcu);
                                
                        }
 #if 0
@@ -232,10 +239,8 @@ void AnimationImporter::add_fcurves_to_object(Object *ob, std::vector<FCurve *>&
                }
                else {
                        BLI_addtail(&act->curves, fcu);
+                       fcurve_is_used(fcu);
                }
-
-               // curve is used, so remove it from unused_curves
-               unused_curves.erase(std::remove(unused_curves.begin(), unused_curves.end(), fcu), unused_curves.end());
        }
 }
 
@@ -435,7 +440,7 @@ void AnimationImporter::modify_fcurve(std::vector<FCurve *> *curves, const char
                if (array_index == -1) fcu->array_index = i;
                else fcu->array_index = array_index;
 
-               unused_curves.erase(std::remove(unused_curves.begin(), unused_curves.end(), fcu), unused_curves.end());
+               fcurve_is_used(fcu);
        }
 }
 
@@ -445,7 +450,7 @@ void AnimationImporter::unused_fcurve(std::vector<FCurve *> *curves)
        std::vector<FCurve *>::iterator it;
        for (it = curves->begin(); it != curves->end(); it++) {
                FCurve *fcu = *it;
-               unused_curves.erase(std::remove(unused_curves.begin(), unused_curves.end(), fcu), unused_curves.end());
+               fcurve_is_used(fcu);
        }
 }
 
@@ -561,7 +566,7 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation *
 
                case COLLADAFW::Transformation::MATRIX:
                        /*{
-                          COLLADAFW::Matrixmat = (COLLADAFW::Matrix*)transform;
+                          COLLADAFW::Matrix *mat = (COLLADAFW::Matrix*)transform;
                           COLLADABU::Math::Matrix4 mat4 = mat->getMatrix();
                           switch (binding->animationClass) {
                           case COLLADAFW::AnimationList::TRANSFORM:
@@ -617,11 +622,10 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list
                //Add the curves of the current animation to the object
                for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
                        FCurve *fcu = *iter;
-                       BLI_addtail(AnimCurves, fcu);   
+                       BLI_addtail(AnimCurves, fcu);
+                       fcurve_is_used(fcu);
                }
        }
-
-
 }
 
 void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const char *anim_type)
@@ -645,13 +649,70 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list
                        //Add the curves of the current animation to the object
                        for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
                                FCurve *fcu = *iter;
+                               /* All anim_types whose values are to be converted from Degree to Radians can be ORed here */
+                               if (STREQ("spot_size", anim_type)) {
+                                       /* NOTE: Do NOT convert if imported file was made by blender <= 2.69.10
+                                        * Reason: old blender versions stored spot_size in radians (was a bug)
+                                        */
+                                       if (this->import_from_version == "" || BLI_natstrcmp(this->import_from_version.c_str(), "2.69.10") != -1) {
+                                               fcurve_deg_to_rad(fcu);
+                                       }
+                               }
+                               /** XXX What About animtype "rotation" ? */
+
                                BLI_addtail(AnimCurves, fcu);
+                               fcurve_is_used(fcu);
                        }
                }
        }
        
 }
 
+/*
+ * Lens animations must be stored in COLLADA by using FOV,
+ * while blender internally uses focal length.
+ * The imported animation curves must be converted appropriately.
+ */
+void AnimationImporter::Assign_lens_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const double aspect, Camera *cam, const char *anim_type, int fov_type)
+{
+       char rna_path[100];
+       if (animlist_map.find(listid) == animlist_map.end()) {
+               return;
+       }
+       else {
+               //anim_type has animations
+               const COLLADAFW::AnimationList *animlist = animlist_map[listid];
+               const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
+               //all the curves belonging to the current binding
+               std::vector<FCurve *> animcurves;
+               for (unsigned int j = 0; j < bindings.getCount(); j++) {
+                       animcurves = curve_map[bindings[j].animation];
+
+                       BLI_strncpy(rna_path, anim_type, sizeof(rna_path));
+
+                       modify_fcurve(&animcurves, rna_path, 0);
+                       std::vector<FCurve *>::iterator iter;
+                       //Add the curves of the current animation to the object
+                       for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
+                               FCurve *fcu = *iter;
+                               
+                               for (unsigned int i = 0; i < fcu->totvert; i++) {
+
+                                       double input_fov = fcu->bezt[i].vec[1][1];
+
+                                       // NOTE: Needs more testing (As we curretnly have no official test data for this)
+                                       double xfov = (fov_type == CAMERA_YFOV) ? (2.0f * atanf(aspect * tanf(DEG2RADF(input_fov) * 0.5f))) : DEG2RADF(input_fov);
+
+                                       fcu->bezt[i].vec[1][1] = fov_to_focallength(xfov, cam->sensor_x);
+                               }
+
+                               BLI_addtail(AnimCurves, fcu);
+                               fcurve_is_used(fcu);
+                       }
+               }
+       }
+}
+
 void AnimationImporter::apply_matrix_curves(Object *ob, std::vector<FCurve *>& animcurves, COLLADAFW::Node *root, COLLADAFW::Node *node,
                                             COLLADAFW::Transformation *tm)
 {
@@ -741,12 +802,12 @@ void AnimationImporter::apply_matrix_curves(Object *ob, std::vector<FCurve *>& a
 
                        // calc M
                        calc_joint_parent_mat_rest(par, NULL, root, node);
-                       mult_m4_m4m4(temp, par, matfra);
+                       mul_m4_m4m4(temp, par, matfra);
 
                        // evaluate_joint_world_transform_at_frame(temp, NULL, node, fra);
 
                        // calc special matrix
-                       mul_serie_m4(mat, irest, temp, irest_dae, rest, NULL, NULL, NULL, NULL);
+                       mul_m4_series(mat, irest, temp, irest_dae, rest);
                }
                else {
                        copy_m4_m4(mat, matfra);
@@ -782,8 +843,10 @@ void AnimationImporter::apply_matrix_curves(Object *ob, std::vector<FCurve *>& a
                        add_bone_fcurve(ob, node, newcu[i]);
                else
                        BLI_addtail(curves, newcu[i]);
+               // fcurve_is_used(newcu[i]);  // never added to unused
        }
 
+
        if (is_joint) {
                bPoseChannel *chan = BKE_pose_channel_find_name(ob->pose, bone_name);
                chan->rotmode = ROT_MODE_QUAT;
@@ -796,21 +859,60 @@ void AnimationImporter::apply_matrix_curves(Object *ob, std::vector<FCurve *>& a
 
 }
 
+/*
+ * This function returns the aspet ration from the Collada camera.
+ *
+ * Note:COLLADA allows to specify either XFov, or YFov alone. 
+ * In that case the aspect ratio can be determined from
+ * the viewport aspect ratio (which is 1:1 ?)
+ * XXX: check this: its probably wrong!
+ * If both values are specified, then the aspect ration is simply xfov/yfov
+ * and if aspect ratio is efined, then .. well then its that one.
+ */
+static const double get_aspect_ratio(const COLLADAFW::Camera *camera)
+{
+       double aspect =  camera->getAspectRatio().getValue();
+
+       if (aspect == 0) {
+               const double yfov   =  camera->getYFov().getValue();
+
+               if (yfov == 0) {
+                       aspect = 1; // assume yfov and xfov are equal
+               }
+               else {
+                       const double xfov   =  camera->getXFov().getValue();
+                       if (xfov==0)
+                               aspect = 1;
+                       else
+                               aspect = xfov / yfov;
+               }
+       }
+       return aspect;
+}
+
+
 void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
                                              std::map<COLLADAFW::UniqueId, COLLADAFW::Node *>& root_map,
                                              std::multimap<COLLADAFW::UniqueId, Object *>& object_map,
                                              std::map<COLLADAFW::UniqueId, const COLLADAFW::Object *> FW_object_map)
 {
-       AnimationImporter::AnimMix *animType = get_animation_type(node, FW_object_map);
-
        bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
-       COLLADAFW::Node *root = root_map.find(node->getUniqueId()) == root_map.end() ? node : root_map[node->getUniqueId()];
-       Object *ob = is_joint ? armature_importer->get_armature_for_joint(root) : object_map.find(node->getUniqueId())->second;
+       COLLADAFW::UniqueId uid = node->getUniqueId();
+       COLLADAFW::Node *root = root_map.find(uid) == root_map.end() ? node : root_map[uid];
+
+       Object *ob;
+       if (is_joint)
+               ob = armature_importer->get_armature_for_joint(root);
+       else
+               ob = object_map.find(uid) == object_map.end() ? NULL : object_map.find(uid)->second;
+
        if (!ob) {
                fprintf(stderr, "cannot find Object for Node with id=\"%s\"\n", node->getOriginalId().c_str());
                return;
        }
 
+
+       AnimationImporter::AnimMix *animType = get_animation_type(node, FW_object_map);
        bAction *act;
 
        if ( (animType->transform) != 0) {
@@ -857,7 +959,6 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
                                        else {                          
 
                                                if (is_joint) {
-
                                                        add_bone_animation_sampled(ob, animcurves, root, node, transform);
                                                }
                                                else {
@@ -870,6 +971,7 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
                                                                FCurve *fcu = *iter;
                                                        
                                                                BLI_addtail(AnimCurves, fcu);
+                                                               fcurve_is_used(fcu);
                                                        }
                                                }
                                                
@@ -917,10 +1019,11 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
        }
 
        if (animType->camera != 0) {
-               Camera *camera  = (Camera *) ob->data;
-
-               if (!camera->adt || !camera->adt->action) act = verify_adt_action((ID *)&camera->id, 1);
-               else act = camera->adt->action;
+               Camera *cam  = (Camera *) ob->data;
+               if (!cam->adt || !cam->adt->action)
+                       act = verify_adt_action((ID *)&cam->id, 1);
+               else
+                       act = cam->adt->action;
 
                ListBase *AnimCurves = &(act->curves);
                const COLLADAFW::InstanceCameraPointerArray& nodeCameras = node->getInstanceCameras();
@@ -931,13 +1034,15 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
                        if ((animType->camera & CAMERA_XFOV) != 0) {
                                const COLLADAFW::AnimatableFloat *xfov =  &(camera->getXFov());
                                const COLLADAFW::UniqueId& listid = xfov->getAnimationList();
-                               Assign_float_animations(listid, AnimCurves, "lens");
+                               double aspect = get_aspect_ratio(camera); 
+                               Assign_lens_animations(listid, AnimCurves, aspect, cam, "lens", CAMERA_XFOV);
                        }
 
                        else if ((animType->camera & CAMERA_YFOV) != 0) {
                                const COLLADAFW::AnimatableFloat *yfov =  &(camera->getYFov());
                                const COLLADAFW::UniqueId& listid = yfov->getAnimationList();
-                               Assign_float_animations(listid, AnimCurves, "lens");
+                               double aspect = get_aspect_ratio(camera); 
+                               Assign_lens_animations(listid, AnimCurves, aspect, cam, "lens", CAMERA_YFOV);
                        }
 
                        else if ((animType->camera & CAMERA_XMAG) != 0) {
@@ -1007,8 +1112,10 @@ void AnimationImporter::translate_Animations(COLLADAFW::Node *node,
                                        }
                                }
                        }
-               }       
+               }
        }
+
+       delete animType;
 }
 
 void AnimationImporter::add_bone_animation_sampled(Object *ob, std::vector<FCurve *>& animcurves, COLLADAFW::Node *root, COLLADAFW::Node *node, COLLADAFW::Transformation *tm)
@@ -1027,8 +1134,8 @@ void AnimationImporter::add_bone_animation_sampled(Object *ob, std::vector<FCurv
                for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
                        FCurve *fcu = *iter;
 
-                       fcurve_deg_to_rad(fcu);          
-               }                                       
+                       fcurve_deg_to_rad(fcu);
+               }
        }
 
 
@@ -1106,12 +1213,12 @@ void AnimationImporter::add_bone_animation_sampled(Object *ob, std::vector<FCurv
 
                // calc M
                calc_joint_parent_mat_rest(par, NULL, root, node);
-               mult_m4_m4m4(temp, par, matfra);
+               mul_m4_m4m4(temp, par, matfra);
 
-               // evaluate_joint_world_transform_at_frame(temp, NULL,, node, fra);
+               // evaluate_joint_world_transform_at_frame(temp, NULL, node, fra);
 
                // calc special matrix
-               mul_serie_m4(mat, irest, temp, irest_dae, rest, NULL, NULL, NULL, NULL);
+               mul_m4_series(mat, irest, temp, irest_dae, rest);
 
                float rot[4], loc[3], scale[3];
 
@@ -1134,6 +1241,7 @@ void AnimationImporter::add_bone_animation_sampled(Object *ob, std::vector<FCurv
        // add curves
        for (int i = 0; i < totcu; i++) {
                add_bone_fcurve(ob, node, newcu[i]);
+               // fcurve_is_used(newcu[i]);  // never added to unused
        }
 
        bPoseChannel *chan = BKE_pose_channel_find_name(ob->pose, bone_name);
@@ -1179,6 +1287,11 @@ AnimationImporter::AnimMix *AnimationImporter::get_animation_type(const COLLADAF
        const COLLADAFW::InstanceCameraPointerArray& nodeCameras = node->getInstanceCameras();
        for (unsigned int i = 0; i < nodeCameras.getCount(); i++) {
                const COLLADAFW::Camera *camera  = (COLLADAFW::Camera *) FW_object_map[nodeCameras[i]->getInstanciatedObjectId()];
+               if ( camera == NULL ) {
+                       // Can happen if the node refers to an unknown camera.
+                       continue;
+               }
+
                const bool is_perspective_type   = camera->getCameraType() == COLLADAFW::Camera::PERSPECTIVE;
 
                int addition;
@@ -1436,12 +1549,12 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node,
 
                        // calc M
                        calc_joint_parent_mat_rest(par, NULL, root, node);
-                       mult_m4_m4m4(temp, par, matfra);
+                       mul_m4_m4m4(temp, par, matfra);
 
-                       // evaluate_joint_world_transform_at_frame(temp, NULL,, node, fra);
+                       // evaluate_joint_world_transform_at_frame(temp, NULL, node, fra);
 
                        // calc special matrix
-                       mul_serie_m4(mat, irest, temp, irest_dae, rest, NULL, NULL, NULL, NULL);
+                       mul_m4_series(mat, irest, temp, irest_dae, rest);
                }
                else {
                        copy_m4_m4(mat, matfra);
@@ -1585,14 +1698,24 @@ void AnimationImporter::evaluate_transform_at_frame(float mat[4][4], COLLADAFW::
                                default:
                                        fprintf(stderr, "unsupported transformation type %d\n", type);
                        }
-                       // dae_matrix_to_mat4(tm, m);
-                       
                }
 
                float temp[4][4];
                copy_m4_m4(temp, mat);
 
-               mult_m4_m4m4(mat, temp, m);
+               mul_m4_m4m4(mat, temp, m);
+       }
+}
+
+static void report_class_type_unsupported(const char *path, 
+                                         const COLLADAFW::AnimationList::AnimationClass animclass,
+                                         const COLLADAFW::Transformation::TransformationType type) 
+{
+       if (animclass == COLLADAFW::AnimationList::UNKNOWN_CLASS) {
+               fprintf(stderr, "%s: UNKNOWN animation class\n", path);
+       }
+       else {
+               fprintf(stderr, "%s: animation class %d is not supported yet for transformation type %d\n", path, animclass, type);
        }
 }
 
@@ -1650,11 +1773,6 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
                                        break;
                        }
 
-                       if (animclass == COLLADAFW::AnimationList::UNKNOWN_CLASS) {
-                               fprintf(stderr, "%s: UNKNOWN animation class\n", path);
-                               //continue;
-                       }
-
                        if (type == COLLADAFW::Transformation::ROTATE) {
                                if (curves.size() != 1) {
                                        fprintf(stderr, "expected 1 curve, got %d\n", (int)curves.size());
@@ -1663,7 +1781,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
 
                                // TODO support other animclasses
                                if (animclass != COLLADAFW::AnimationList::ANGLE) {
-                                       fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass);
+                                       report_class_type_unsupported(path, animclass, type);
                                        return false;
                                }
 
@@ -1702,7 +1820,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
                                                vec[2] = evaluate_fcurve(curves[2], fra);
                                                break;
                                        default:
-                                               fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass);
+                                               report_class_type_unsupported(path, animclass, type);
                                                break;
                                }
                        }
@@ -1723,7 +1841,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
                                                i++;
                                                j = 0;
                                        }
-                                       unused_curves.erase(std::remove(unused_curves.begin(), unused_curves.end(), *it), unused_curves.end());
+                                       fcurve_is_used(*it);
                                }
 
                                COLLADAFW::Matrix tm(matrix);
@@ -1756,7 +1874,7 @@ void AnimationImporter::get_joint_rest_mat(float mat[4][4], COLLADAFW::Node *roo
 
                calc_joint_parent_mat_rest(par, NULL, root, node);
                get_node_mat(m, node, NULL, NULL);
-               mult_m4_m4m4(mat, par, m);
+               mul_m4_m4m4(mat, par, m);
        }
 }
 
@@ -1775,7 +1893,7 @@ bool AnimationImporter::calc_joint_parent_mat_rest(float mat[4][4], float par[4]
                if (par) {
                        float temp[4][4];
                        get_node_mat(temp, node, NULL, NULL);
-                       mult_m4_m4m4(m, par, temp);
+                       mul_m4_m4m4(m, par, temp);
                }
                else {
                        get_node_mat(m, node, NULL, NULL);
@@ -1800,7 +1918,7 @@ Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::No
                job->lay = BKE_scene_base_find(scene, job)->lay = 2;
 
                mul_v3_fl(job->size, 0.5f);
-               job->recalc |= OB_RECALC_OB;
+               DAG_id_tag_update(&job->id, OB_RECALC_OB);
 
                verify_adt_action((ID *)&job->id, 1);
 
@@ -1813,7 +1931,7 @@ Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::No
                        float temp[4][4], ipar[4][4];
                        invert_m4_m4(ipar, par_job->obmat);
                        copy_m4_m4(temp, mat);
-                       mult_m4_m4m4(mat, ipar, temp);
+                       mul_m4_m4m4(mat, ipar, temp);
                }
 
                TransformBase::decompose(mat, job->loc, NULL, job->quat, job->size);
@@ -1821,14 +1939,14 @@ Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::No
                if (par_job) {
                        job->parent = par_job;
 
-                       par_job->recalc |= OB_RECALC_OB;
+                       DAG_id_tag_update(&par_job->id, OB_RECALC_OB);
                        job->parsubstr[0] = 0;
                }
 
                BKE_object_where_is_calc(scene, job);
 
                // after parenting and layer change
-               DAG_scene_sort(CTX_data_main(C), scene);
+               DAG_relations_tag_update(CTX_data_main(C));
 
                joint_objects[node->getUniqueId()] = job;
        }
@@ -1846,7 +1964,7 @@ bool AnimationImporter::evaluate_joint_world_transform_at_frame(float mat[4][4],
        if (par) {
                float temp[4][4];
                evaluate_transform_at_frame(temp, node, node == end ? fra : 0.0f);
-               mult_m4_m4m4(m, par, temp);
+               mul_m4_m4m4(m, par, temp);
        }
        else {
                evaluate_transform_at_frame(m, node, node == end ? fra : 0.0f);
@@ -1880,14 +1998,15 @@ void AnimationImporter::add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurv
        if (grp == NULL) {
                /* Add a new group, and make it active */
                grp = (bActionGroup *)MEM_callocN(sizeof(bActionGroup), "bActionGroup");
-                                       
+
                grp->flag = AGRP_SELECTED;
                BLI_strncpy(grp->name, bone_name, sizeof(grp->name));
-                                       
+
                BLI_addtail(&act->groups, grp);
-               BLI_uniquename(&act->groups, grp, "Group", '.', offsetof(bActionGroup, name), 64);
+               BLI_uniquename(&act->groups, grp, CTX_DATA_(BLT_I18NCONTEXT_ID_ACTION, "Group"), '.',
+                              offsetof(bActionGroup, name), 64);
        }
-                               
+
        /* add F-Curve to group */
        action_groups_add_channel(act, grp, fcu);
 }
@@ -1906,3 +2025,7 @@ void AnimationImporter::add_bezt(FCurve *fcu, float fra, float value)
        calchandles_fcurve(fcu);
 }
 
+void AnimationImporter::set_import_from_version(std::string import_from_version)
+{
+       this->import_from_version = import_from_version;
+}