style cleanup
authorCampbell Barton <ideasman42@gmail.com>
Tue, 12 Jun 2012 22:05:33 +0000 (22:05 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 12 Jun 2012 22:05:33 +0000 (22:05 +0000)
28 files changed:
source/blender/blenkernel/BKE_object.h
source/blender/blenkernel/intern/object.c
source/blender/collada/AnimationExporter.cpp
source/blender/collada/AnimationImporter.cpp
source/blender/collada/ArmatureExporter.cpp
source/blender/collada/ArmatureImporter.cpp
source/blender/collada/CameraExporter.cpp
source/blender/collada/DocumentExporter.cpp
source/blender/collada/DocumentImporter.cpp
source/blender/collada/EffectExporter.cpp
source/blender/collada/ErrorHandler.cpp
source/blender/collada/ExtraHandler.cpp
source/blender/collada/ExtraTags.cpp
source/blender/collada/GeometryExporter.cpp
source/blender/collada/ImageExporter.cpp
source/blender/collada/InstanceWriter.cpp
source/blender/collada/LightExporter.cpp
source/blender/collada/MaterialExporter.cpp
source/blender/collada/MeshImporter.cpp
source/blender/collada/SceneExporter.cpp
source/blender/collada/SkinInfo.cpp
source/blender/collada/TransformReader.cpp
source/blender/collada/TransformWriter.cpp
source/blender/collada/collada.cpp
source/blender/collada/collada_internal.cpp
source/blender/collada/collada_utils.cpp
source/blender/makesrna/intern/rna_scene_api.c
source/blender/windowmanager/intern/wm_operators.c

index 29979f6..b8ba309 100644 (file)
@@ -161,13 +161,13 @@ struct MovieClip *BKE_object_movieclip_get(struct Scene *scene, struct Object *o
 /* this function returns a superset of the scenes selection based on relationships */
 
 typedef enum eObRelationTypes {
-       OB_REL_NONE               = 0,      /* just the selection as is */
-       OB_REL_PARENT             = (1<<0), /* immediate parent */
-       OB_REL_PARENT_RECURSIVE   = (1<<1), /* parents up to root of selection tree*/
-       OB_REL_CHILDREN           = (1<<2), /* immediate children */
-       OB_REL_CHILDREN_RECURSIVE = (1<<3), /* All children */
-       OB_REL_MOD_ARMATURE       = (1<<4), /* Armatures related to the selected objects */
-       OB_REL_SCENE_CAMERA       = (1<<5), /* you might want the scene camera too even if unselected? */
+       OB_REL_NONE               = 0,        /* just the selection as is */
+       OB_REL_PARENT             = (1 << 0), /* immediate parent */
+       OB_REL_PARENT_RECURSIVE   = (1 << 1), /* parents up to root of selection tree*/
+       OB_REL_CHILDREN           = (1 << 2), /* immediate children */
+       OB_REL_CHILDREN_RECURSIVE = (1 << 3), /* All children */
+       OB_REL_MOD_ARMATURE       = (1 << 4), /* Armatures related to the selected objects */
+       OB_REL_SCENE_CAMERA       = (1 << 5), /* you might want the scene camera too even if unselected? */
 } eObRelationTypes;
 
 typedef enum eObjectSet {
index 91fd581..1f5ba8a 100644 (file)
@@ -3090,13 +3090,11 @@ static Object *obrel_armature_find(Object *ob)
                ob_arm = ob->parent;
        }
        else {
-               ModifierData *mod = (ModifierData*)ob->modifiers.first;
-               while (mod) {
+               ModifierData *mod;
+               for (mod = (ModifierData *)ob->modifiers.first; mod; mod = mod->next) {
                        if (mod->type == eModifierType_Armature) {
-                               ob_arm = ((ArmatureModifierData*)mod)->object;
+                               ob_arm = ((ArmatureModifierData *)mod)->object;
                        }
-
-                       mod = mod->next;
                }
        }
 
@@ -3104,11 +3102,11 @@ static Object *obrel_armature_find(Object *ob)
 }
 
 static int obrel_is_recursive_child(Object *ob, Object *child) {
-       Object *ancestor = child->parent;
-       while (ancestor)
-       {
-               if(ancestor == ob) return TRUE;
-               ancestor = ancestor->parent;
+       Object *par;
+       for (par = child->parent; par; par = par->parent) {
+               if (par == ob) {
+                       return TRUE;
+               }
        }
        return FALSE;
 }
@@ -3151,16 +3149,16 @@ struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet
                        obrel_list_add(&links, ob);
                }
                else {
-                       if ( (objectSet == OB_SET_SELECTED && TESTBASELIB_BGMODE(((View3D *)NULL), scene, base))
-                       ||   (objectSet == OB_SET_VISIBLE  && BASE_EDITABLE_BGMODE(((View3D *)NULL), scene, base))
-                               ) {
+                       if ((objectSet == OB_SET_SELECTED && TESTBASELIB_BGMODE(((View3D *)NULL), scene, base)) ||
+                           (objectSet == OB_SET_VISIBLE  && BASE_EDITABLE_BGMODE(((View3D *)NULL), scene, base)))
+                       {
                                Object *ob = base->object;
 
                                if (obrel_list_test(ob))
                                        obrel_list_add(&links, ob);
 
                                /* parent relationship */
-                               if (includeFilter & ( OB_REL_PARENT | OB_REL_PARENT_RECURSIVE )) {
+                               if (includeFilter & (OB_REL_PARENT | OB_REL_PARENT_RECURSIVE)) {
                                        Object *parent = ob->parent;
                                        if (obrel_list_test(parent)) {
 
@@ -3169,7 +3167,7 @@ struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet
                                                /* recursive parent relationship */
                                                if (includeFilter & OB_REL_PARENT_RECURSIVE) {
                                                        parent = parent->parent;
-                                                       while (obrel_list_test(parent)){
+                                                       while (obrel_list_test(parent)) {
 
                                                                obrel_list_add(&links, parent);
                                                                parent = parent->parent;
@@ -3179,15 +3177,16 @@ struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet
                                }
 
                                /* child relationship */
-                               if (includeFilter & ( OB_REL_CHILDREN | OB_REL_CHILDREN_RECURSIVE )) {
+                               if (includeFilter & (OB_REL_CHILDREN | OB_REL_CHILDREN_RECURSIVE)) {
                                        Base *local_base;
                                        for (local_base = scene->base.first; local_base; local_base = local_base->next) {
                                                if (BASE_EDITABLE_BGMODE(((View3D *)NULL), scene, local_base)) {
 
                                                        Object *child = local_base->object;
                                                        if (obrel_list_test(child)) {
-                                                               if ((includeFilter & OB_REL_CHILDREN_RECURSIVE && obrel_is_recursive_child(ob,child))
-                                                               ||  (includeFilter & OB_REL_CHILDREN && child->parent && child->parent == ob )) {
+                                                               if ((includeFilter & OB_REL_CHILDREN_RECURSIVE && obrel_is_recursive_child(ob, child)) ||
+                                                                   (includeFilter & OB_REL_CHILDREN && child->parent && child->parent == ob))
+                                                               {
                                                                        obrel_list_add(&links, child);
                                                                }
                                                        }
@@ -3206,7 +3205,7 @@ struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet
 
                        }
                }
-       } // end for
+       }
 
        return links;
 }
index beb098b..cb67561 100644 (file)
@@ -28,7 +28,7 @@ template<class Functor>
 void forEachObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set)
 {
        LinkNode *node;
-       for(node=export_set; node; node=node->next) {
+       for (node = export_set; node; node = node->next) {
                Object *ob = (Object *)node->link;
                f(ob);
        }
@@ -48,7 +48,7 @@ void AnimationExporter::exportAnimations(Scene *sce)
 }
 
 // called for each exported object
-void AnimationExporter::operator() (Object *ob) 
+void AnimationExporter::operator()(Object *ob)
 {
        FCurve *fcu;
        char *transformName;
@@ -56,24 +56,24 @@ void AnimationExporter::operator() (Object *ob)
 
        //Export transform animations
        if (ob->adt && ob->adt->action) {
-               fcu = (FCurve*)ob->adt->action->curves.first;
+               fcu = (FCurve *)ob->adt->action->curves.first;
 
                //transform matrix export for bones are temporarily disabled here.
-               if ( ob->type == OB_ARMATURE ) {
-                       bArmature *arm = (bArmature*)ob->data;
-                       for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next)
+               if (ob->type == OB_ARMATURE) {
+                       bArmature *arm = (bArmature *)ob->data;
+                       for (Bone *bone = (Bone *)arm->bonebase.first; bone; bone = bone->next)
                                write_bone_animation_matrix(ob, bone);
                }
 
                while (fcu) {
                        //for armature animations as objects
-                       if ( ob->type == OB_ARMATURE )
+                       if (ob->type == OB_ARMATURE)
                                transformName =  fcu->rna_path;
                        else 
-                               transformName = extract_transform_name( fcu->rna_path );
+                               transformName = extract_transform_name(fcu->rna_path);
 
                        if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) ||
-                           (!strcmp(transformName, "rotation_euler") && ob->rotmode == ROT_MODE_EUL)||
+                           (!strcmp(transformName, "rotation_euler") && ob->rotmode == ROT_MODE_EUL) ||
                            (!strcmp(transformName, "rotation_quaternion")))
                        {
                                dae_animation(ob, fcu, transformName, false);
@@ -84,12 +84,12 @@ void AnimationExporter::operator() (Object *ob)
        }
 
        //Export Lamp parameter animations
-       if ( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action ) {
-               fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first);
+       if ( (ob->type == OB_LAMP) && ((Lamp *)ob->data)->adt && ((Lamp *)ob->data)->adt->action) {
+               fcu = (FCurve *)(((Lamp *)ob->data)->adt->action->curves.first);
                while (fcu) {
-                       transformName = extract_transform_name( fcu->rna_path );
+                       transformName = extract_transform_name(fcu->rna_path);
 
-                       if ((!strcmp(transformName, "color")) || (!strcmp(transformName, "spot_size"))||
+                       if ((!strcmp(transformName, "color")) || (!strcmp(transformName, "spot_size")) ||
                            (!strcmp(transformName, "spot_blend")) || (!strcmp(transformName, "distance")))
                        {
                                dae_animation(ob, fcu, transformName, true);
@@ -99,14 +99,14 @@ void AnimationExporter::operator() (Object *ob)
        }
 
        //Export Camera parameter animations
-       if ( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action ) {
-               fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first);
+       if ( (ob->type == OB_CAMERA) && ((Camera *)ob->data)->adt && ((Camera *)ob->data)->adt->action) {
+               fcu = (FCurve *)(((Camera *)ob->data)->adt->action->curves.first);
                while (fcu) {
-                       transformName = extract_transform_name( fcu->rna_path );
+                       transformName = extract_transform_name(fcu->rna_path);
 
-                       if ((!strcmp(transformName, "lens"))||
-                           (!strcmp(transformName, "ortho_scale"))||
-                           (!strcmp(transformName, "clip_end"))||(!strcmp(transformName, "clip_start")))
+                       if ((!strcmp(transformName, "lens")) ||
+                           (!strcmp(transformName, "ortho_scale")) ||
+                           (!strcmp(transformName, "clip_end")) || (!strcmp(transformName, "clip_start")))
                        {
                                dae_animation(ob, fcu, transformName, true);
                        }
@@ -116,19 +116,19 @@ void AnimationExporter::operator() (Object *ob)
 
        //Export Material parameter animations.
        for (int a = 0; a < ob->totcol; a++) {
-               Material *ma = give_current_material(ob, a+1);
+               Material *ma = give_current_material(ob, a + 1);
                if (!ma) continue;
                if (ma->adt && ma->adt->action) {
                        /* isMatAnim = true; */
-                       fcu = (FCurve*)ma->adt->action->curves.first;
+                       fcu = (FCurve *)ma->adt->action->curves.first;
                        while (fcu) {
-                               transformName = extract_transform_name( fcu->rna_path );
+                               transformName = extract_transform_name(fcu->rna_path);
 
-                               if ((!strcmp(transformName, "specular_hardness"))||(!strcmp(transformName, "specular_color")) ||
-                                   (!strcmp(transformName, "diffuse_color"))||(!strcmp(transformName, "alpha")) ||
-                                       (!strcmp(transformName, "ior")))
+                               if ((!strcmp(transformName, "specular_hardness")) || (!strcmp(transformName, "specular_color")) ||
+                                   (!strcmp(transformName, "diffuse_color")) || (!strcmp(transformName, "alpha")) ||
+                                   (!strcmp(transformName, "ior")))
                                {
-                                       dae_animation(ob, fcu, transformName, true, ma );
+                                       dae_animation(ob, fcu, transformName, true, ma);
                                }
                                fcu = fcu->next;
                        }
@@ -138,33 +138,33 @@ void AnimationExporter::operator() (Object *ob)
 }
 
 //euler sources from quternion sources
-float * AnimationExporter::get_eul_source_for_quat(Object *ob )
+float *AnimationExporter::get_eul_source_for_quat(Object *ob)
 {
-       FCurve *fcu = (FCurve*)ob->adt->action->curves.first;
+       FCurve *fcu = (FCurve *)ob->adt->action->curves.first;
        const int keys = fcu->totvert;  
-       float *quat = (float*)MEM_callocN(sizeof(float) * fcu->totvert * 4, "quat output source values");  
-       float *eul = (float*)MEM_callocN(sizeof(float) * fcu->totvert * 3, "quat output source values");
+       float *quat = (float *)MEM_callocN(sizeof(float) * fcu->totvert * 4, "quat output source values");
+       float *eul = (float *)MEM_callocN(sizeof(float) * fcu->totvert * 3, "quat output source values");
        float temp_quat[4];
        float temp_eul[3];
        while (fcu) {
-               char * transformName = extract_transform_name( fcu->rna_path );
+               char *transformName = extract_transform_name(fcu->rna_path);
 
-               if ( !strcmp(transformName, "rotation_quaternion") )    { 
-                       for ( int i = 0 ; i < fcu->totvert ; i++) {
-                               *(quat + ( i * 4 ) + fcu->array_index) = fcu->bezt[i].vec[1][1];
+               if (!strcmp(transformName, "rotation_quaternion") ) {
+                       for (int i = 0; i < fcu->totvert; i++) {
+                               *(quat + (i * 4) + fcu->array_index) = fcu->bezt[i].vec[1][1];
                        }
                }
                fcu = fcu->next;
        }
 
-       for ( int i = 0 ; i < keys ; i++) {
-               for ( int j = 0;j<4;j++)
-                       temp_quat[j] = quat[(i*4)+j];
+       for (int i = 0; i < keys; i++) {
+               for (int j = 0; j < 4; j++)
+                       temp_quat[j] = quat[(i * 4) + j];
 
                quat_to_eul(temp_eul, temp_quat);
 
-               for (int k = 0;k<3;k++)
-                       eul[i*3 + k] = temp_eul[k];
+               for (int k = 0; k < 3; k++)
+                       eul[i * 3 + k] = temp_eul[k];
 
        }
        MEM_freeN(quat);
@@ -173,22 +173,22 @@ float * AnimationExporter::get_eul_source_for_quat(Object *ob )
 }
 
 //Get proper name for bones
-std::string AnimationExporter::getObjectBoneName( Object* ob, const FCurve* fcu ) 
+std::string AnimationExporter::getObjectBoneName(Object *ob, const FCurve *fcu)
 {
        //hard-way to derive the bone name from rna_path. Must find more compact method
        std::string rna_path = std::string(fcu->rna_path);
 
-       charboneName = strtok((char *)rna_path.c_str(), "\"");
+       char *boneName = strtok((char *)rna_path.c_str(), "\"");
        boneName = strtok(NULL, "\"");
 
-       if ( boneName != NULL )
+       if (boneName != NULL)
                return /*id_name(ob) + "_" +*/ std::string(boneName);
        else            
                return id_name(ob);
 }
 
 //convert f-curves to animation curves and write
-void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformName, bool is_param, Material * ma )
+void AnimationExporter::dae_animation(Object *ob, FCurve *fcu, char *transformName, bool is_param, Material *ma)
 {
        const char *axis_name = NULL;
        char anim_id[200];
@@ -196,15 +196,15 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa
        bool has_tangents = false;
        bool quatRotation = false;
 
-       if ( !strcmp(transformName, "rotation_quaternion") ) {
+       if (!strcmp(transformName, "rotation_quaternion") ) {
                fprintf(stderr, "quaternion rotation curves are not supported. rotation curve will not be exported\n");
                quatRotation = true;
                return;
        }
 
        //axis names for colors
-       else if ( !strcmp(transformName, "color")||!strcmp(transformName, "specular_color")||!strcmp(transformName, "diffuse_color")||
-               (!strcmp(transformName, "alpha")))
+       else if (!strcmp(transformName, "color") || !strcmp(transformName, "specular_color") || !strcmp(transformName, "diffuse_color") ||
+                (!strcmp(transformName, "alpha")))
        {
                const char *axis_names[] = {"R", "G", "B"};
                if (fcu->array_index < 3)
@@ -213,7 +213,7 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa
 
        //axis names for transforms
        else if ((!strcmp(transformName, "location") || !strcmp(transformName, "scale")) ||
-               (!strcmp(transformName, "rotation_euler"))||(!strcmp(transformName, "rotation_quaternion")))
+                (!strcmp(transformName, "rotation_euler")) || (!strcmp(transformName, "rotation_quaternion")))
        {
                const char *axis_names[] = {"X", "Y", "Z"};
                if (fcu->array_index < 3)
@@ -229,16 +229,16 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa
        //Create anim Id
        if (ob->type == OB_ARMATURE) {
                ob_name =  getObjectBoneName(ob, fcu);
-               BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s.%s", (char*)translate_id(ob_name).c_str(),
-                       transformName, axis_name);
+               BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s.%s", (char *)translate_id(ob_name).c_str(),
+                            transformName, axis_name);
        }
        else {
                if (ma)
                        ob_name = id_name(ob) + "_material";
                else
                        ob_name = id_name(ob);
-               BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(),
-                       fcu->rna_path, axis_name);
+               BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char *)translate_id(ob_name).c_str(),
+                            fcu->rna_path, axis_name);
        }
 
        openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING);
@@ -252,16 +252,16 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa
        //quat rotations are skipped for now, because of complications with determining axis.
        if (quatRotation) {
                float *eul  = get_eul_source_for_quat(ob);
-               float *eul_axis = (float*)MEM_callocN(sizeof(float) * fcu->totvert, "quat output source values");
-               for (int i = 0 ; i< fcu->totvert ; i++) {
-                       eul_axis[i] = eul[i*3 + fcu->array_index];
+               float *eul_axis = (float *)MEM_callocN(sizeof(float) * fcu->totvert, "quat output source values");
+               for (int i = 0; i < fcu->totvert; i++) {
+                       eul_axis[i] = eul[i * 3 + fcu->array_index];
                }
-               output_id= create_source_from_array(COLLADASW::InputSemantic::OUTPUT, eul_axis, fcu->totvert, quatRotation, anim_id, axis_name);
+               output_id = create_source_from_array(COLLADASW::InputSemantic::OUTPUT, eul_axis, fcu->totvert, quatRotation, anim_id, axis_name);
                MEM_freeN(eul);
                MEM_freeN(eul_axis);
        }
        else {
-               output_id= create_source_from_fcurve(COLLADASW::InputSemantic::OUTPUT, fcu, anim_id, axis_name);
+               output_id = create_source_from_fcurve(COLLADASW::InputSemantic::OUTPUT, fcu, anim_id, axis_name);
        }
        // create interpolations source
        std::string interpolation_id = create_interpolation_source(fcu, anim_id, axis_name, &has_tangents);
@@ -296,21 +296,21 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa
 
        std::string target;
 
-       if ( !is_param )
+       if (!is_param)
                target = translate_id(ob_name) +
                         "/" + get_transform_sid(fcu->rna_path, -1, axis_name, true);
        else {
-               if ( ob->type == OB_LAMP )
+               if (ob->type == OB_LAMP)
                        target = get_light_id(ob) +
                                 "/" + get_light_param_sid(fcu->rna_path, -1, axis_name, true);
 
-               if ( ob->type == OB_CAMERA )
+               if (ob->type == OB_CAMERA)
                        target = get_camera_id(ob) +
                                 "/" + get_camera_param_sid(fcu->rna_path, -1, axis_name, true);
 
-               if ( ma ) 
+               if (ma)
                        target = translate_id(id_name(ma)) + "-effect" +
-                       "/common/" /*profile common is only supported */ + get_transform_sid(fcu->rna_path, -1, axis_name, true);
+                                "/common/" /*profile common is only supported */ + get_transform_sid(fcu->rna_path, -1, axis_name, true);
        }
        addChannel(COLLADABU::URI(empty, sampler_id), target);
 
@@ -330,18 +330,18 @@ void AnimationExporter::write_bone_animation_matrix(Object *ob_arm, Bone *bone)
 
        sample_and_write_bone_animation_matrix(ob_arm, bone);
 
-       for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next)
+       for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next)
                write_bone_animation_matrix(ob_arm, child);
 }
 
-bool AnimationExporter::is_bone_deform_group(Bone * bone)
+bool AnimationExporter::is_bone_deform_group(Bone *bone)
 {   
        bool is_def;
        //Check if current bone is deform
-       if ((bone->flag & BONE_NO_DEFORM) == 0 ) return true;
+       if ((bone->flag & BONE_NO_DEFORM) == 0) return true;
        //Check child bones
        else {
-               for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) {
+               for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
                        //loop through all the children until deform bone is found, and then return
                        is_def = is_bone_deform_group(child);
                        if (is_def) return true;
@@ -353,16 +353,16 @@ bool AnimationExporter::is_bone_deform_group(Bone * bone)
 
 void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, Bone *bone)
 {
-       bArmature *arm = (bArmature*)ob_arm->data;
+       bArmature *arm = (bArmature *)ob_arm->data;
        int flag = arm->flag;
        std::vector<float> fra;
        //char prefix[256];
 
-       FCurve* fcu = (FCurve*)ob_arm->adt->action->curves.first;
+       FCurve *fcu = (FCurve *)ob_arm->adt->action->curves.first;
        while (fcu) {
                std::string bone_name = getObjectBoneName(ob_arm, fcu);
-               int val = BLI_strcasecmp((char*)bone_name.c_str(), bone->name);
-               if (val==0) break;
+               int val = BLI_strcasecmp((char *)bone_name.c_str(), bone->name);
+               if (val == 0) break;
                fcu = fcu->next;
        }
 
@@ -379,7 +379,7 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B
        }
 
        if (fra.size()) {
-               dae_baked_animation(fra, ob_arm, bone );
+               dae_baked_animation(fra, ob_arm, bone);
        }
 
        if (flag & ARM_RESTPOS) 
@@ -396,8 +396,8 @@ void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_
        if (!fra.size())
                return;
 
-       BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(),
-               (char*)translate_id(bone_name).c_str(), "pose_matrix");
+       BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char *)translate_id(ob_name).c_str(),
+                    (char *)translate_id(bone_name).c_str(), "pose_matrix");
 
        openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING);
 
@@ -406,7 +406,7 @@ void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_
 
        // create output source
        std::string output_id;
-       output_id = create_4x4_source( fra, ob_arm, bone,  anim_id);
+       output_id = create_4x4_source(fra, ob_arm, bone,  anim_id);
 
        // create interpolations source
        std::string interpolation_id = fake_interpolation_source(fra.size(), anim_id, "");
@@ -444,15 +444,15 @@ void AnimationExporter::dae_bone_animation(std::vector<float> &fra, float *value
 
        char rna_path[200];
        BLI_snprintf(rna_path, sizeof(rna_path), "pose.bones[\"%s\"].%s", bone_name.c_str(),
-               tm_type == 0 ? "rotation_quaternion" : (tm_type == 1 ? "scale" : "location"));
+                    tm_type == 0 ? "rotation_quaternion" : (tm_type == 1 ? "scale" : "location"));
 
        if (axis > -1)
                axis_name = axis_names[axis];
 
        std::string transform_sid = get_transform_sid(NULL, tm_type, axis_name, false);
 
-       BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char*)translate_id(ob_name).c_str(),
-               (char*)translate_id(bone_name).c_str(), (char*)transform_sid.c_str());
+       BLI_snprintf(anim_id, sizeof(anim_id), "%s_%s_%s", (char *)translate_id(ob_name).c_str(),
+                    (char *)translate_id(bone_name).c_str(), (char *)transform_sid.c_str());
 
        openAnimation(anim_id, COLLADABU::Utils::EMPTY_STRING);
 
@@ -518,7 +518,7 @@ std::string AnimationExporter::get_semantic_suffix(COLLADASW::InputSemantic::Sem
 }
 
 void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNameList& param,
-                                                                                         COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis, bool transform)
+                                              COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const char *axis, bool transform)
 {
        switch (semantic) {
                case COLLADASW::InputSemantic::INPUT:
@@ -533,14 +533,14 @@ void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNa
                                        param.push_back(axis);
                                }
                                else 
-                                       if ( transform ) {
-                                               param.push_back("TRANSFORM");  
-                                       }
-                                       else { //assumes if axis isn't specified all axises are added
-                                               param.push_back("X");
-                                               param.push_back("Y");
-                                               param.push_back("Z");
-                                       }
+                               if (transform) {
+                                       param.push_back("TRANSFORM");
+                               }
+                               else {     //assumes if axis isn't specified all axises are added
+                                       param.push_back("X");
+                                       param.push_back("Y");
+                                       param.push_back("Z");
+                               }
                        }
                        break;
                case COLLADASW::InputSemantic::IN_TANGENT:
@@ -706,7 +706,7 @@ std::string AnimationExporter::create_source_from_vector(COLLADASW::InputSemanti
                //if (semantic == COLLADASW::InputSemantic::INPUT)
                val = convert_time(val);
                /*else if (is_rot)
-               val = convert_angle(val);*/
+                  val = convert_angle(val);*/
                source.appendValues(val);
        }
 
@@ -715,7 +715,7 @@ std::string AnimationExporter::create_source_from_vector(COLLADASW::InputSemanti
        return source_id;
 }
 
-std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Object * ob_arm, Bone *bone, const std::string& anim_id)
+std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Object *ob_arm, Bone *bone, const std::string& anim_id)
 {
        COLLADASW::InputSemantic::Semantics semantic = COLLADASW::InputSemantic::OUTPUT;
        std::string source_id = anim_id + get_semantic_suffix(semantic);
@@ -843,11 +843,11 @@ std::string AnimationExporter::create_interpolation_source(FCurve *fcu, const st
        *has_tangents = false;
 
        for (unsigned int i = 0; i < fcu->totvert; i++) {
-               if (fcu->bezt[i].ipo==BEZT_IPO_BEZ) {
+               if (fcu->bezt[i].ipo == BEZT_IPO_BEZ) {
                        source.appendValues(BEZIER_NAME);
                        *has_tangents = true;
                }
-               else if (fcu->bezt[i].ipo==BEZT_IPO_CONST) {
+               else if (fcu->bezt[i].ipo == BEZT_IPO_CONST) {
                        source.appendValues(STEP_NAME);
                }
                else { // BEZT_IPO_LIN
@@ -987,7 +987,7 @@ std::string AnimationExporter::get_camera_param_sid(char *rna_path, int tm_type,
 std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis)
 {
        std::string tm_name;
-       bool is_rotation =false;
+       bool is_rotation = false;
        // when given rna_path, determine tm_type from it
        if (rna_path) {
                char *name = extract_transform_name(rna_path);
@@ -1052,16 +1052,16 @@ std::string AnimationExporter::get_transform_sid(char *rna_path, int tm_type, co
                if (is_rotation)
                        return tm_name + std::string(axis_name) + ".ANGLE";
                else
-                       if (axis_name[0])
-                               return tm_name + "." + std::string(axis_name);
-                       else 
-                               return tm_name;
+               if (axis_name[0])
+                       return tm_name + "." + std::string(axis_name);
+               else
+                       return tm_name;
        }
 
        return std::string("");
 }
 
-charAnimationExporter::extract_transform_name(char *rna_path)
+char *AnimationExporter::extract_transform_name(char *rna_path)
 {
        char *dot = strrchr(rna_path, '.');
        return dot ? (dot + 1) : rna_path;
@@ -1070,7 +1070,7 @@ char* AnimationExporter::extract_transform_name(char *rna_path)
 //find keyframes of all the objects animations
 void AnimationExporter::find_frames(Object *ob, std::vector<float> &fra)
 {
-       FCurve *fcu= (FCurve*)ob->adt->action->curves.first;
+       FCurve *fcu = (FCurve *)ob->adt->action->curves.first;
 
        for (; fcu; fcu = fcu->next) {
 
@@ -1097,7 +1097,7 @@ void AnimationExporter::enable_fcurves(bAction *act, char *bone_name)
        if (bone_name)
                BLI_snprintf(prefix, sizeof(prefix), "pose.bones[\"%s\"]", bone_name);
 
-       for (fcu = (FCurve*)act->curves.first; fcu; fcu = fcu->next) {
+       for (fcu = (FCurve *)act->curves.first; fcu; fcu = fcu->next) {
                if (bone_name) {
                        if (!strncmp(fcu->rna_path, prefix, strlen(prefix)))
                                fcu->flag &= ~FCURVE_DISABLED;
@@ -1110,9 +1110,10 @@ void AnimationExporter::enable_fcurves(bAction *act, char *bone_name)
        }
 }
 
+/* TODO - only check NodeLink objects that are exported */
 bool AnimationExporter::hasAnimations(Scene *sce)
 {
-       Base *base= (Base*) sce->base.first;
+       Base *base = (Base *) sce->base.first;
 
        while (base) {
                Object *ob = base->object;
@@ -1120,26 +1121,26 @@ bool AnimationExporter::hasAnimations(Scene *sce)
                FCurve *fcu = 0;
                //Check for object transform animations
                if (ob->adt && ob->adt->action)
-                       fcu = (FCurve*)ob->adt->action->curves.first;
+                       fcu = (FCurve *)ob->adt->action->curves.first;
                //Check for Lamp parameter animations
-               else if ( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action )
-                       fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first);
+               else if ( (ob->type == OB_LAMP) && ((Lamp *)ob->data)->adt && ((Lamp *)ob->data)->adt->action)
+                       fcu = (FCurve *)(((Lamp *)ob->data)->adt->action->curves.first);
                //Check for Camera parameter animations
-               else if ( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action )
-                       fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first);
+               else if ( (ob->type == OB_CAMERA) && ((Camera *)ob->data)->adt && ((Camera *)ob->data)->adt->action)
+                       fcu = (FCurve *)(((Camera *)ob->data)->adt->action->curves.first);
 
                //Check Material Effect parameter animations.
                for (int a = 0; a < ob->totcol; a++) {
-                       Material *ma = give_current_material(ob, a+1);
+                       Material *ma = give_current_material(ob, a + 1);
                        if (!ma) continue;
                        if (ma->adt && ma->adt->action) {
-                               fcu = (FCurve*)ma->adt->action->curves.first;   
+                               fcu = (FCurve *)ma->adt->action->curves.first;
                        }
                }
 
-               if ( fcu) 
+               if (fcu)
                        return true;
-               base= base->next;
+               base = base->next;
        }
        return false;
 }
@@ -1152,12 +1153,12 @@ void AnimationExporter::find_rotation_frames(Object *ob, std::vector<float> &fra
        else if (rotmode == ROT_MODE_QUAT)
                find_frames(ob, fra, prefix, "rotation_quaternion");
        /*else if (rotmode == ROT_MODE_AXISANGLE)
-       ;*/
+          ;*/
 }
 
 void AnimationExporter::find_frames(Object *ob, std::vector<float> &fra, const char *prefix, const char *tm_name)
 {
-       FCurve *fcu= (FCurve*)ob->adt->action->curves.first;
+       FCurve *fcu = (FCurve *)ob->adt->action->curves.first;
 
        for (; fcu; fcu = fcu->next) {
                if (prefix && strncmp(prefix, fcu->rna_path, strlen(prefix)))
@@ -1189,13 +1190,13 @@ void AnimationExporter::write_bone_animation(Object *ob_arm, Bone *bone)
        for (int i = 0; i < 3; i++)
                sample_and_write_bone_animation(ob_arm, bone, i);
 
-       for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next)
+       for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next)
                write_bone_animation(ob_arm, child);
 }
 
 void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type)
 {
-       bArmature *arm = (bArmature*)ob_arm->data;
+       bArmature *arm = (bArmature *)ob_arm->data;
        int flag = arm->flag;
        std::vector<float> fra;
        char prefix[256];
@@ -1227,12 +1228,12 @@ void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bo
        }
        //v array will hold all values which will be exported. 
        if (fra.size()) {
-               float *values = (float*)MEM_callocN(sizeof(float) * 3 * fra.size(), "temp. anim frames");
+               float *values = (float *)MEM_callocN(sizeof(float) * 3 * fra.size(), "temp. anim frames");
                sample_animation(values, fra, transform_type, bone, ob_arm, pchan);
 
                if (transform_type == 0) {
                        // write x, y, z curves separately if it is rotation
-                       float *axisValues = (float*)MEM_callocN(sizeof(float) * fra.size(), "temp. anim frames");   
+                       float *axisValues = (float *)MEM_callocN(sizeof(float) * fra.size(), "temp. anim frames");
 
                        for (int i = 0; i < 3; i++) {
                                for (unsigned int j = 0; j < fra.size(); j++)
index 45d7d4a..625804e 100644 (file)
@@ -62,8 +62,8 @@ static const char *bc_get_joint_name(T *node)
 
 FCurve *AnimationImporter::create_fcurve(int array_index, const char *rna_path)
 {
-       FCurve *fcu = (FCurve*)MEM_callocN(sizeof(FCurve), "FCurve");
-       fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED);
+       FCurve *fcu = (FCurve *)MEM_callocN(sizeof(FCurve), "FCurve");
+       fcu->flag = (FCURVE_VISIBLE | FCURVE_AUTO_HANDLES | FCURVE_SELECTED);
        fcu->rna_path = BLI_strdupn(rna_path, strlen(rna_path));
        fcu->array_index = array_index;
        return fcu;
@@ -92,18 +92,18 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
        size_t dim = curve->getOutDimension();
        unsigned int i;
 
-       std::vector<FCurve*>& fcurves = curve_map[curve->getUniqueId()];
+       std::vector<FCurve *>& fcurves = curve_map[curve->getUniqueId()];
 
        switch (dim) {
-       case 1: // X, Y, Z or angle
-       case 3: // XYZ
-       case 4:
-       case 16: // matrix
+               case 1: // X, Y, Z or angle
+               case 3: // XYZ
+               case 4:
+               case 16: // matrix
                {
-                       for (i = 0; i < dim; i++ ) {
-                               FCurve *fcu = (FCurve*)MEM_callocN(sizeof(FCurve), "FCurve");
+                       for (i = 0; i < dim; i++) {
+                               FCurve *fcu = (FCurve *)MEM_callocN(sizeof(FCurve), "FCurve");
 
-                               fcu->flag = (FCURVE_VISIBLE|FCURVE_AUTO_HANDLES|FCURVE_SELECTED);
+                               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();
@@ -119,19 +119,19 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
                                        bez.vec[1][1] = bc_get_float_value(output, j * dim + i);
 
 
-                                       if ( curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER ||
-                                               curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_STEP) 
+                                       if (curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER ||
+                                           curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_STEP)
                                        {
                                                COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues();
                                                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);
+                                               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);
 
                                                // 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, (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) 
                                                        bez.ipo = BEZT_IPO_BEZ;
                                                else 
@@ -154,11 +154,11 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
                        }
                }
                break;
-       default:
-               fprintf(stderr, "Output dimension of %d is not yet supported (animation id = %s)\n", (int)dim, curve->getOriginalId().c_str());
+               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++)
+       for (std::vector<FCurve *>::iterator it = fcurves.begin(); it != fcurves.end(); it++)
                unused_curves.push_back(*it);
 }
 
@@ -174,14 +174,14 @@ void AnimationImporter::fcurve_deg_to_rad(FCurve *cu)
 }
 
 
-void AnimationImporter::add_fcurves_to_object(Object *ob, std::vector<FCurve*>& curves, char *rna_path, int array_index, Animation *animated)
+void AnimationImporter::add_fcurves_to_object(Object *ob, std::vector<FCurve *>& curves, char *rna_path, int array_index, Animation *animated)
 {
        bAction *act;
        
-       if (!ob->adt || !ob->adt->action) act = verify_adt_action((ID*)&ob->id, 1);
+       if (!ob->adt || !ob->adt->action) act = verify_adt_action((ID *)&ob->id, 1);
        else act = ob->adt->action;
        
-       std::vector<FCurve*>::iterator it;
+       std::vector<FCurve *>::iterator it;
        int i;
 
 #if 0
@@ -211,7 +211,7 @@ void AnimationImporter::add_fcurves_to_object(Object *ob, std::vector<FCurve*>&
                                /* no matching groups, so add one */
                                if (grp == NULL) {
                                        /* Add a new group, and make it active */
-                                       grp = (bActionGroup*)MEM_callocN(sizeof(bActionGroup), "bActionGroup");
+                                       grp = (bActionGroup *)MEM_callocN(sizeof(bActionGroup), "bActionGroup");
                                        
                                        grp->flag = AGRP_SELECTED;
                                        BLI_strncpy(grp->name, bone_name, sizeof(grp->name));
@@ -240,22 +240,23 @@ void AnimationImporter::add_fcurves_to_object(Object *ob, std::vector<FCurve*>&
 }
 
 AnimationImporter::AnimationImporter(UnitConverter *conv, ArmatureImporter *arm, Scene *scene) :
-               TransformReader(conv), armature_importer(arm), scene(scene) { }
+       TransformReader(conv), armature_importer(arm), scene(scene) {
+}
 
 AnimationImporter::~AnimationImporter()
 {
        // free unused FCurves
-       for (std::vector<FCurve*>::iterator it = unused_curves.begin(); it != unused_curves.end(); it++)
+       for (std::vector<FCurve *>::iterator it = unused_curves.begin(); it != unused_curves.end(); it++)
                free_fcurve(*it);
 
        if (unused_curves.size())
                fprintf(stderr, "removed %d unused curves\n", (int)unused_curves.size());
 }
 
-bool AnimationImporter::write_animation(const COLLADAFW::Animation* anim) 
+bool AnimationImporter::write_animation(const COLLADAFW::Animation *anim)
 {
        if (anim->getAnimationType() == COLLADAFW::Animation::ANIMATION_CURVE) {
-               COLLADAFW::AnimationCurve *curve = (COLLADAFW::AnimationCurve*)anim;
+               COLLADAFW::AnimationCurve *curve = (COLLADAFW::AnimationCurve *)anim;
                
                // XXX Don't know if it's necessary
                // Should we check outPhysicalDimension?
@@ -270,15 +271,15 @@ bool AnimationImporter::write_animation(const COLLADAFW::Animation* anim)
 
                if (interp != COLLADAFW::AnimationCurve::INTERPOLATION_MIXED) {
                        switch (interp) {
-                       case COLLADAFW::AnimationCurve::INTERPOLATION_LINEAR:
-                       case COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER:
-                       case COLLADAFW::AnimationCurve::INTERPOLATION_STEP:
-                               animation_to_fcurves(curve);
-                               break;
-                       default:
-                               // TODO there're also CARDINAL, HERMITE, BSPLINE and STEP types
-                               fprintf(stderr, "CARDINAL, HERMITE and BSPLINE anim interpolation types not supported yet.\n");
-                               break;
+                               case COLLADAFW::AnimationCurve::INTERPOLATION_LINEAR:
+                               case COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER:
+                               case COLLADAFW::AnimationCurve::INTERPOLATION_STEP:
+                                       animation_to_fcurves(curve);
+                                       break;
+                               default:
+                                       // TODO there're also CARDINAL, HERMITE, BSPLINE and STEP types
+                                       fprintf(stderr, "CARDINAL, HERMITE and BSPLINE anim interpolation types not supported yet.\n");
+                                       break;
                        }
                }
                else {
@@ -294,7 +295,7 @@ bool AnimationImporter::write_animation(const COLLADAFW::Animation* anim)
 }
        
 // called on post-process stage after writeVisualScenes
-bool AnimationImporter::write_animation_list(const COLLADAFW::AnimationList* animlist) 
+bool AnimationImporter::write_animation_list(const COLLADAFW::AnimationList *animlist)
 {
        const COLLADAFW::UniqueId& animlist_id = animlist->getUniqueId();
 
@@ -334,14 +335,14 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act)
        bActionGroup *grp;
        int i;
        
-       for (grp = (bActionGroup*)act->groups.first; grp; grp = grp->next) {
+       for (grp = (bActionGroup *)act->groups.first; grp; grp = grp->next) {
 
                FCurve *eulcu[3] = {NULL, NULL, NULL};
                
                if (fcurves_actionGroup_map.find(grp) == fcurves_actionGroup_map.end())
                        continue;
 
-               std::vector<FCurve*> &rot_fcurves = fcurves_actionGroup_map[grp];
+               std::vector<FCurve *> &rot_fcurves = fcurves_actionGroup_map[grp];
                
                if (rot_fcurves.size() > 3) continue;
 
@@ -387,10 +388,10 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act)
 
                                /*eul_to_mat3(rot, eul);
 
-                               mul_m3_m3m3(rel, irest, rot);
+                                  mul_m3_m3m3(rel, irest, rot);
 
-                               mat3_to_quat(quat, rel);
-                               */
+                                  mat3_to_quat(quat, rel);
+                                */
 
                                eul_to_quat(quat, eul);
 
@@ -415,7 +416,7 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act)
        }
 
        bPoseChannel *pchan;
-       for (pchan = (bPoseChannel*)ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+       for (pchan = (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan = pchan->next) {
                pchan->rotmode = ROT_MODE_QUAT;
        }
 }
@@ -423,9 +424,9 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act)
 
 
 //sets the rna_path and array index to curve
-void AnimationImporter::modify_fcurve(std::vector<FCurve*>* curves, const char* rna_path, int array_index )
+void AnimationImporter::modify_fcurve(std::vector<FCurve *> *curves, const char *rna_path, int array_index)
 {
-       std::vector<FCurve*>::iterator it;
+       std::vector<FCurve *>::iterator it;
        int i;
        for (it = curves->begin(), i = 0; it != curves->end(); it++, i++) {
                FCurve *fcu = *it;
@@ -438,19 +439,19 @@ void AnimationImporter::modify_fcurve(std::vector<FCurve*>* curves, const char*
        }
 }
 
-void AnimationImporter::unused_fcurve(std::vector<FCurve*>* curves)
+void AnimationImporter::unused_fcurve(std::vector<FCurve *> *curves)
 {
        // when an error happens and we can't actually use curve remove it from unused_curves
-       std::vector<FCurve*>::iterator it;
+       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());
        }
 }
 
-void AnimationImporter::find_frames( std::vector<float>* frames, std::vector<FCurve*>* curves)
+void AnimationImporter::find_frames(std::vector<float> *frames, std::vector<FCurve *> *curves)
 {
-       std::vector<FCurve*>::iterator iter;
+       std::vector<FCurve *>::iterator iter;
        for (iter = curves->begin(); iter != curves->end(); iter++) {
                FCurve *fcu = *iter;
 
@@ -466,16 +467,16 @@ void AnimationImporter::find_frames( std::vector<float>* frames, std::vector<FCu
 }
 
 //creates the rna_paths and array indices of fcurves from animations using transformation and bound animation class of each animation.
-void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation * transform,
-                                                                                                        const COLLADAFW::AnimationList::AnimationBinding * binding,
-                                                                                                        std::vector<FCurve*>* curves, bool is_joint, char * joint_path)
+void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation *transform,
+                                                     const COLLADAFW::AnimationList::AnimationBinding *binding,
+                                                     std::vector<FCurve *> *curves, bool is_joint, char *joint_path)
 {
        COLLADAFW::Transformation::TransformationType tm_type = transform->getTransformationType();
        bool is_matrix = tm_type == COLLADAFW::Transformation::MATRIX;
        bool is_rotation = tm_type  == COLLADAFW::Transformation::ROTATE;
 
        //to check if the no of curves are valid
-       bool xyz = ((tm_type == COLLADAFW::Transformation::TRANSLATE ||tm_type  == COLLADAFW::Transformation::SCALE) && binding->animationClass == COLLADAFW::AnimationList::POSITION_XYZ);
+       bool xyz = ((tm_type == COLLADAFW::Transformation::TRANSLATE || tm_type  == COLLADAFW::Transformation::SCALE) && binding->animationClass == COLLADAFW::AnimationList::POSITION_XYZ);
 
 
        if (!((!xyz && curves->size() == 1) || (xyz && curves->size() == 3) || is_matrix)) {
@@ -488,85 +489,85 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation *
        switch (tm_type) {
                case COLLADAFW::Transformation::TRANSLATE:
                case COLLADAFW::Transformation::SCALE:
-                       {
-                               bool loc = tm_type == COLLADAFW::Transformation::TRANSLATE;
-                               if (is_joint)
-                                       BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, loc ? "location" : "scale");
-                               else
-                                       BLI_strncpy(rna_path, loc ? "location" : "scale", sizeof(rna_path));
+               {
+                       bool loc = tm_type == COLLADAFW::Transformation::TRANSLATE;
+                       if (is_joint)
+                               BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, loc ? "location" : "scale");
+                       else
+                               BLI_strncpy(rna_path, loc ? "location" : "scale", sizeof(rna_path));
 
-                               switch (binding->animationClass) {
-               case COLLADAFW::AnimationList::POSITION_X:
-                       modify_fcurve(curves, rna_path, 0 );
-                       break;
-               case COLLADAFW::AnimationList::POSITION_Y:
-                       modify_fcurve(curves, rna_path, 1 );
-                       break;
-               case COLLADAFW::AnimationList::POSITION_Z:
-                       modify_fcurve(curves, rna_path, 2 );
-                       break;
-               case COLLADAFW::AnimationList::POSITION_XYZ:
-                       modify_fcurve(curves, rna_path, -1 );
-                       break;
-               default:
-                       unused_fcurve(curves);
-                       fprintf(stderr, "AnimationClass %d is not supported for %s.\n",
-                               binding->animationClass, loc ? "TRANSLATE" : "SCALE");
-                               }
-                               break;
+                       switch (binding->animationClass) {
+                               case COLLADAFW::AnimationList::POSITION_X:
+                                       modify_fcurve(curves, rna_path, 0);
+                                       break;
+                               case COLLADAFW::AnimationList::POSITION_Y:
+                                       modify_fcurve(curves, rna_path, 1);
+                                       break;
+                               case COLLADAFW::AnimationList::POSITION_Z:
+                                       modify_fcurve(curves, rna_path, 2);
+                                       break;
+                               case COLLADAFW::AnimationList::POSITION_XYZ:
+                                       modify_fcurve(curves, rna_path, -1);
+                                       break;
+                               default:
+                                       unused_fcurve(curves);
+                                       fprintf(stderr, "AnimationClass %d is not supported for %s.\n",
+                                               binding->animationClass, loc ? "TRANSLATE" : "SCALE");
                        }
+                       break;
+               }
 
 
                case COLLADAFW::Transformation::ROTATE:
-                       {
-                               if (is_joint)
-                                       BLI_snprintf(rna_path, sizeof(rna_path), "%s.rotation_euler", joint_path);
-                               else
-                                       BLI_strncpy(rna_path, "rotation_euler", sizeof(rna_path));
-                               std::vector<FCurve*>::iterator iter;
-                               for (iter = curves->begin(); iter != curves->end(); iter++) {
-                                       FCurve* fcu = *iter;
-
-                                       //if transform is rotation the fcurves values must be turned in to radian.
-                                       if (is_rotation)
-                                               fcurve_deg_to_rad(fcu);          
-                               }                                       
-                               COLLADAFW::Rotate* rot = (COLLADAFW::Rotate*)transform;
-                               COLLADABU::Math::Vector3& axis = rot->getRotationAxis();
-
-                               switch (binding->animationClass) {
-               case COLLADAFW::AnimationList::ANGLE:
-                       if (COLLADABU::Math::Vector3::UNIT_X == axis) {
-                               modify_fcurve(curves, rna_path, 0 );
-                       }
-                       else if (COLLADABU::Math::Vector3::UNIT_Y == axis) {
-                               modify_fcurve(curves, rna_path, 1 );
+               {
+                       if (is_joint)
+                               BLI_snprintf(rna_path, sizeof(rna_path), "%s.rotation_euler", joint_path);
+                       else
+                               BLI_strncpy(rna_path, "rotation_euler", sizeof(rna_path));
+                       std::vector<FCurve *>::iterator iter;
+                       for (iter = curves->begin(); iter != curves->end(); iter++) {
+                               FCurve *fcu = *iter;
+
+                               //if transform is rotation the fcurves values must be turned in to radian.
+                               if (is_rotation)
+                                       fcurve_deg_to_rad(fcu);
                        }
-                       else if (COLLADABU::Math::Vector3::UNIT_Z == axis) {
-                               modify_fcurve(curves, rna_path, 2 );
+                       COLLADAFW::Rotate *rot = (COLLADAFW::Rotate *)transform;
+                       COLLADABU::Math::Vector3& axis = rot->getRotationAxis();
+
+                       switch (binding->animationClass) {
+                               case COLLADAFW::AnimationList::ANGLE:
+                                       if (COLLADABU::Math::Vector3::UNIT_X == axis) {
+                                               modify_fcurve(curves, rna_path, 0);
+                                       }
+                                       else if (COLLADABU::Math::Vector3::UNIT_Y == axis) {
+                                               modify_fcurve(curves, rna_path, 1);
+                                       }
+                                       else if (COLLADABU::Math::Vector3::UNIT_Z == axis) {
+                                               modify_fcurve(curves, rna_path, 2);
+                                       }
+                                       else
+                                               unused_fcurve(curves);
+                                       break;
+                               case COLLADAFW::AnimationList::AXISANGLE:
+                               // TODO convert axis-angle to quat? or XYZ?
+                               default:
+                                       unused_fcurve(curves);
+                                       fprintf(stderr, "AnimationClass %d is not supported for ROTATE transformation.\n",
+                                               binding->animationClass);
                        }
-                       else
-                               unused_fcurve(curves);
                        break;
-               case COLLADAFW::AnimationList::AXISANGLE:
-                       // TODO convert axis-angle to quat? or XYZ?
-               default:
-                       unused_fcurve(curves);
-                       fprintf(stderr, "AnimationClass %d is not supported for ROTATE transformation.\n",
-                               binding->animationClass);
-                               }
-                               break;
-                       }
+               }
 
                case COLLADAFW::Transformation::MATRIX:
                        /*{
-                       COLLADAFW::Matrix* mat = (COLLADAFW::Matrix*)transform;
-                       COLLADABU::Math::Matrix4 mat4 = mat->getMatrix();
-                       switch (binding->animationClass) {
-                       case COLLADAFW::AnimationList::TRANSFORM:
+                          COLLADAFW::Matrix* mat = (COLLADAFW::Matrix*)transform;
+                          COLLADABU::Math::Matrix4 mat4 = mat->getMatrix();
+                          switch (binding->animationClass) {
+                          case COLLADAFW::AnimationList::TRANSFORM:
 
-                       }
-                       }*/
+                          }
+                          }*/
                        unused_fcurve(curves);
                        break;
                case COLLADAFW::Transformation::SKEW:
@@ -579,7 +580,7 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation *
 }
 
 //creates the rna_paths and array indices of fcurves from animations using color and bound animation class of each animation.
-void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const char * anim_type)
+void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const char *anim_type)
 {
        char rna_path[100];
        BLI_strncpy(rna_path, anim_type, sizeof(rna_path));
@@ -587,35 +588,35 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list
        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;
+       std::vector<FCurve *> animcurves;
        for (unsigned int j = 0; j < bindings.getCount(); j++) {
                animcurves = curve_map[bindings[j].animation];
 
                switch (bindings[j].animationClass) {
-               case COLLADAFW::AnimationList::COLOR_R:
-                       modify_fcurve(&animcurves, rna_path, 0 );
-                       break;
-               case COLLADAFW::AnimationList::COLOR_G:
-                       modify_fcurve(&animcurves, rna_path, 1 );
-                       break;
-               case COLLADAFW::AnimationList::COLOR_B:
-                       modify_fcurve(&animcurves, rna_path, 2 );
-                       break;
-               case COLLADAFW::AnimationList::COLOR_RGB:
-               case COLLADAFW::AnimationList::COLOR_RGBA: // to do-> set intensity
-                       modify_fcurve(&animcurves, rna_path, -1 );
-                       break;
+                       case COLLADAFW::AnimationList::COLOR_R:
+                               modify_fcurve(&animcurves, rna_path, 0);
+                               break;
+                       case COLLADAFW::AnimationList::COLOR_G:
+                               modify_fcurve(&animcurves, rna_path, 1);
+                               break;
+                       case COLLADAFW::AnimationList::COLOR_B:
+                               modify_fcurve(&animcurves, rna_path, 2);
+                               break;
+                       case COLLADAFW::AnimationList::COLOR_RGB:
+                       case COLLADAFW::AnimationList::COLOR_RGBA: // to do-> set intensity
+                               modify_fcurve(&animcurves, rna_path, -1);
+                               break;
 
-               default:
-                       unused_fcurve(&animcurves);
-                       fprintf(stderr, "AnimationClass %d is not supported for %s.\n",
-                               bindings[j].animationClass, "COLOR" );
+                       default:
+                               unused_fcurve(&animcurves);
+                               fprintf(stderr, "AnimationClass %d is not supported for %s.\n",
+                                       bindings[j].animationClass, "COLOR");
                }
 
-               std::vector<FCurve*>::iterator iter;
+               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;
+                       FCurve *fcu = *iter;
                        BLI_addtail(AnimCurves, fcu);   
                }
        }
@@ -623,7 +624,7 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list
 
 }
 
-void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const char * anim_type)
+void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const char *anim_type)
 {
        char rna_path[100];
        if (animlist_map.find(listid) == animlist_map.end()) {
@@ -634,16 +635,16 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list
                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;
+               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;
+                       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;
+                               FCurve *fcu = *iter;
                                BLI_addtail(AnimCurves, fcu);
                        }
                }
@@ -651,13 +652,13 @@ void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& list
        
 }
 
-void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node,
-                                                                                                       COLLADAFW::Transformation * tm )
+void AnimationImporter::apply_matrix_curves(Object *ob, std::vector<FCurve *>& animcurves, COLLADAFW::Node *root, COLLADAFW::Node *node,
+                                            COLLADAFW::Transformation *tm)
 {
        bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
        const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL;
        char joint_path[200];
-       if ( is_joint ) 
+       if (is_joint)
                armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path));
 
        std::vector<float> frames;
@@ -670,7 +671,7 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>&
                get_joint_rest_mat(irest_dae, root, node);
                invert_m4(irest_dae);
 
-               Bone *bone = BKE_armature_find_bone_name((bArmature*)ob->data, bone_name);
+               Bone *bone = BKE_armature_find_bone_name((bArmature *)ob->data, bone_name);
                if (!bone) {
                        fprintf(stderr, "cannot find bone \"%s\"\n", bone_name);
                        return;
@@ -751,13 +752,13 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>&
                        copy_m4_m4(mat, matfra);
                }
 
-               float  rot[4], loc[3], scale[3];
+               float rot[4], loc[3], scale[3];
 
                mat4_to_quat(rot, mat);
                /*for ( int i = 0 ; i < 4  ;  i ++ )
-               {
-               rot[i] = RAD2DEGF(rot[i]);
-               }*/
+                  {
+                  rot[i] = RAD2DEGF(rot[i]);
+                  }*/
                copy_v3_v3(loc, mat[3]);
                mat4_to_size(scale, mat);
 
@@ -771,12 +772,12 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>&
                                add_bezt(newcu[i], fra, scale[i - 7]);
                }
        }
-       verify_adt_action((ID*)&ob->id, 1);
+       verify_adt_action((ID *)&ob->id, 1);
 
        ListBase *curves = &ob->adt->action->curves;
 
        // add curves
-       for (int i= 0; i < totcu; i++) {
+       for (int i = 0; i < totcu; i++) {
                if (is_joint)
                        add_bone_fcurve(ob, node, newcu[i]);
                else
@@ -795,12 +796,12 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>&
 
 }
 
-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)
+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 );
+       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()];
@@ -810,17 +811,17 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node,
                return;
        }
 
-       bAction * act;
+       bAction *act;
 
-       if ( (animType->transform) != 0 ) {
+       if ( (animType->transform) != 0) {
                /* const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL; */ /* UNUSED */
                char joint_path[200];
 
-               if ( is_joint ) 
+               if (is_joint)
                        armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path));
 
 
-               if (!ob->adt || !ob->adt->action) act = verify_adt_action((ID*)&ob->id, 1);
+               if (!ob->adt || !ob->adt->action) act = verify_adt_action((ID *)&ob->id, 1);
                else act = ob->adt->action;
 
                //Get the list of animation curves of the object
@@ -847,11 +848,11 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node,
                                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;
+                               std::vector<FCurve *> animcurves;
                                for (unsigned int j = 0; j < bindings.getCount(); j++) {
                                        animcurves = curve_map[bindings[j].animation];
-                                       if ( is_matrix ) {
-                                               apply_matrix_curves(ob, animcurves, root, node,  transform  );
+                                       if (is_matrix) {
+                                               apply_matrix_curves(ob, animcurves, root, node,  transform);
                                        }
                                        else {                          
 
@@ -861,12 +862,12 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node,
                                                }
                                                else {
                                                        //calculate rnapaths and array index of fcurves according to transformation and animation class
-                                                       Assign_transform_animations(transform, &bindings[j], &animcurves, is_joint, joint_path ); 
+                                                       Assign_transform_animations(transform, &bindings[j], &animcurves, is_joint, joint_path);
 
-                                                       std::vector<FCurve*>::iterator iter;
+                                                       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;
+                                                               FCurve *fcu = *iter;
                                                        
                                                                BLI_addtail(AnimCurves, fcu);
                                                        }
@@ -882,9 +883,9 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node,
        }
 
        if ((animType->light) != 0) {
-               Lamp * lamp  = (Lamp*) ob->data;
+               Lamp *lamp  = (Lamp *) ob->data;
 
-               if (!lamp->adt || !lamp->adt->action) act = verify_adt_action((ID*)&lamp->id, 1);
+               if (!lamp->adt || !lamp->adt->action) act = verify_adt_action((ID *)&lamp->id, 1);
                else act = lamp->adt->action;
 
                ListBase *AnimCurves = &(act->curves);
@@ -899,63 +900,63 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node,
 
                                Assign_color_animations(listid, AnimCurves, "color"); 
                        }
-                       if ((animType->light & LIGHT_FOA) != 0 ) {
+                       if ((animType->light & LIGHT_FOA) != 0) {
                                const COLLADAFW::AnimatableFloat *foa =  &(light->getFallOffAngle());
                                const COLLADAFW::UniqueId& listid = foa->getAnimationList();
 
-                               Assign_float_animations( listid, AnimCurves, "spot_size");
+                               Assign_float_animations(listid, AnimCurves, "spot_size");
                        }
-                       if ( (animType->light & LIGHT_FOE) != 0 ) {
+                       if ( (animType->light & LIGHT_FOE) != 0) {
                                const COLLADAFW::AnimatableFloat *foe =  &(light->getFallOffExponent());
                                const COLLADAFW::UniqueId& listid = foe->getAnimationList();
 
-                               Assign_float_animations( listid, AnimCurves, "spot_blend");
+                               Assign_float_animations(listid, AnimCurves, "spot_blend");
 
                        }
                }
        }
 
        if ( (animType->camera) != 0)  {
-               Camera * camera  = (Camera*) ob->data;
+               Camera *camera  = (Camera *) ob->data;
 
-               if (!camera->adt || !camera->adt->action) act = verify_adt_action((ID*)&camera->id, 1);
+               if (!camera->adt || !camera->adt->action) act = verify_adt_action((ID *)&camera->id, 1);
                else act = camera->adt->action;
 
                ListBase *AnimCurves = &(act->curves);
-               const COLLADAFW::InstanceCameraPointerArray& nodeCameras= node->getInstanceCameras();
+               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 ((animType->camera & CAMERA_XFOV) != 0 ) {
+                       if ((animType->camera & CAMERA_XFOV) != 0) {
                                const COLLADAFW::AnimatableFloat *xfov =  &(camera->getXFov());
                                const COLLADAFW::UniqueId& listid = xfov->getAnimationList();
-                               Assign_float_animations( listid, AnimCurves, "lens");
+                               Assign_float_animations(listid, AnimCurves, "lens");
                        }
 
-                       else if ((animType->camera & CAMERA_XMAG) != 0 ) {
+                       else if ((animType->camera & CAMERA_XMAG) != 0) {
                                const COLLADAFW::AnimatableFloat *xmag =  &(camera->getXMag());
                                const COLLADAFW::UniqueId& listid = xmag->getAnimationList();
-                               Assign_float_animations( listid, AnimCurves, "ortho_scale");
+                               Assign_float_animations(listid, AnimCurves, "ortho_scale");
                        }
 
-                       if ((animType->camera & CAMERA_ZFAR) != 0 ) {
+                       if ((animType->camera & CAMERA_ZFAR) != 0) {
                                const COLLADAFW::AnimatableFloat *zfar =  &(camera->getFarClippingPlane());
                                const COLLADAFW::UniqueId& listid = zfar->getAnimationList();
-                               Assign_float_animations( listid, AnimCurves, "clip_end");
+                               Assign_float_animations(listid, AnimCurves, "clip_end");
                        }
 
-                       if ((animType->camera & CAMERA_ZNEAR) != 0 ) {
+                       if ((animType->camera & CAMERA_ZNEAR) != 0) {
                                const COLLADAFW::AnimatableFloat *znear =  &(camera->getNearClippingPlane());
                                const COLLADAFW::UniqueId& listid = znear->getAnimationList();
-                               Assign_float_animations( listid, AnimCurves, "clip_start");
+                               Assign_float_animations(listid, AnimCurves, "clip_start");
                        }
 
                }
        }
-       if ( animType->material != 0) {
+       if (animType->material != 0) {
                Material *ma = give_current_material(ob, 1);
-               if (!ma->adt || !ma->adt->action) act = verify_adt_action((ID*)&ma->id, 1);
+               if (!ma->adt || !ma->adt->action) act = verify_adt_action((ID *)&ma->id, 1);
                else act = ma->adt->action;
 
                ListBase *AnimCurves = &(act->curves);
@@ -972,25 +973,25 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node,
                                        if ((animType->material & MATERIAL_SHININESS) != 0) {
                                                const COLLADAFW::FloatOrParam *shin = &(efc->getShininess());
                                                const COLLADAFW::UniqueId& listid =  shin->getAnimationList();
-                                               Assign_float_animations( listid, AnimCurves, "specular_hardness" );
+                                               Assign_float_animations(listid, AnimCurves, "specular_hardness");
                                        }
 
                                        if ((animType->material & MATERIAL_IOR) != 0) {
                                                const COLLADAFW::FloatOrParam *ior = &(efc->getIndexOfRefraction());
                                                const COLLADAFW::UniqueId& listid =  ior->getAnimationList();
-                                               Assign_float_animations( listid, AnimCurves, "raytrace_transparency.ior" );
+                                               Assign_float_animations(listid, AnimCurves, "raytrace_transparency.ior");
                                        }
 
                                        if ((animType->material & MATERIAL_SPEC_COLOR) != 0) {
                                                const COLLADAFW::ColorOrTexture *cot = &(efc->getSpecular());
                                                const COLLADAFW::UniqueId& listid =  cot->getColor().getAnimationList();
-                                               Assign_color_animations( listid, AnimCurves, "specular_color" );
+                                               Assign_color_animations(listid, AnimCurves, "specular_color");
                                        }
 
                                        if ((animType->material & MATERIAL_DIFF_COLOR) != 0) {
                                                const COLLADAFW::ColorOrTexture *cot = &(efc->getDiffuse());
                                                const COLLADAFW::UniqueId& listid =  cot->getColor().getAnimationList();
-                                               Assign_color_animations( listid, AnimCurves, "diffuse_color" );
+                                               Assign_color_animations(listid, AnimCurves, "diffuse_color");
                                        }
                                }
                        }
@@ -998,7 +999,7 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node,
        }
 }
 
-void AnimationImporter::add_bone_animation_sampled(Object * ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node, COLLADAFW::Transformation * tm)
+void AnimationImporter::add_bone_animation_sampled(Object *ob, std::vector<FCurve *>& animcurves, COLLADAFW::Node *root, COLLADAFW::Node *node, COLLADAFW::Transformation *tm)
 {
        const char *bone_name = bc_get_joint_name(node);
        char joint_path[200];
@@ -1010,9 +1011,9 @@ void AnimationImporter::add_bone_animation_sampled(Object * ob, std::vector<FCur
        // convert degrees to radians
        if (tm->getTransformationType() == COLLADAFW::Transformation::ROTATE) {
 
-               std::vector<FCurve*>::iterator iter;
+               std::vector<FCurve *>::iterator iter;
                for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
-                       FCurvefcu = *iter;
+                       FCurve *fcu = *iter;
 
                        fcurve_deg_to_rad(fcu);          
                }                                       
@@ -1025,7 +1026,7 @@ void AnimationImporter::add_bone_animation_sampled(Object * ob, std::vector<FCur
        get_joint_rest_mat(irest_dae, root, node);
        invert_m4(irest_dae);
 
-       Bone *bone = BKE_armature_find_bone_name((bArmature*)ob->data, bone_name);
+       Bone *bone = BKE_armature_find_bone_name((bArmature *)ob->data, bone_name);
        if (!bone) {
                fprintf(stderr, "cannot find bone \"%s\"\n", bone_name);
                return;
@@ -1100,7 +1101,7 @@ void AnimationImporter::add_bone_animation_sampled(Object * ob, std::vector<FCur
                // calc special matrix
                mul_serie_m4(mat, irest, temp, irest_dae, rest, NULL, NULL, NULL, NULL);
 
-               float  rot[4], loc[3], scale[3];
+               float rot[4], loc[3], scale[3];
 
                mat4_to_quat(rot, mat);
                copy_v3_v3(loc, mat[3]);
@@ -1116,10 +1117,10 @@ void AnimationImporter::add_bone_animation_sampled(Object * ob, std::vector<FCur
                                add_bezt(newcu[i], fra, scale[i - 7]);
                }
        }
-       verify_adt_action((ID*)&ob->id, 1);
+       verify_adt_action((ID *)&ob->id, 1);
 
        // add curves
-       for (int i= 0; i < totcu; i++) {
+       for (int i = 0; i < totcu; i++) {
                add_bone_fcurve(ob, node, newcu[i]);
        }
 
@@ -1130,8 +1131,8 @@ void AnimationImporter::add_bone_animation_sampled(Object * ob, std::vector<FCur
 
 
 //Check if object is animated by checking if animlist_map holds the animlist_id of node transforms
-AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLADAFW::Node * node,
-                                                                                       std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map) 
+AnimationImporter::AnimMix *AnimationImporter::get_animation_type(const COLLADAFW::Node *node,
+                                                                  std::map<COLLADAFW::UniqueId, const COLLADAFW::Object *> FW_object_map)
 {
        AnimMix *types = new AnimMix();
 
@@ -1147,7 +1148,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
                        continue;
                }
                else {
-                       types->transform = types->transform|NODE_TRANSFORM;
+                       types->transform = types->transform | NODE_TRANSFORM;
                        break;
                }
        }
@@ -1159,7 +1160,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
                types->light = setAnimType(&(light->getFallOffAngle()), (types->light), LIGHT_FOA);
                types->light = setAnimType(&(light->getFallOffExponent()), (types->light), LIGHT_FOE);
 
-               if ( types->light != 0) break;
+               if (types->light != 0) break;
 
        }
 
@@ -1167,7 +1168,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
        for (unsigned int i = 0; i < nodeCameras.getCount(); i++) {
                const COLLADAFW::Camera *camera = (COLLADAFW::Camera *) FW_object_map[nodeCameras[i]->getInstanciatedObjectId()];
 
-               if ( camera->getCameraType() == COLLADAFW::Camera::PERSPECTIVE ) {
+               if (camera->getCameraType() == COLLADAFW::Camera::PERSPECTIVE) {
                        types->camera = setAnimType(&(camera->getXMag()), (types->camera), CAMERA_XFOV);
                }
                else {
@@ -1176,7 +1177,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
                types->camera = setAnimType(&(camera->getFarClippingPlane()), (types->camera), CAMERA_ZFAR);
                types->camera = setAnimType(&(camera->getNearClippingPlane()), (types->camera), CAMERA_ZNEAR);
 
-               if ( types->camera != 0) break;
+               if (types->camera != 0) break;
 
        }
 
@@ -1202,16 +1203,16 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
        return types;
 }
 
-int AnimationImporter::setAnimType ( const COLLADAFW::Animatable * prop, int types, int addition)
+int AnimationImporter::setAnimType(const COLLADAFW::Animatable *prop, int types, int addition)
 {
        const COLLADAFW::UniqueId& listid =  prop->getAnimationList();
        if (animlist_map.find(listid) != animlist_map.end())
-               return types|addition;
+               return types | addition;
        else return types;
 }              
 
 // Is not used anymore.
-void AnimationImporter::find_frames_old(std::vector<float> * frames, COLLADAFW::Node * node, COLLADAFW::Transformation::TransformationType tm_type)
+void AnimationImporter::find_frames_old(std::vector<float> *frames, COLLADAFW::Node *node, COLLADAFW::Transformation::TransformationType tm_type)
 {
        bool is_matrix = tm_type == COLLADAFW::Transformation::MATRIX;
        bool is_rotation = tm_type == COLLADAFW::Transformation::ROTATE;
@@ -1237,11 +1238,11 @@ void AnimationImporter::find_frames_old(std::vector<float> * frames, COLLADAFW::
                                if (bindings.getCount()) {
                                        //for each AnimationBinding get the fcurves which animate the transform
                                        for (unsigned int j = 0; j < bindings.getCount(); j++) {
-                                               std::vector<FCurve*>& curves = curve_map[bindings[j].animation];
+                                               std::vector<FCurve *>& curves = curve_map[bindings[j].animation];
                                                bool xyz = ((nodeTmType == COLLADAFW::Transformation::TRANSLATE || nodeTmType == COLLADAFW::Transformation::SCALE) && bindings[j].animationClass == COLLADAFW::AnimationList::POSITION_XYZ);
 
                                                if ((!xyz && curves.size() == 1) || (xyz && curves.size() == 3) || is_matrix) {
-                                                       std::vector<FCurve*>::iterator iter;
+                                                       std::vector<FCurve *>::iterator iter;
 
                                                        for (iter = curves.begin(); iter != curves.end(); iter++) {
                                                                FCurve *fcu = *iter;
@@ -1275,10 +1276,10 @@ void AnimationImporter::find_frames_old(std::vector<float> * frames, COLLADAFW::
 // animlist_map - map animlist id -> animlist
 // curve_map - map anim id -> curve(s)
 Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node,
-                                                       std::map<COLLADAFW::UniqueId, Object*>& object_map,
-                                                       std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map,
-                                                       COLLADAFW::Transformation::TransformationType tm_type,
-                                                       Object *par_job)
+                                                   std::map<COLLADAFW::UniqueId, Object *>& object_map,
+                                                   std::map<COLLADAFW::UniqueId, COLLADAFW::Node *>& root_map,
+                                                   COLLADAFW::Transformation::TransformationType tm_type,
+                                                   Object *par_job)
 {
        
        bool is_rotation = tm_type == COLLADAFW::Transformation::ROTATE;
@@ -1307,7 +1308,7 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node,
                get_joint_rest_mat(irest_dae, root, node);
                invert_m4(irest_dae);
 
-               Bone *bone = BKE_armature_find_bone_name((bArmature*)ob->data, bone_name);
+               Bone *bone = BKE_armature_find_bone_name((bArmature *)ob->data, bone_name);
                if (!bone) {
                        fprintf(stderr, "cannot find bone \"%s\"\n", bone_name);
                        return NULL;
@@ -1332,19 +1333,19 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node,
 
        const char *tm_str = NULL;
        switch (tm_type) {
-       case COLLADAFW::Transformation::ROTATE:
-               tm_str = "rotation_quaternion";
-               break;
-       case COLLADAFW::Transformation::SCALE:
-               tm_str = "scale";
-               break;
-       case COLLADAFW::Transformation::TRANSLATE:
-               tm_str = "location";
-               break;
-       case COLLADAFW::Transformation::MATRIX:
-               break;
-       default:
-               return job;
+               case COLLADAFW::Transformation::ROTATE:
+                       tm_str = "rotation_quaternion";
+                       break;
+               case COLLADAFW::Transformation::SCALE:
+                       tm_str = "scale";
+                       break;
+               case COLLADAFW::Transformation::TRANSLATE:
+                       tm_str = "location";
+                       break;
+               case COLLADAFW::Transformation::MATRIX:
+                       break;
+               default:
+                       return job;
        }
 
        char rna_path[200];
@@ -1425,22 +1426,22 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node,
                float val[4], rot[4], loc[3], scale[3];
 
                switch (tm_type) {
-               case COLLADAFW::Transformation::ROTATE:
-                       mat4_to_quat(val, mat);
-                       break;
-               case COLLADAFW::Transformation::SCALE:
-                       mat4_to_size(val, mat);
-                       break;
-               case COLLADAFW::Transformation::TRANSLATE:
-                       copy_v3_v3(val, mat[3]);
-                       break;
-               case COLLADAFW::Transformation::MATRIX:
-                       mat4_to_quat(rot, mat);
-                       copy_v3_v3(loc, mat[3]);
-                       mat4_to_size(scale, mat);
-                       break;
-               default:
-                       break;
+                       case COLLADAFW::Transformation::ROTATE:
+                               mat4_to_quat(val, mat);
+                               break;
+                       case COLLADAFW::Transformation::SCALE:
+                               mat4_to_size(val, mat);
+                               break;
+                       case COLLADAFW::Transformation::TRANSLATE:
+                               copy_v3_v3(val, mat[3]);
+                               break;
+                       case COLLADAFW::Transformation::MATRIX:
+                               mat4_to_quat(rot, mat);
+                               copy_v3_v3(loc, mat[3]);
+                               mat4_to_size(scale, mat);
+                               break;
+                       default:
+                               break;
                }
 
                // add keys
@@ -1461,22 +1462,22 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node,
 #ifdef ARMATURE_TEST
                if (is_joint) {
                        switch (tm_type) {
-                       case COLLADAFW::Transformation::ROTATE:
-                               mat4_to_quat(val, matfra);
-                               break;
-                       case COLLADAFW::Transformation::SCALE:
-                               mat4_to_size(val, matfra);
-                               break;
-                       case COLLADAFW::Transformation::TRANSLATE:
-                               copy_v3_v3(val, matfra[3]);
-                               break;
-                       case MATRIX:
-                               mat4_to_quat(rot, matfra);
-                               copy_v3_v3(loc, matfra[3]);
-                               mat4_to_size(scale, matfra);
-                               break;
-                       default:
-                               break;
+                               case COLLADAFW::Transformation::ROTATE:
+                                       mat4_to_quat(val, matfra);
+                                       break;
+                               case COLLADAFW::Transformation::SCALE:
+                                       mat4_to_size(val, matfra);
+                                       break;
+                               case COLLADAFW::Transformation::TRANSLATE:
+                                       copy_v3_v3(val, matfra[3]);
+                                       break;
+                               case MATRIX:
+                                       mat4_to_quat(rot, matfra);
+                                       copy_v3_v3(loc, matfra[3]);
+                                       mat4_to_size(scale, matfra);
+                                       break;
+                               default:
+                                       break;
                        }
 
                        for (i = 0; i < totcu; i++) {
@@ -1496,7 +1497,7 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node,
 #endif
        }
 
-       verify_adt_action((ID*)&ob->id, 1);
+       verify_adt_action((ID *)&ob->id, 1);
 
        ListBase *curves = &ob->adt->action->curves;
 
@@ -1545,20 +1546,20 @@ void AnimationImporter::evaluate_transform_at_frame(float mat[4][4], COLLADAFW::
                std::string nodename = node->getName().size() ? node->getName() : node->getOriginalId();
                if (!evaluate_animation(tm, m, fra, nodename.c_str())) {
                        switch (type) {
-                       case COLLADAFW::Transformation::ROTATE:
-                               dae_rotate_to_mat4(tm, m);
-                               break;
-                       case COLLADAFW::Transformation::TRANSLATE:
-                               dae_translate_to_mat4(tm, m);
-                               break;
-                       case COLLADAFW::Transformation::SCALE:
-                               dae_scale_to_mat4(tm, m);
-                               break;
-                       case COLLADAFW::Transformation::MATRIX:
-                               dae_matrix_to_mat4(tm, m);
-                               break;
-                       default:
-                               fprintf(stderr, "unsupported transformation type %d\n", type);
+                               case COLLADAFW::Transformation::ROTATE:
+                                       dae_rotate_to_mat4(tm, m);
+                                       break;
+                               case COLLADAFW::Transformation::TRANSLATE:
+                                       dae_translate_to_mat4(tm, m);
+                                       break;
+                               case COLLADAFW::Transformation::SCALE:
+                                       dae_scale_to_mat4(tm, m);
+                                       break;
+                               case COLLADAFW::Transformation::MATRIX:
+                                       dae_matrix_to_mat4(tm, m);
+                                       break;
+                               default:
+                                       fprintf(stderr, "unsupported transformation type %d\n", type);
                        }
                        // dae_matrix_to_mat4(tm, m);
                        
@@ -1578,9 +1579,9 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
        COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
 
        if (type != COLLADAFW::Transformation::ROTATE &&
-               type != COLLADAFW::Transformation::SCALE &&
-               type != COLLADAFW::Transformation::TRANSLATE &&
-               type != COLLADAFW::Transformation::MATRIX) {
+           type != COLLADAFW::Transformation::SCALE &&
+           type != COLLADAFW::Transformation::TRANSLATE &&
+           type != COLLADAFW::Transformation::MATRIX) {
                fprintf(stderr, "animation of transformation %d is not supported yet\n", type);
                return false;
        }
@@ -1604,25 +1605,25 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
 
                for (unsigned int j = 0; j < bindings.getCount(); j++) {
                        const COLLADAFW::AnimationList::AnimationBinding& binding = bindings[j];
-                       std::vector<FCurve*>& curves = curve_map[binding.animation];
+                       std::vector<FCurve *>& curves = curve_map[binding.animation];
                        COLLADAFW::AnimationList::AnimationClass animclass = binding.animationClass;
                        char path[100];
 
                        switch (type) {
-                       case COLLADAFW::Transformation::ROTATE:
-                               BLI_snprintf(path, sizeof(path), "%s.rotate (binding %u)", node_id, j);
-                               break;
-                       case COLLADAFW::Transformation::SCALE:
-                               BLI_snprintf(path, sizeof(path), "%s.scale (binding %u)", node_id, j);
-                               break;
-                       case COLLADAFW::Transformation::TRANSLATE:
-                               BLI_snprintf(path, sizeof(path), "%s.translate (binding %u)", node_id, j);
-                               break;
-                       case COLLADAFW::Transformation::MATRIX:
-                               BLI_snprintf(path, sizeof(path), "%s.matrix (binding %u)", node_id, j);
-                               break;
-                       default:
-                               break;
+                               case COLLADAFW::Transformation::ROTATE:
+                                       BLI_snprintf(path, sizeof(path), "%s.rotate (binding %u)", node_id, j);
+                                       break;
+                               case COLLADAFW::Transformation::SCALE:
+                                       BLI_snprintf(path, sizeof(path), "%s.scale (binding %u)", node_id, j);
+                                       break;
+                               case COLLADAFW::Transformation::TRANSLATE:
+                                       BLI_snprintf(path, sizeof(path), "%s.translate (binding %u)", node_id, j);
+                                       break;
+                               case COLLADAFW::Transformation::MATRIX:
+                                       BLI_snprintf(path, sizeof(path), "%s.matrix (binding %u)", node_id, j);
+                                       break;
+                               default:
+                                       break;
                        }
 
                        if (animclass == COLLADAFW::AnimationList::UNKNOWN_CLASS) {
@@ -1642,7 +1643,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
                                        return false;
                                }
 
-                               COLLADABU::Math::Vector3& axis = ((COLLADAFW::Rotate*)tm)->getRotationAxis();
+                               COLLADABU::Math::Vector3& axis = ((COLLADAFW::Rotate *)tm)->getRotationAxis();
 
                                float ax[3] = {(float)axis[0], (float)axis[1], (float)axis[2]};
                                float angle = evaluate_fcurve(curves[0], fra);
@@ -1662,23 +1663,23 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
                                }
                                
                                switch (animclass) {
-                               case COLLADAFW::AnimationList::POSITION_X:
-                                       vec[0] = evaluate_fcurve(curves[0], fra);
-                                       break;
-                               case COLLADAFW::AnimationList::POSITION_Y:
-                                       vec[1] = evaluate_fcurve(curves[0], fra);
-                                       break;
-                               case COLLADAFW::AnimationList::POSITION_Z:
-                                       vec[2] = evaluate_fcurve(curves[0], fra);
-                                       break;
-                               case COLLADAFW::AnimationList::POSITION_XYZ:
-                                       vec[0] = evaluate_fcurve(curves[0], fra);
-                                       vec[1] = evaluate_fcurve(curves[1], fra);
-                                       vec[2] = evaluate_fcurve(curves[2], fra);
-                                       break;
-                               default:
-                                       fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass);
-                                       break;
+                                       case COLLADAFW::AnimationList::POSITION_X:
+                                               vec[0] = evaluate_fcurve(curves[0], fra);
+                                               break;
+                                       case COLLADAFW::AnimationList::POSITION_Y:
+                                               vec[1] = evaluate_fcurve(curves[0], fra);
+                                               break;
+                                       case COLLADAFW::AnimationList::POSITION_Z:
+                                               vec[2] = evaluate_fcurve(curves[0], fra);
+                                               break;
+                                       case COLLADAFW::AnimationList::POSITION_XYZ:
+                                               vec[0] = evaluate_fcurve(curves[0], fra);
+                                               vec[1] = evaluate_fcurve(curves[1], fra);
+                                               vec[2] = evaluate_fcurve(curves[2], fra);
+                                               break;
+                                       default:
+                                               fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass);
+                                               break;
                                }
                        }
                        else if (type == COLLADAFW::Transformation::MATRIX) {
@@ -1691,7 +1692,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
                                COLLADABU::Math::Matrix4 matrix;
                                int i = 0, j = 0;
 
-                               for (std::vector<FCurve*>::iterator it = curves.begin(); it != curves.end(); it++) {
+                               for (std::vector<FCurve *>::iterator it = curves.begin(); it != curves.end(); it++) {
                                        matrix.setElement(i, j, evaluate_fcurve(*it, fra));
                                        j++;
                                        if (j == 4) {
@@ -1704,7 +1705,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
                                COLLADAFW::Matrix tm(matrix);
                                dae_matrix_to_mat4(&tm, mat);
 
-                               std::vector<FCurve*>::iterator it;
+                               std::vector<FCurve *>::iterator it;
 
                                return true;
                        }
@@ -1770,14 +1771,14 @@ bool AnimationImporter::calc_joint_parent_mat_rest(float mat[4][4], float par[4]
 Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::Node *node, Object *par_job)
 {
        if (joint_objects.find(node->getUniqueId()) == joint_objects.end()) {
-               Object *job = bc_add_object(scene, OB_EMPTY, (char*)get_joint_name(node));
+               Object *job = bc_add_object(scene, OB_EMPTY, (char *)get_joint_name(node));
 
                job->lay = BKE_scene_base_find(scene, job)->lay = 2;
 
                mul_v3_fl(job->size, 0.5f);
                job->recalc |= OB_RECALC_OB;
 
-               verify_adt_action((ID*)&job->id, 1);
+               verify_adt_action((ID *)&job->id, 1);
 
                job->rotmode = ROT_MODE_QUAT;
 
@@ -1854,7 +1855,7 @@ void AnimationImporter::add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurv
        /* no matching groups, so add one */
        if (grp == NULL) {
                /* Add a new group, and make it active */
-               grp = (bActionGroup*)MEM_callocN(sizeof(bActionGroup), "bActionGroup");
+               grp = (bActionGroup *)MEM_callocN(sizeof(bActionGroup), "bActionGroup");
                                        
                grp->flag = AGRP_SELECTED;
                BLI_strncpy(grp->name, bone_name, sizeof(grp->name));
@@ -1874,7 +1875,7 @@ void AnimationImporter::add_bezt(FCurve *fcu, float fra, float value)
        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.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);
index e5548ac..98047df 100644 (file)
@@ -58,16 +58,17 @@ extern "C" {
 // XXX exporter writes wrong data for shared armatures.  A separate
 // controller should be written for each armature-mesh binding how do
 // we make controller ids then?
-ArmatureExporter::ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryControllers(sw), export_settings(export_settings) {}
+ArmatureExporter::ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryControllers(sw), export_settings(export_settings) {
+}
 
 // write bone nodes
-void ArmatureExporter::add_armature_bones(Object *ob_arm, Scenesce,
-                                                                                 SceneExporter* se,
-                                                                                 std::list<Object*>& child_objects)
+void ArmatureExporter::add_armature_bones(Object *ob_arm, Scene *sce,
+                                          SceneExporter *se,
+                                          std::list<Object *>& child_objects)
 {
        // write bone nodes
-       bArmature *arm = (bArmature*)ob_arm->data;
-       for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) {
+       bArmature *arm = (bArmature *)ob_arm->data;
+       for (Bone *bone = (Bone *)arm->bonebase.first; bone; bone = bone->next) {
                // start from root bones
                if (!bone->parent)
                        add_bone_node(bone, ob_arm, sce, se, child_objects);
@@ -82,7 +83,7 @@ bool ArmatureExporter::is_skinned_mesh(Object *ob)
 bool ArmatureExporter::add_instance_controller(Object *ob)
 {
        Object *ob_arm = bc_get_assigned_armature(ob);
-       bArmature *arm = (bArmature*)ob_arm->data;
+       bArmature *arm = (bArmature *)ob_arm->data;
 
        const std::string& controller_id = get_controller_id(ob_arm, ob);
 
@@ -94,7 +95,7 @@ bool ArmatureExporter::add_instance_controller(Object *ob)
 
        // write root bone URLs
        Bone *bone;
-       for (bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) {
+       for (bone = (Bone *)arm->bonebase.first; bone; bone = bone->next) {
                if (!bone->parent)
                        ins.addSkeleton(COLLADABU::URI(COLLADABU::Utils::EMPTY_STRING, get_joint_id(bone, ob_arm)));
        }
@@ -140,7 +141,7 @@ void ArmatureExporter::find_objects_using_armature(Object *ob_arm, std::vector<O
 {
        objects.clear();
 
-       Base *base= (Base*) sce->base.first;
+       Base *base = (Base *) sce->base.first;
        while (base) {
                Object *ob = base->object;
                
@@ -148,7 +149,7 @@ void ArmatureExporter::find_objects_using_armature(Object *ob_arm, std::vector<O
                        objects.push_back(ob);
                }
 
-               base= base->next;
+               base = base->next;
        }
 }
 #endif
@@ -159,9 +160,9 @@ std::string ArmatureExporter::get_joint_sid(Bone *bone, Object *ob_arm)
 }
 
 // parent_mat is armature-space
-void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scenesce,
-                                                                        SceneExporter* se,
-                                                                        std::list<Object*>& child_objects)
+void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene *sce,
+                                     SceneExporter *se,
+                                     std::list<Object *>& child_objects)
 {
        std::string node_id = get_joint_id(bone, ob_arm);
        std::string node_name = std::string(bone->name);
@@ -175,14 +176,14 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce,
        node.setNodeSid(node_sid);
 
        /*if ( bone->childbase.first == NULL || BLI_countlist(&(bone->childbase))>=2)
-               add_blender_leaf_bone( bone, ob_arm , node );
-       else{*/
+           add_blender_leaf_bone( bone, ob_arm , node );
+          else{*/
        node.start();
 
        add_bone_transform(ob_arm, bone, node);
 
        // Write nodes of childobjects, remove written objects from list
-       std::list<Object*>::iterator i = child_objects.begin();
+       std::list<Object *>::iterator i = child_objects.begin();
 
        while (i != child_objects.end()) {
                if ((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name))) {
@@ -219,29 +220,32 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce,
                else i++;
        }
 
-       for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) {
+       for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
                add_bone_node(child, ob_arm, sce, se, child_objects);
        }
        node.end();
        //}
 }
 
-/*void ArmatureExporter::add_blender_leaf_bone(Bone *bone, Object *ob_arm, COLLADASW::Node& node)
+#if 0
+void ArmatureExporter::add_blender_leaf_bone(Bone *bone, Object *ob_arm, COLLADASW::Node& node)
 {
        node.start();
        
        add_bone_transform(ob_arm, bone, node);
        
-       node.addExtraTechniqueParameter("blender", "tip_x", bone->tail[0] );
-       node.addExtraTechniqueParameter("blender", "tip_y", bone->tail[1] );
-       node.addExtraTechniqueParameter("blender", "tip_z", bone->tail[2] );
+       node.addExtraTechniqueParameter("blender", "tip_x", bone->tail[0]);
+       node.addExtraTechniqueParameter("blender", "tip_y", bone->tail[1]);
+       node.addExtraTechniqueParameter("blender", "tip_z", bone->tail[2]);
        
-       for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) {
+       for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
                add_bone_node(child, ob_arm, sce, se, child_objects);
        }
        node.end();
        
-}*/
+}
+#endif
+
 void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node)
 {
        bPoseChannel *pchan = BKE_pose_channel_find_name(ob_arm->pose, bone->name);
@@ -292,7 +296,7 @@ std::string ArmatureExporter::get_controller_id(Object *ob_arm, Object *ob)
 
 // ob should be of type OB_MESH
 // both args are required
-void ArmatureExporter::export_controller(Objectob, Object *ob_arm)
+void ArmatureExporter::export_controller(Object *ob, Object *ob_arm)
 {
        // joint names
        // joint inverse bind matrices
@@ -302,29 +306,29 @@ void ArmatureExporter::export_controller(Object* ob, Object *ob_arm)
        // joint names: ob -> vertex group names
        // vertex group weights: me->dvert -> groups -> index, weight
 
-       /*
-       me->dvert:
+#if 0
+       me->dvert :
 
        typedef struct MDeformVert {
                struct MDeformWeight *dw;
                int totweight;
-               int flag;       // flag only in use for weightpaint now
+               int flag;   // flag only in use for weightpaint now
        } MDeformVert;
 
        typedef struct MDeformWeight {
-               int                             def_nr;
-               float                   weight;
+               int def_nr;
+               float weight;
        } MDeformWeight;
-       */
+#endif
 
        bool use_instantiation = this->export_settings->use_object_instantiation;
        Mesh *me;
 
-       if ( this->export_settings->apply_modifiers ) {
+       if (this->export_settings->apply_modifiers) {
                me = bc_to_mesh_apply_modifiers(scene, ob);
        } 
        else {
-               me = (Mesh*)ob->data;
+               me = (Mesh *)ob->data;
        }
        BKE_mesh_tessface_ensure(me);
 
@@ -352,7 +356,7 @@ void ArmatureExporter::export_controller(Object* ob, Object *ob_arm)
                std::vector<int> joint_index_by_def_index;
                bDeformGroup *def;
 
-               for (def = (bDeformGroup*)ob->defbase.first, i = 0, j = 0; def; def = def->next, i++) {
+               for (def = (bDeformGroup *)ob->defbase.first, i = 0, j = 0; def; def = def->next, i++) {
                        if (is_bone_defgroup(ob_arm, def))
                                joint_index_by_def_index.push_back(j++);
                        else
@@ -375,18 +379,20 @@ void ArmatureExporter::export_controller(Object* ob, Object *ob_arm)
                        }
 
                        if (sumw > 0.0f) {
-                               float invsumw = 1.0f/sumw;
+                               float invsumw = 1.0f / sumw;
                                vcounts.push_back(jw.size());
                                for (std::map<int, float>::iterator m = jw.begin(); m != jw.end(); ++m) {
                                        joints.push_back((*m).first);
-                                       weights.push_back(invsumw*(*m).second);
+                                       weights.push_back(invsumw * (*m).second);
                                }
                        }
                        else {
                                vcounts.push_back(0);
-                               /*vcounts.push_back(1);
+#if 0
+                               vcounts.push_back(1);
                                joints.push_back(-1);
-                               weights.push_back(1.0f);*/
+                               weights.push_back(1.0f);
+#endif
                        }
                }
        }
@@ -404,15 +410,15 @@ void ArmatureExporter::export_controller(Object* ob, Object *ob_arm)
 }
 
 void ArmatureExporter::add_joints_element(ListBase *defbase,
-                                               const std::string& joints_source_id, const std::string& inv_bind_mat_source_id)
+                                          const std::string& joints_source_id, const std::string& inv_bind_mat_source_id)
 {
        COLLADASW::JointsElement joints(mSW);
        COLLADASW::InputList &input = joints.getInputList();
 
        input.push_back(COLLADASW::Input(COLLADASW::InputSemantic::JOINT, // constant declared in COLLADASWInputList.h
-                                                          COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id)));
+                                        COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id)));
        input.push_back(COLLADASW::Input(COLLADASW::InputSemantic::BINDMATRIX,
-                                                          COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, inv_bind_mat_source_id)));
+                                        COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, inv_bind_mat_source_id)));
        joints.add();
 }
 
@@ -431,7 +437,7 @@ std::string ArmatureExporter::add_joints_source(Object *ob_arm, ListBase *defbas
 
        int totjoint = 0;
        bDeformGroup *def;
-       for (def = (bDeformGroup*)defbase->first; def; def = def->next) {
+       for (def = (bDeformGroup *)defbase->first; def; def = def->next) {
                if (is_bone_defgroup(ob_arm, def))
                        totjoint++;
        }
@@ -447,7 +453,7 @@ std::string ArmatureExporter::add_joints_source(Object *ob_arm, ListBase *defbas
 
        source.prepareToAppendValues();
 
-       for (def = (bDeformGroup*)defbase->first; def; def = def->next) {
+       for (def = (bDeformGroup *)defbase->first; def; def = def->next) {
                Bone *bone = get_bone_from_defgroup(ob_arm, def);
                if (bone)
                        source.appendValues(get_joint_sid(bone, ob_arm));
@@ -463,7 +469,7 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase
        std::string source_id = controller_id + BIND_POSES_SOURCE_ID_SUFFIX;
 
        int totjoint = 0;
-       for (bDeformGroup *def = (bDeformGroup*)defbase->first; def; def = def->next) {
+       for (bDeformGroup *def = (bDeformGroup *)defbase->first; def; def = def->next) {
                if (is_bone_defgroup(ob_arm, def))
                        totjoint++;
        }
@@ -481,7 +487,7 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase
        source.prepareToAppendValues();
 
        bPose *pose = ob_arm->pose;
-       bArmature *arm = (bArmature*)ob_arm->data;
+       bArmature *arm = (bArmature *)ob_arm->data;
 
        int flag = arm->flag;
 
@@ -491,7 +497,7 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase
                BKE_pose_where_is(scene, ob_arm);
        }
 
-       for (bDeformGroup *def = (bDeformGroup*)defbase->first; def; def = def->next) {
+       for (bDeformGroup *def = (bDeformGroup *)defbase->first; def; def = def->next) {
                if (is_bone_defgroup(ob_arm, def)) {
                        bPoseChannel *pchan = BKE_pose_channel_find_name(pose, def->name);
 
@@ -530,13 +536,13 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase
        return source_id;
 }
 
-Bone *ArmatureExporter::get_bone_from_defgroup(Object *ob_arm, bDeformGroupdef)
+Bone *ArmatureExporter::get_bone_from_defgroup(Object *ob_arm, bDeformGroup *def)
 {
        bPoseChannel *pchan = BKE_pose_channel_find_name(ob_arm->pose, def->name);
        return pchan ? pchan->bone : NULL;
 }
 
-bool ArmatureExporter::is_bone_defgroup(Object *ob_arm, bDeformGroupdef)
+bool ArmatureExporter::is_bone_defgroup(Object *ob_arm, bDeformGroup *def)
 {
        return get_bone_from_defgroup(ob_arm, def) != NULL;
 }
@@ -566,17 +572,17 @@ std::string ArmatureExporter::add_weights_source(Mesh *me, const std::string& co
 }
 
 void ArmatureExporter::add_vertex_weights_element(const std::string& weights_source_id, const std::string& joints_source_id,
-                                                                                                 const std::list<int>& vcounts,
-                                                                                                 const std::list<int>& joints)
+                                                  const std::list<int>& vcounts,
+                                                  const std::list<int>& joints)
 {
        COLLADASW::VertexWeightsElement weightselem(mSW);
        COLLADASW::InputList &input = weightselem.getInputList();
 
        int offset = 0;
        input.push_back(COLLADASW::Input(COLLADASW::InputSemantic::JOINT, // constant declared in COLLADASWInputList.h
-                                                                        COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id), offset++));
+                                        COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, joints_source_id), offset++));
        input.push_back(COLLADASW::Input(COLLADASW::InputSemantic::WEIGHT,
-                                                                        COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, weights_source_id), offset++));
+                                        COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, weights_source_id), offset++));
 
        weightselem.setCount(vcounts.size());
 
index f23b2bf..c58b6f3 100644 (file)
@@ -50,7 +50,8 @@ static const char *bc_get_joint_name(T *node)
 }
 
 ArmatureImporter::ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, AnimationImporterBase *anim, Scene *sce) :
-       TransformReader(conv), scene(sce), empty(NULL), mesh_importer(mesh), anim_importer(anim) {}
+       TransformReader(conv), scene(sce), empty(NULL), mesh_importer(mesh), anim_importer(anim) {
+}
 
 ArmatureImporter::~ArmatureImporter()
 {
@@ -68,7 +69,7 @@ JointData *ArmatureImporter::get_joint_data(COLLADAFW::Node *node);
 
        if (joint_id_to_joint_index_map.find(joint_id) == joint_id_to_joint_index_map.end()) {
                fprintf(stderr, "Cannot find a joint index by joint id for %s.\n",
-                               node->getOriginalId().c_str());
+                       node->getOriginalId().c_str());
                return NULL;
        }
 
@@ -77,12 +78,12 @@ JointData *ArmatureImporter::get_joint_data(COLLADAFW::Node *node);
        return &joint_index_to_joint_info_map[joint_index];
 }
 #endif
-void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *parent, int totchild,
-                                float parent_mat[][4], Object * ob_arm)
+void ArmatureImporter::create_unskinned_bone(COLLADAFW::Node *node, EditBone *parent, int totchild,
+                                             float parent_mat[][4], Object *ob_arm)
 {
-       std::vector<COLLADAFW::Node*>::iterator it;
+       std::vector<COLLADAFW::Node *>::iterator it;
        it = std::find(finished_joints.begin(), finished_joints.end(), node);
-       if ( it != finished_joints.end()) return; 
+       if (it != finished_joints.end()) return;
 
        float mat[4][4];
        float obmat[4][4];
@@ -90,7 +91,7 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p
        // object-space
        get_node_mat(obmat, node, NULL, NULL);
 
-       EditBone *bone = ED_armature_edit_bone_add((bArmature*)ob_arm->data, (char*)bc_get_joint_name(node));
+       EditBone *bone = ED_armature_edit_bone_add((bArmature *)ob_arm->data, (char *)bc_get_joint_name(node));
        totbone++;
        
        if (parent) bone->parent = parent;
@@ -107,9 +108,9 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p
 
        }
        float loc[3], size[3], rot[3][3];
-       mat4_to_loc_rot_size( loc, rot, size, obmat);
-       mat3_to_vec_roll(rot, NULL, &angle );
-       bone->roll=angle;
+       mat4_to_loc_rot_size(loc, rot, size, obmat);
+       mat3_to_vec_roll(rot, NULL, &angle);
+       bone->roll = angle;
        // set head
        copy_v3_v3(bone->head, mat[3]);
 
@@ -142,7 +143,7 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p
 
        COLLADAFW::NodePointerArray& children = node->getChildNodes();
        for (unsigned int i = 0; i < children.getCount(); i++) {
-               create_unskinned_bone( children[i], bone, children.getCount(), mat, ob_arm);
+               create_unskinned_bone(children[i], bone, children.getCount(), mat, ob_arm);
        }
 
        // in second case it's not a leaf bone, but we handle it the same way
@@ -155,12 +156,12 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p
 }
 
 void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBone *parent, int totchild,
-                                float parent_mat[][4], bArmature *arm)
+                                   float parent_mat[][4], bArmature *arm)
 {
        //Checking if bone is already made.
-       std::vector<COLLADAFW::Node*>::iterator it;
+       std::vector<COLLADAFW::Node *>::iterator it;
        it = std::find(finished_joints.begin(), finished_joints.end(), node);
-       if ( it != finished_joints.end()) return; 
+       if (it != finished_joints.end()) return;
 
        float joint_inv_bind_mat[4][4];
 
@@ -169,7 +170,7 @@ void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBo
        float mat[4][4];
 
        // TODO rename from Node "name" attrs later
-       EditBone *bone = ED_armature_edit_bone_add(arm, (char*)bc_get_joint_name(node));
+       EditBone *bone = ED_armature_edit_bone_add(arm, (char *)bc_get_joint_name(node));
        totbone++;
 
        if (skin.get_joint_inv_bind_matrix(joint_inv_bind_mat, node)) {
@@ -190,9 +191,9 @@ void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBo
                        copy_m4_m4(mat, obmat);
 
                float loc[3], size[3], rot[3][3], angle;
-               mat4_to_loc_rot_size( loc, rot, size, obmat);
-               mat3_to_vec_roll(rot, NULL, &angle );
-               bone->roll=angle;
+               mat4_to_loc_rot_size(loc, rot, size, obmat);
+               mat3_to_vec_roll(rot, NULL, &angle);
+               bone->roll = angle;
        }
 
        
@@ -267,7 +268,7 @@ void ArmatureImporter::create_bone(SkinInfo& skin, COLLADAFW::Node *node, EditBo
        finished_joints.push_back(node);
 }
 
-void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone,  COLLADAFW::Node * node)
+void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone,  COLLADAFW::Node *node)
 {
        LeafBone leaf;
 
@@ -337,7 +338,7 @@ void ArmatureImporter::set_euler_rotmode()
 {
        // just set rotmode = ROT_MODE_EUL on pose channel for each joint
 
-       std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>::iterator it;
+       std::map<COLLADAFW::UniqueId, COLLADAFW::Node *>::iterator it;
 
        for (it = joint_by_uid.begin(); it != joint_by_uid.end(); it++) {
 
@@ -378,7 +379,7 @@ Object *ArmatureImporter::get_empty_for_leaves()
 #if 0
 Object *ArmatureImporter::find_armature(COLLADAFW::Node *node)
 {
-       JointDatajd = get_joint_data(node);
+       JointData *jd = get_joint_data(node);
        if (jd) return jd->ob_arm;
 
        COLLADAFW::NodePointerArray& children = node->getChildNodes();
@@ -408,10 +409,10 @@ ArmatureJoints& ArmatureImporter::get_armature_joints(Object *ob_arm)
 #endif
 void ArmatureImporter::create_armature_bones( )
 {
-       std::vector<COLLADAFW::Node*>::iterator ri;
+       std::vector<COLLADAFW::Node *>::iterator ri;
        //if there is an armature created for root_joint next root_joint
        for (ri = root_joints.begin(); ri != root_joints.end(); ri++) {
-               if ( get_armature_for_joint(*ri) != NULL ) continue;
+               if (get_armature_for_joint(*ri) != NULL) continue;
                
                //add armature object for current joint
                //Object *ob_arm = bc_add_object(scene, OB_ARMATURE, NULL);
@@ -428,9 +429,9 @@ void ArmatureImporter::create_armature_bones( )
 
                // create unskinned bones
                /*
-                 TODO:
-                 check if bones have already been created for a given joint
-               */
+                * TODO:
+                * check if bones have already been created for a given joint
+                */
                leaf_bone_length = FLT_MAX;
                create_unskinned_bone(*ri, NULL, (*ri)->getChildNodes().getCount(), NULL, ob_arm);
 
@@ -442,10 +443,10 @@ void ArmatureImporter::create_armature_bones( )
 
                ED_armature_from_edit(ob_arm);
 
-               set_pose(ob_arm, *ri, NULL, NULL );
+               set_pose(ob_arm, *ri, NULL, NULL);
 
                ED_armature_edit_free(ob_arm);
-               DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB|OB_RECALC_DATA);
+               DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB | OB_RECALC_DATA);
        }
 
        
@@ -496,7 +497,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin)
 
        SkinInfo *a = &skin;
        Object *shared = NULL;
-       std::vector<COLLADAFW::Node*> skin_root_joints;
+       std::vector<COLLADAFW::Node *> skin_root_joints;
 
        std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it;
        for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) {
@@ -508,7 +509,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin)
 
                b->find_root_joints(root_joints, joint_by_uid, skin_root_joints);
 
-               std::vector<COLLADAFW::Node*>::iterator ri;
+               std::vector<COLLADAFW::Node *>::iterator ri;
                for (ri = skin_root_joints.begin(); ri != skin_root_joints.end(); ri++) {
                        if (a->uses_joint_or_descendant(*ri)) {
                                shared = b->BKE_armature_from_object();
@@ -523,7 +524,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin)
        if (shared)
                ob_arm = skin.set_armature(shared);
        else
-               ob_arm = skin.create_armature(scene); //once for every armature
+               ob_arm = skin.create_armature(scene);  //once for every armature
 
        // enter armature edit mode
        ED_armature_to_edit(ob_arm);
@@ -538,9 +539,9 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin)
        /*
           TODO:
           check if bones have already been created for a given joint
-       */
+        */
 
-       std::vector<COLLADAFW::Node*>::iterator ri;
+       std::vector<COLLADAFW::Node *>::iterator ri;
        for (ri = root_joints.begin(); ri != root_joints.end(); ri++) {
                // for shared armature check if bone tree is already created
                if (shared && std::find(skin_root_joints.begin(), skin_root_joints.end(), *ri) != skin_root_joints.end())
@@ -548,7 +549,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin)
 
                // since root_joints may contain joints for multiple controllers, we need to filter
                if (skin.uses_joint_or_descendant(*ri)) {
-                       create_bone(skin, *ri, NULL, (*ri)->getChildNodes().getCount(), NULL, (bArmature*)ob_arm->data);
+                       create_bone(skin, *ri, NULL, (*ri)->getChildNodes().getCount(), NULL, (bArmature *)ob_arm->data);
 
                        if (joint_parent_map.find((*ri)->getUniqueId()) != joint_parent_map.end() && !skin.get_parent())
                                skin.set_parent(joint_parent_map[(*ri)->getUniqueId()]);
@@ -560,7 +561,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin)
        // exit armature edit mode
        ED_armature_from_edit(ob_arm);
        ED_armature_edit_free(ob_arm);
-       DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB|OB_RECALC_DATA);
+       DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB | OB_RECALC_DATA);
 
        // set_leaf_bone_shapes(ob_arm);
        // set_euler_rotmode();
@@ -571,9 +572,9 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin)
 // is a child of a node (not joint), root should be true since
 // this is where we build armature bones from
 
-void ArmatureImporter::set_pose(Object * ob_arm,  COLLADAFW::Node * root_node, const char *parentname, float parent_mat[][4])
+void ArmatureImporter::set_pose(Object *ob_arm,  COLLADAFW::Node *root_node, const char *parentname, float parent_mat[][4])
 { 
-       char * bone_name = (char *) bc_get_joint_name ( root_node);
+       char *bone_name = (char *) bc_get_joint_name(root_node);
        float mat[4][4];
        float obmat[4][4];
 
@@ -584,7 +585,7 @@ void ArmatureImporter::set_pose(Object * ob_arm,  COLLADAFW::Node * root_node, c
        get_node_mat(obmat, root_node, NULL, NULL);
 
        //if (*edbone)
-       bPoseChannel * pchan  = BKE_pose_channel_find_name(ob_arm -> pose, bone_name);
+       bPoseChannel *pchan  = BKE_pose_channel_find_name(ob_arm->pose, bone_name);
        //else fprintf ( "",
 
        // get world-space
@@ -592,7 +593,7 @@ void ArmatureImporter::set_pose(Object * ob_arm,  COLLADAFW::Node * root_node, c
                mult_m4_m4m4(mat, parent_mat, obmat);
                bPoseChannel *parchan = BKE_pose_channel_find_name(ob_arm->pose, parentname);
 
-               mult_m4_m4m4(pchan->pose_mat, parchan->pose_mat, mat );
+               mult_m4_m4m4(pchan->pose_mat, parchan->pose_mat, mat);
 
        }
        else {
@@ -631,7 +632,7 @@ void ArmatureImporter::add_root_joint(COLLADAFW::Node *node)
 {
        // root_joints.push_back(node);
        Object *ob_arm = find_armature(node);
-       if (ob_arm)     {
+       if (ob_arm) {
                get_armature_joints(ob_arm).root_joints.push_back(node);
        }
 #ifdef COLLADA_DEBUG
@@ -694,7 +695,7 @@ void ArmatureImporter::link_armature(Object *ob_arm, const COLLADAFW::UniqueId&
 }
 #endif
 
-bool ArmatureImporter::write_skin_controller_data(const COLLADAFW::SkinControllerDatadata)
+bool ArmatureImporter::write_skin_controller_data(const COLLADAFW::SkinControllerData *data)
 {
        // at this stage we get vertex influence info that should go into me->verts and ob->defbase
        // there's no info to which object this should be long so we associate it with skin controller data UID
@@ -719,14 +720,14 @@ bool ArmatureImporter::write_skin_controller_data(const COLLADAFW::SkinControlle
        return true;
 }
 
-bool ArmatureImporter::write_controller(const COLLADAFW::Controllercontroller)
+bool ArmatureImporter::write_controller(const COLLADAFW::Controller *controller)
 {
        // - create and store armature object
 
        const COLLADAFW::UniqueId& skin_id = controller->getUniqueId();
 
        if (controller->getControllerType() == COLLADAFW::Controller::CONTROLLER_TYPE_SKIN) {
-               COLLADAFW::SkinController *co = (COLLADAFW::SkinController*)controller;
+               COLLADAFW::SkinController *co = (COLLADAFW::SkinController *)controller;
                // to be able to find geom id by controller id
                geom_uid_by_controller_uid[skin_id] = co->getSource();
 
@@ -766,7 +767,7 @@ Object *ArmatureImporter::get_armature_for_joint(COLLADAFW::Node *node)
                        return skin.BKE_armature_from_object();
        }
 
-       std::map<COLLADAFW::UniqueId, Object*>::iterator arm;
+       std::map<COLLADAFW::UniqueId, Object *>::iterator arm;
        for (arm = unskinned_armature_map.begin(); arm != unskinned_armature_map.end(); arm++) {
                if (arm->first == node->getUniqueId() )
                        return arm->second;
@@ -799,6 +800,3 @@ bool ArmatureImporter::get_joint_bind_mat(float m[][4], COLLADAFW::Node *joint)
 
        return found;
 }
-
-
-
index 4e7f2f0..be424fb 100644 (file)
@@ -37,13 +37,14 @@ extern "C" {
 
 #include "collada_internal.h"
 
-CamerasExporter::CamerasExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings): COLLADASW::LibraryCameras(sw), export_settings(export_settings) {}
+CamerasExporter::CamerasExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryCameras(sw), export_settings(export_settings) {
+}
 
 template<class Functor>
 void forEachCameraObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set)
 {
        LinkNode *node;
-       for(node=export_set; node; node = node->next) {
+       for (node = export_set; node; node = node->next) {
                Object *ob = (Object *)node->link;
 
                if (ob->type == OB_CAMERA && ob->data) {
@@ -63,32 +64,33 @@ void CamerasExporter::exportCameras(Scene *sce)
 void CamerasExporter::operator()(Object *ob, Scene *sce)
 {
        // TODO: shiftx, shifty, YF_dofdist
-       Camera *cam = (Camera*)ob->data;
+       Camera *cam = (Camera *)ob->data;
        std::string cam_id(get_camera_id(ob));
        std::string cam_name(id_name(cam));
 
        switch (cam->type) {
-       case CAM_PANO:  
-       case CAM_PERSP: {
-               COLLADASW::PerspectiveOptic persp(mSW);
-               persp.setXFov(RAD2DEGF(focallength_to_fov(cam->lens, cam->sensor_x)), "xfov");
-               persp.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch), false, "aspect_ratio");
-               persp.setZFar(cam->clipend, false, "zfar");
-               persp.setZNear(cam->clipsta, false, "znear");
-               COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name);
-               addCamera(ccam);
-               break;
+               case CAM_PANO:
+               case CAM_PERSP: {
+                       COLLADASW::PerspectiveOptic persp(mSW);
+                       persp.setXFov(RAD2DEGF(focallength_to_fov(cam->lens, cam->sensor_x)), "xfov");
+                       persp.setAspectRatio((float)(sce->r.xsch) / (float)(sce->r.ysch), false, "aspect_ratio");
+                       persp.setZFar(cam->clipend, false, "zfar");
+                       persp.setZNear(cam->clipsta, false, "znear");
+                       COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name);
+                       addCamera(ccam);
+                       break;
+               }
+               case CAM_ORTHO:
+               default:
+               {
+                       COLLADASW::OrthographicOptic ortho(mSW);
+                       ortho.setXMag(cam->ortho_scale, "xmag");
+                       ortho.setAspectRatio((float)(sce->r.xsch) / (float)(sce->r.ysch), false, "aspect_ratio");
+                       ortho.setZFar(cam->clipend, false, "zfar");
+                       ortho.setZNear(cam->clipsta, false, "znear");
+                       COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name);
+                       addCamera(ccam);
+                       break;
+               }
        }
-       case CAM_ORTHO:
-       default:
-       {
-               COLLADASW::OrthographicOptic ortho(mSW);
-               ortho.setXMag(cam->ortho_scale, "xmag");
-               ortho.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch), false, "aspect_ratio");
-               ortho.setZFar(cam->clipend, false, "zfar");
-               ortho.setZNear(cam->clipsta, false, "znear");
-               COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name);
-               addCamera(ccam);
-               break;
-       }}
 }
index 4e84eba..c47798e 100644 (file)
@@ -134,7 +134,7 @@ char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int
        int layer_index = CustomData_get_layer_index(data, type);
        if (layer_index < 0) return NULL;
 
-       return data->layers[layer_index+n].name;
+       return data->layers[layer_index + n].name;
 }
 
 char *bc_CustomData_get_active_layer_name(const CustomData *data, int type)
@@ -146,7 +146,8 @@ char *bc_CustomData_get_active_layer_name(const CustomData *data, int type)
        return data->layers[layer_index].name;
 }
 
-DocumentExporter::DocumentExporter(const ExportSettings *export_settings) : export_settings(export_settings) {}
+DocumentExporter::DocumentExporter(const ExportSettings *export_settings) : export_settings(export_settings) {
+}
 
 // TODO: it would be better to instantiate animations rather than create a new one per object
 // COLLADA allows this through multiple <channel>s in <animation>.
@@ -160,7 +161,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
        clear_global_id_map();
        
        COLLADABU::NativeString native_filename =
-               COLLADABU::NativeString(std::string(this->export_settings->filepath));
+           COLLADABU::NativeString(std::string(this->export_settings->filepath));
        COLLADASW::StreamWriter sw(native_filename);
 
        // open <collada>
@@ -221,9 +222,9 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
        }
        char version_buf[128];
 #ifdef WITH_BUILDINFO
-       sprintf(version_buf, "Blender %d.%02d.%d r%s", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION, build_rev);
+       sprintf(version_buf, "Blender %d.%02d.%d r%s", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION, build_rev);
 #else
-       sprintf(version_buf, "Blender %d.%02d.%d", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
+       sprintf(version_buf, "Blender %d.%02d.%d", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION);
 #endif
        asset.getContributor().mAuthoringTool = version_buf;
        asset.add();
@@ -276,7 +277,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
        // <scene>
        std::string scene_name(translate_id(id_name(sce)));
        COLLADASW::Scene scene(&sw, COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING,
-                                                                                          scene_name));
+                                                  scene_name));
        scene.add();
        
        // close <Collada>
@@ -284,14 +285,13 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
 
 }
 
-void DocumentExporter::exportScenes(const charfilename)
+void DocumentExporter::exportScenes(const char *filename)
 {
 }
 
 /*
-
-NOTES:
-
-* AnimationExporter::sample_animation enables all curves on armature, this is undesirable for a user
-
+ * NOTES:
+ *
+ * AnimationExporter::sample_animation enables all curves on armature, this is undesirable for a user
+ *
  */
index fa85e75..6c9d277 100644 (file)
@@ -88,8 +88,8 @@ extern "C" {
 
 
 /*
-  COLLADA Importer limitations:
-  - no multiple scene import, all objects are added to active scene
+   COLLADA Importer limitations:
+   - no multiple scene import, all objects are added to active scene
  */
 
 // #define COLLADA_DEBUG
@@ -103,13 +103,14 @@ DocumentImporter::DocumentImporter(bContext *C, const char *filename) :
        armature_importer(&unit_converter, &mesh_importer, &anim_importer, CTX_data_scene(C)),
        mesh_importer(&unit_converter, &armature_importer, CTX_data_scene(C)),
        anim_importer(&unit_converter, &armature_importer, CTX_data_scene(C))
-{}
+{
+}
 
 DocumentImporter::~DocumentImporter()
 {
        TagsMap::iterator etit;
        etit = uid_tags_map.begin();
-       while (etit!=uid_tags_map.end()) {
+       while (etit != uid_tags_map.end()) {
                delete etit->second;
                etit++;
        }
@@ -171,11 +172,11 @@ void DocumentImporter::start()
 
 void DocumentImporter::finish()
 {
-       if (mImportStage!=General)
+       if (mImportStage != General)
                return;
                
        /** TODO Break up and put into 2-pass parsing of DAE */
-       std::vector<const COLLADAFW::VisualScene*>::iterator it;
+       std::vector<const COLLADAFW::VisualScene *>::iterator it;
        for (it = vscenes.begin(); it != vscenes.end(); it++) {
                PointerRNA sceneptr, unit_settings;
                PropertyRNA *system, *scale;
@@ -214,7 +215,7 @@ void DocumentImporter::finish()
        armature_importer.fix_animation();
 #endif
 
-       for (std::vector<const COLLADAFW::VisualScene*>::iterator it = vscenes.begin(); it != vscenes.end(); it++) {
+       for (std::vector<const COLLADAFW::VisualScene *>::iterator it = vscenes.begin(); it != vscenes.end(); it++) {
                const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes();
 
                for (unsigned int i = 0; i < roots.getCount(); i++)
@@ -226,7 +227,7 @@ void DocumentImporter::finish()
 
                fprintf(stderr, "got %d library nodes to free\n", (int)libnode_ob.size());
                // free all library_nodes
-               std::vector<Object*>::iterator it;
+               std::vector<Object *>::iterator it;
                for (it = libnode_ob.begin(); it != libnode_ob.end(); it++) {
                        Object *ob = *it;
 
@@ -234,8 +235,8 @@ void DocumentImporter::finish()
                        if (base) {
                                BLI_remlink(&sce->base, base);
                                BKE_libblock_free_us(&G.main->object, base->object);
-                               if (sce->basact==base)
-                                       sce->basact= NULL;
+                               if (sce->basact == base)
+                                       sce->basact = NULL;
                                MEM_freeN(base);
                        }
                }
@@ -265,18 +266,20 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW
                        root_map[node->getUniqueId()] = root_map[par->getUniqueId()];
        }
 
-       /*COLLADAFW::Transformation::TransformationType types[] = {
+#if 0
+       COLLADAFW::Transformation::TransformationType types[] = {
                COLLADAFW::Transformation::ROTATE,
                COLLADAFW::Transformation::SCALE,
                COLLADAFW::Transformation::TRANSLATE,
                COLLADAFW::Transformation::MATRIX
        };
 
-       Object *ob;*/
+       Object *ob;
+#endif
        unsigned int i;
 
        //for (i = 0; i < 4; i++)
-               //ob = 
+       //    ob =
        anim_importer.translate_Animations(node, root_map, object_map, FW_object_map);
 
        COLLADAFW::NodePointerArray &children = node->getChildNodes();
@@ -286,8 +289,8 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW
 }
 
 /** When this method is called, the writer must write the global document asset.
      \return The writer should return true, if writing succeeded, false otherwise.*/
-bool DocumentImporter::writeGlobalAsset ( const COLLADAFW::FileInfo* asset ) 
* \return The writer should return true, if writing succeeded, false otherwise.*/
+bool DocumentImporter::writeGlobalAsset(const COLLADAFW::FileInfo *asset)
 {
        unit_converter.read_asset(asset);
 
@@ -295,13 +298,13 @@ bool DocumentImporter::writeGlobalAsset ( const COLLADAFW::FileInfo* asset )
 }
 
 /** When this method is called, the writer must write the scene.
      \return The writer should return true, if writing succeeded, false otherwise.*/
-bool DocumentImporter::writeScene ( const COLLADAFW::Scene* scene ) 
* \return The writer should return true, if writing succeeded, false otherwise.*/
+bool DocumentImporter::writeScene(const COLLADAFW::Scene *scene)
 {
        // XXX could store the scene id, but do nothing for now
        return true;
 }
-ObjectDocumentImporter::create_camera_object(COLLADAFW::InstanceCamera *camera, Scene *sce)
+Object *DocumentImporter::create_camera_object(COLLADAFW::InstanceCamera *camera, Scene *sce)
 {
        const COLLADAFW::UniqueId& cam_uid = camera->getInstanciatedObjectId();
        if (uid_camera_map.find(cam_uid) == uid_camera_map.end()) {     
@@ -311,7 +314,7 @@ Object* DocumentImporter::create_camera_object(COLLADAFW::InstanceCamera *camera
 
        Object *ob = bc_add_object(sce, OB_CAMERA, NULL);
        Camera *cam = uid_camera_map[cam_uid];
-       Camera *old_cam = (Camera*)ob->data;
+       Camera *old_cam = (Camera *)ob->data;
        ob->data = cam;
        old_cam->id.us--;
        if (old_cam->id.us == 0)
@@ -319,7 +322,7 @@ Object* DocumentImporter::create_camera_object(COLLADAFW::InstanceCamera *camera
        return ob;
 }
 
-ObjectDocumentImporter::create_lamp_object(COLLADAFW::InstanceLight *lamp, Scene *sce)
+Object *DocumentImporter::create_lamp_object(COLLADAFW::InstanceLight *lamp, Scene *sce)
 {
        const COLLADAFW::UniqueId& lamp_uid = lamp->getInstanciatedObjectId();
        if (uid_lamp_map.find(lamp_uid) == uid_lamp_map.end()) {        
@@ -329,7 +332,7 @@ Object* DocumentImporter::create_lamp_object(COLLADAFW::InstanceLight *lamp, Sce
 
        Object *ob = bc_add_object(sce, OB_LAMP, NULL);
        Lamp *la = uid_lamp_map[lamp_uid];
-       Lamp *old_lamp = (Lamp*)ob->data;
+       Lamp *old_lamp = (Lamp *)ob->data;
        ob->data = la;
        old_lamp->id.us--;
        if (old_lamp->id.us == 0)
@@ -337,12 +340,12 @@ Object* DocumentImporter::create_lamp_object(COLLADAFW::InstanceLight *lamp, Sce
        return ob;
 }
 
-ObjectDocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Node *source_node, COLLADAFW::Node *instance_node, Scene *sce, bool is_library_node)
+Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Node *source_node, COLLADAFW::Node *instance_node, Scene *sce, bool is_library_node)
 {
        fprintf(stderr, "create <instance_node> under node id=%s from node id=%s\n", instance_node ? instance_node->getOriginalId().c_str() : NULL, source_node ? source_node->getOriginalId().c_str() : NULL);
 
        Object *obn = BKE_object_copy(source_ob);
-       obn->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
+       obn->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
        BKE_scene_base_add(sce, obn);
 
        if (instance_node) {
@@ -399,21 +402,21 @@ Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
        return obn;
 }
 
-void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *parent_node, Scene *sce, Object *par, bool is_library_node)
+void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent_node, Scene *sce, Object *par, bool is_library_node)
 {
        Object *ob = NULL;
        bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
        bool read_transform = true;
 
-       std::vector<Object*> * objects_done = new std::vector<Object *>();
+       std::vector<Object *> *objects_done = new std::vector<Object *>();
 
        if (is_joint) {
-               if ( par ) {
-               Object * empty = par;
-               par = bc_add_object(sce, OB_ARMATURE, NULL);
-               bc_set_parent(par, empty->parent, mContext);
-               //remove empty : todo
-               object_map.insert(std::make_pair<COLLADAFW::UniqueId, Object *>(parent_node->getUniqueId(), par));
+               if (par) {
+                       Object *empty = par;
+                       par = bc_add_object(sce, OB_ARMATURE, NULL);
+                       bc_set_parent(par, empty->parent, mContext);
+                       //remove empty : todo
+                       object_map.insert(std::make_pair<COLLADAFW::UniqueId, Object *>(parent_node->getUniqueId(), par));
                }
                armature_importer.add_joint(node, parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT, par, sce);
        }
@@ -434,7 +437,7 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
                // <instance_geometry>
                while (geom_done < geom.getCount()) {
                        ob = mesh_importer.create_mesh_object(node, geom[geom_done], false, uid_material_map,
-                                                                                                 material_texture_mapping_map);
+                                                             material_texture_mapping_map);
                        objects_done->push_back(ob);
                        ++geom_done;
                }
@@ -449,7 +452,7 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
                        ++lamp_done;
                }
                while (controller_done < controller.getCount()) {
-                       COLLADAFW::InstanceGeometry *geom = (COLLADAFW::InstanceGeometry*)controller[controller_done];
+                       COLLADAFW::InstanceGeometry *geom = (COLLADAFW::InstanceGeometry *)controller[controller_done];
                        ob = mesh_importer.create_mesh_object(node, geom, true, uid_material_map, material_texture_mapping_map);
                        objects_done->push_back(ob);
                        ++controller_done;
@@ -487,7 +490,7 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
                for (std::vector<Object *>::iterator it = objects_done->begin(); it != objects_done->end(); ++it) {
                        ob = *it;
                        std::string nodename = node->getName().size() ? node->getName() : node->getOriginalId();
-                       rename_id(&ob->id, (char*)nodename.c_str());
+                       rename_id(&ob->id, (char *)nodename.c_str());
                        object_map.insert(std::make_pair<COLLADAFW::UniqueId, Object *>(node->getUniqueId(), ob));
                        node_map[node->getUniqueId()] = node;
 
@@ -498,10 +501,10 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
        }
 
        for (std::vector<Object *>::iterator it = objects_done->begin(); it != objects_done->end(); ++it) {
-               ob =*it;
+               ob = *it;
 
                if (read_transform)
-                       anim_importer.read_node_transform(node, ob); // overwrites location set earlier
+                       anim_importer.read_node_transform(node, ob);  // overwrites location set earlier
 
                if (!is_joint) {
                        // if par was given make this object child of the previous
@@ -517,10 +520,10 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
 }
 
 /** When this method is called, the writer must write the entire visual scene.
      \return The writer should return true, if writing succeeded, false otherwise.*/
-bool DocumentImporter::writeVisualScene ( const COLLADAFW::VisualScene* visualScene ) 
* \return The writer should return true, if writing succeeded, false otherwise.*/
+bool DocumentImporter::writeVisualScene(const COLLADAFW::VisualScene *visualScene)
 {
-       if (mImportStage!=General)
+       if (mImportStage != General)
                return true;
                
        // this method called on post process after writeGeometry, writeMaterial, etc.
@@ -539,11 +542,11 @@ bool DocumentImporter::writeVisualScene ( const COLLADAFW::VisualScene* visualSc
 }
 
 /** When this method is called, the writer must handle all nodes contained in the 
-       library nodes.
-       \return The writer should return true, if writing succeeded, false otherwise.*/
-bool DocumentImporter::writeLibraryNodes ( const COLLADAFW::LibraryNodes* libraryNodes ) 
+* library nodes.
+* \return The writer should return true, if writing succeeded, false otherwise.*/
+bool DocumentImporter::writeLibraryNodes(const COLLADAFW::LibraryNodes *libraryNodes)
 {
-       if (mImportStage!=General)
+       if (mImportStage != General)
                return true;
                
        Scene *sce = CTX_data_scene(mContext);
@@ -558,24 +561,24 @@ bool DocumentImporter::writeLibraryNodes ( const COLLADAFW::LibraryNodes* librar
 }
 
 /** When this method is called, the writer must write the geometry.
      \return The writer should return true, if writing succeeded, false otherwise.*/
-bool DocumentImporter::writeGeometry ( const COLLADAFW::Geometry* geom ) 
* \return The writer should return true, if writing succeeded, false otherwise.*/
+bool DocumentImporter::writeGeometry(const COLLADAFW::Geometry *geom)
 {
-       if (mImportStage!=General)
+       if (mImportStage != General)
                return true;
                
        return mesh_importer.write_geometry(geom);
 }
 
 /** When this method is called, the writer must write the material.
      \return The writer should return true, if writing succeeded, false otherwise.*/
-bool DocumentImporter::writeMaterial( const COLLADAFW::Material* cmat ) 
* \return The writer should return true, if writing succeeded, false otherwise.*/
+bool DocumentImporter::writeMaterial(const COLLADAFW::Material *cmat)
 {
-       if (mImportStage!=General)
+       if (mImportStage != General)
                return true;
                
        const std::string& str_mat_id = cmat->getName().size() ? cmat->getName() : cmat->getOriginalId();
-       Material *ma = BKE_material_add((char*)str_mat_id.c_str());
+       Material *ma = BKE_material_add((char *)str_mat_id.c_str());
        
        this->uid_effect_map[cmat->getInstantiatedEffect()] = ma;
        this->uid_material_map[cmat->getUniqueId()] = ma;
@@ -584,8 +587,8 @@ bool DocumentImporter::writeMaterial( const COLLADAFW::Material* cmat )
 }
 
 // create mtex, create texture, set texture image
-MTexDocumentImporter::create_texture(COLLADAFW::EffectCommon *ef, COLLADAFW::Texture &ctex, Material *ma,
-                                        int i, TexIndexTextureArrayMap &texindex_texarray_map)
+MTex *DocumentImporter::create_texture(COLLADAFW::EffectCommon *ef, COLLADAFW::Texture &ctex, Material *ma,
+                                       int i, TexIndexTextureArrayMap &texindex_texarray_map)
 {
        COLLADAFW::SamplerPointerArray& samp_array = ef->getSamplerPointerArray();
        COLLADAFW::Sampler *sampler = samp_array[ctex.getSamplerId()];
@@ -735,32 +738,34 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
                        mtex->tex->imaflag |= TEX_USEALPHA;
                        i++;
                        ma->spectra = ma->alpha = 0;
-                       ma->mode |= MA_ZTRANSP|MA_TRANSP;
+                       ma->mode |= MA_ZTRANSP | MA_TRANSP;
                }
        }
        // TRANSPARENT
        // color
-//     if (ef->getOpacity().isColor()) {
-//                     // XXX don't know what to do here
-//             }
-//             // texture
-//             else if (ef->getOpacity().isTexture()) {
-//                     ctex = ef->getOpacity().getTexture();
-//                     if (mtex != NULL) mtex->mapto &= MAP_ALPHA;
-//                     else {
-//                             mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map);
-//                             if (mtex != NULL) mtex->mapto = MAP_ALPHA;
-//                     }
-//             }
+#if 0
+       if (ef->getOpacity().isColor()) {
+               // XXX don't know what to do here
+       }
+       // texture
+       else if (ef->getOpacity().isTexture()) {
+               ctex = ef->getOpacity().getTexture();
+               if (mtex != NULL) mtex->mapto &= MAP_ALPHA;
+               else {
+                       mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map);
+                       if (mtex != NULL) mtex->mapto = MAP_ALPHA;
+               }
+       }
+#endif
        material_texture_mapping_map[ma] = texindex_texarray_map;
 }
 
 /** When this method is called, the writer must write the effect.
      \return The writer should return true, if writing succeeded, false otherwise.*/
* \return The writer should return true, if writing succeeded, false otherwise.*/
 
-bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect ) 
+bool DocumentImporter::writeEffect(const COLLADAFW::Effect *effect)
 {
-       if (mImportStage!=General)
+       if (mImportStage != General)
                return true;
        
        const COLLADAFW::UniqueId& uid = effect->getUniqueId();
@@ -771,9 +776,9 @@ bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect )
        }
        
        Material *ma = uid_effect_map[uid];
-       std::map<COLLADAFW::UniqueId, Material*>::iterator  iter;
-       for (iter = uid_material_map.begin(); iter != uid_material_map.end() ; iter++ ) {
-               if ( iter->second == ma ) {
+       std::map<COLLADAFW::UniqueId, Material *>::iterator iter;
+       for (iter = uid_material_map.begin(); iter != uid_material_map.end(); iter++) {
+               if (iter->second == ma) {
                        this->FW_object_map[iter->first] = effect;
                        break;
                }
@@ -794,10 +799,10 @@ bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect )
 
 
 /** When this method is called, the writer must write the camera.
      \return The writer should return true, if writing succeeded, false otherwise.*/
-bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) 
* \return The writer should return true, if writing succeeded, false otherwise.*/
+bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera)
 {
-       if (mImportStage!=General)
+       if (mImportStage != General)
                return true;
                
        Camera *cam = NULL;
@@ -805,8 +810,8 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
        
        cam_id = camera->getOriginalId();
        cam_name = camera->getName();
-       if (cam_name.size()) cam = (Camera *)BKE_camera_add((char*)cam_name.c_str());
-       else cam = (Camera *)BKE_camera_add((char*)cam_id.c_str());
+       if (cam_name.size()) cam = (Camera *)BKE_camera_add((char *)cam_name.c_str());
+       else cam = (Camera *)BKE_camera_add((char *)cam_id.c_str());
        
        if (!cam) {
                fprintf(stderr, "Cannot create camera.\n");
@@ -817,17 +822,17 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
        
        COLLADAFW::Camera::CameraType type = camera->getCameraType();
        switch (type) {
-       case COLLADAFW::Camera::ORTHOGRAPHIC:
+               case COLLADAFW::Camera::ORTHOGRAPHIC:
                {
                        cam->type = CAM_ORTHO;
                }
                break;
-       case COLLADAFW::Camera::PERSPECTIVE:
+               case COLLADAFW::Camera::PERSPECTIVE:
                {
                        cam->type = CAM_PERSP;
                }
                break;
-       case COLLADAFW::Camera::UNDEFINED_CAMERATYPE:
+               case COLLADAFW::Camera::UNDEFINED_CAMERATYPE:
                {
                        fprintf(stderr, "Current camera type is not supported.\n");
                        cam->type = CAM_PERSP;
@@ -836,35 +841,35 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
        }
        
        switch (camera->getDescriptionType()) {
-       case COLLADAFW::Camera::ASPECTRATIO_AND_Y:
+               case COLLADAFW::Camera::ASPECTRATIO_AND_Y:
                {
                        switch (cam->type) {
                                case CAM_ORTHO:
-                                       {
-                                               double ymag = camera->getYMag().getValue();
-                                               double aspect = camera->getAspectRatio().getValue();
-                                               double xmag = aspect*ymag;
-                                               cam->ortho_scale = (float)xmag;
-                                       }
-                                       break;
+                               {
+                                       double ymag = camera->getYMag().getValue();
+                                       double aspect = camera->getAspectRatio().getValue();
+                                       double xmag = aspect * ymag;
+                                       cam->ortho_scale = (float)xmag;
+                               }
+                               break;
                                case CAM_PERSP:
                                default:
-                                       {
-                                               double yfov = camera->getYFov().getValue();
-                                               double aspect = camera->getAspectRatio().getValue();
-                                               double xfov = aspect*yfov;
-                                               // xfov is in degrees, cam->lens is in millimiters
-                                               cam->lens = fov_to_focallength(DEG2RADF(xfov), cam->sensor_x);
-                                       }
-                                       break;
+                               {
+                                       double yfov = camera->getYFov().getValue();
+                                       double aspect = camera->getAspectRatio().getValue();
+                                       double xfov = aspect * yfov;
+                                       // xfov is in degrees, cam->lens is in millimiters
+                                       cam->lens = fov_to_focallength(DEG2RADF(xfov), cam->sensor_x);
+                               }
+                               break;
                        }
                }
                break;
-       /* XXX correct way to do following four is probably to get also render
-          size and determine proper settings from that somehow */
-       case COLLADAFW::Camera::ASPECTRATIO_AND_X:
-       case COLLADAFW::Camera::SINGLE_X:
-       case COLLADAFW::Camera::X_AND_Y:
+               /* XXX correct way to do following four is probably to get also render
+                  size and determine proper settings from that somehow */
+               case COLLADAFW::Camera::ASPECTRATIO_AND_X:
+               case COLLADAFW::Camera::SINGLE_X:
+               case COLLADAFW::Camera::X_AND_Y:
                {
                        switch (cam->type) {
                                case CAM_ORTHO:
@@ -872,16 +877,16 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
                                        break;
                                case CAM_PERSP:
                                default:
-                                       {
-                                               double x = camera->getXFov().getValue();
-                                               // x is in degrees, cam->lens is in millimiters
-                                               cam->lens = fov_to_focallength(DEG2RADF(x), cam->sensor_x);
-                                       }
-                                       break;
+                               {
+                                       double x = camera->getXFov().getValue();
+                                       // x is in degrees, cam->lens is in millimiters
+                                       cam->lens = fov_to_focallength(DEG2RADF(x), cam->sensor_x);
+                               }
+                               break;
                        }
                }
                break;
-       case COLLADAFW::Camera::SINGLE_Y:
+               case COLLADAFW::Camera::SINGLE_Y:
                {
                        switch (cam->type) {
                                case CAM_ORTHO:
@@ -889,18 +894,18 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
                                        break;
                                case CAM_PERSP:
                                default:
-                                       {
+                               {
                                        double yfov = camera->getYFov().getValue();
                                        // yfov is in degrees, cam->lens is in millimiters
                                        cam->lens = fov_to_focallength(DEG2RADF(yfov), cam->sensor_x);
-                                       }
-                                       break;
+                               }
+                               break;
                        }
                }
                break;
-       case COLLADAFW::Camera::UNDEFINED:
-               // read nothing, use blender defaults.
-               break;
+               case COLLADAFW::Camera::UNDEFINED:
+                       // read nothing, use blender defaults.
+                       break;
        }
        
        this->uid_camera_map[camera->getUniqueId()] = cam;
@@ -910,15 +915,15 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
 }
 
 /** When this method is called, the writer must write the image.
      \return The writer should return true, if writing succeeded, false otherwise.*/
-bool DocumentImporter::writeImage( const COLLADAFW::Image* image ) 
* \return The writer should return true, if writing succeeded, false otherwise.*/
+bool DocumentImporter::writeImage(const COLLADAFW::Image *image)
 {
-       if (mImportStage!=General)
+       if (mImportStage != General)
                return true;
                
        // XXX maybe it is necessary to check if the path is absolute or relative
        const std::string& filepath = image->getImageURI().toNativePath();
-       const char *filename = (const char*)mFilename.c_str();
+       const char *filename = (const char *)mFilename.c_str();
        char dir[FILE_MAX];
        char full_path[FILE_MAX];
        
@@ -935,10 +940,10 @@ bool DocumentImporter::writeImage( const COLLADAFW::Image* image )
 }
 
 /** When this method is called, the writer must write the light.
      \return The writer should return true, if writing succeeded, false otherwise.*/
-bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) 
* \return The writer should return true, if writing succeeded, false otherwise.*/
+bool DocumentImporter::writeLight(const COLLADAFW::Light *light)
 {
-       if (mImportStage!=General)
+       if (mImportStage != General)
                return true;
 
        Lamp *lamp = NULL;
@@ -952,8 +957,8 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
 
        la_id = light->getOriginalId();
        la_name = light->getName();
-       if (la_name.size()) lamp = (Lamp*)BKE_lamp_add((char*)la_name.c_str());
-       else lamp = (Lamp*)BKE_lamp_add((char*)la_id.c_str());
+       if (la_name.size()) lamp = (Lamp *)BKE_lamp_add((char *)la_name.c_str());
+       else lamp = (Lamp *)BKE_lamp_add((char *)la_id.c_str());
 
        if (!lamp) {
                fprintf(stderr, "Cannot create lamp.\n");
@@ -1036,12 +1041,12 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
 
                if (IS_EQ(linatt, 0.0f) && quadatt > 0.0f) {
                        att2 = quadatt;
-                       d = sqrt(1.0f/quadatt);
+                       d = sqrt(1.0f / quadatt);
                }
                // linear light
                else if (IS_EQ(quadatt, 0.0f) && linatt > 0.0f) {
                        att1 = linatt;
-                       d = (1.0f/linatt);
+                       d = (1.0f / linatt);
                }
                else if (IS_EQ(constatt, 1.0f)) {
                        att1 = 1.0f;
@@ -1051,7 +1056,7 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
                        att1 = 1.0f;
                }
                
-               d *= ( 1.0f / unit_converter.getLinearMeter());
+               d *= (1.0f / unit_converter.getLinearMeter());
 
                lamp->energy = e;
                lamp->dist = d;
@@ -1059,47 +1064,47 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
                COLLADAFW::Light::LightType type = light->getLightType();
                switch (type) {
                        case COLLADAFW::Light::AMBIENT_LIGHT:
-                               {
-                                       lamp->type = LA_HEMI;
-                               }
-                               break;
+                       {
+                               lamp->type = LA_HEMI;
+                       }
+                       break;
                        case COLLADAFW::Light::SPOT_LIGHT:
-                               {
-                                       lamp->type = LA_SPOT;
-                                       lamp->att1 = att1;
-                                       lamp->att2 = att2;
-                                       if (IS_EQ(att1, 0.0f) && att2 > 0)
-                                               lamp->falloff_type = LA_FALLOFF_INVSQUARE;
-                                       if (IS_EQ(att2, 0.0f) && att1 > 0)
-                                               lamp->falloff_type = LA_FALLOFF_INVLINEAR;
-                                       lamp->spotsize = light->getFallOffAngle().getValue();
-                                       lamp->spotblend = light->getFallOffExponent().getValue();
-                               }
-                               break;
+                       {
+                               lamp->type = LA_SPOT;
+                               lamp->att1 = att1;
+                               lamp->att2 = att2;
+                               if (IS_EQ(att1, 0.0f) && att2 > 0)
+                                       lamp->falloff_type = LA_FALLOFF_INVSQUARE;
+                               if (IS_EQ(att2, 0.0f) && att1 > 0)
+                                       lamp->falloff_type = LA_FALLOFF_INVLINEAR;
+                               lamp->spotsize = light->getFallOffAngle().getValue();
+                               lamp->spotblend = light->getFallOffExponent().getValue();
+                       }
+                       break;
                        case COLLADAFW::Light::DIRECTIONAL_LIGHT:
-                               {
-                                       /* our sun is very strong, so pick a smaller energy level */
-                                       lamp->type = LA_SUN;
-                                       lamp->mode |= LA_NO_SPEC;
-                               }
-                               break;
+                       {
+                               /* our sun is very strong, so pick a smaller energy level */
+                               lamp->type = LA_SUN;
+                               lamp->mode |= LA_NO_SPEC;
+                       }
+                       break;
                        case COLLADAFW::Light::POINT_LIGHT:
-                               {
-                                       lamp->type = LA_LOCAL;
-                                       lamp->att1 = att1;
-                                       lamp->att2 = att2;
-                                       if (IS_EQ(att1, 0.0f) && att2 > 0)
-                                               lamp->falloff_type = LA_FALLOFF_INVSQUARE;
-                                       if (IS_EQ(att2, 0.0f) && att1 > 0)
-                                               lamp->falloff_type = LA_FALLOFF_INVLINEAR;
-                               }
-                               break;
+                       {
+                               lamp->type = LA_LOCAL;
+                               lamp->att1 = att1;
+                               lamp->att2 = att2;
+                               if (IS_EQ(att1, 0.0f) && att2 > 0)
+                                       lamp->falloff_type = LA_FALLOFF_INVSQUARE;
+                               if (IS_EQ(att2, 0.0f) && att1 > 0)
+                                       lamp->falloff_type = LA_FALLOFF_INVLINEAR;
+                       }
+                       break;
                        case COLLADAFW::Light::UNDEFINED:
-                               {
-                                       fprintf(stderr, "Current lamp type is not supported.\n");
-                                       lamp->type = LA_LOCAL;
-                               }
-                               break;
+                       {
+                               fprintf(stderr, "Current lamp type is not supported.\n");
+                               lamp->type = LA_LOCAL;
+                       }
+                       break;
                }
        }
 
@@ -1109,9 +1114,9 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
 }
 
 // this function is called only for animations that pass COLLADAFW::validate
-bool DocumentImporter::writeAnimation( const COLLADAFW::Animation* anim ) 
+bool DocumentImporter::writeAnimation(const COLLADAFW::Animation *anim)
 {
-       if (mImportStage!=General)
+       if (mImportStage != General)
                return true;
                
        // return true;
@@ -1119,9 +1124,9 @@ bool DocumentImporter::writeAnimation( const COLLADAFW::Animation* anim )
 }
 
 // called on post-process stage after writeVisualScenes
-bool DocumentImporter::writeAnimationList( const COLLADAFW::AnimationList* animationList ) 
+bool DocumentImporter::writeAnimationList(const COLLADAFW::AnimationList *animationList)
 {
-       if (mImportStage!=General)
+       if (mImportStage != General)
                return true;
                
        // return true;
@@ -1129,40 +1134,40 @@ bool DocumentImporter::writeAnimationList( const COLLADAFW::AnimationList* anima
 }
 
 /** When this method is called, the writer must write the skin controller data.
      \return The writer should return true, if writing succeeded, false otherwise.*/
-bool DocumentImporter::writeSkinControllerData( const COLLADAFW::SkinControllerData* skin ) 
* \return The writer should return true, if writing succeeded, false otherwise.*/
+bool DocumentImporter::writeSkinControllerData(const COLLADAFW::SkinControllerData *skin)
 {
        return armature_importer.write_skin_controller_data(skin);
 }
 
 // this is called on postprocess, before writeVisualScenes
-bool DocumentImporter::writeController( const COLLADAFW::Controller* controller ) 
+bool DocumentImporter::writeController(const COLLADAFW::Controller *controller)
 {
-       if (mImportStage!=General)
+       if (mImportStage != General)
                return true;
                
        return armature_importer.write_controller(controller);
 }
 
-bool DocumentImporter::writeFormulas( const COLLADAFW::Formulas* formulas )
+bool DocumentImporter::writeFormulas(const COLLADAFW::Formulas *formulas)
 {
        return true;
 }
 
-bool DocumentImporter::writeKinematicsScene( const COLLADAFW::KinematicsScene* kinematicsScene )
+bool DocumentImporter::writeKinematicsScene(const COLLADAFW::KinematicsScene *kinematicsScene)
 {
        return true;
 }
 
-ExtraTagsDocumentImporter::getExtraTags(const COLLADAFW::UniqueId &uid)
+ExtraTags *DocumentImporter::getExtraTags(const COLLADAFW::UniqueId &uid)
 {
-       if (uid_tags_map.find(uid.toAscii())==uid_tags_map.end()) {
+       if (uid_tags_map.find(uid.toAscii()) == uid_tags_map.end()) {
                return NULL;
        }
        return uid_tags_map[uid.toAscii()];
 }
 
-bool DocumentImporter::addExtraTags( const COLLADAFW::UniqueId &uid, ExtraTags *extra_tags)
+bool DocumentImporter::addExtraTags(const COLLADAFW::UniqueId &uid, ExtraTags *extra_tags)
 {
        uid_tags_map[uid.toAscii()] = extra_tags;
        return true;
index 644c350..3ed6896 100644 (file)
@@ -46,7 +46,7 @@
 // OB_MESH is assumed
 static std::string getActiveUVLayerName(Object *ob)
 {
-       Mesh *me = (Mesh*)ob->data;
+       Mesh *me = (Mesh *)ob->data;
 
        int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
        if (num_layers)
@@ -55,24 +55,25 @@ static std::string getActiveUVLayerName(Object *ob)
        return "";
 }
 
-EffectsExporter::EffectsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryEffects(sw), export_settings(export_settings) {}
+EffectsExporter::EffectsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryEffects(sw), export_settings(export_settings) {
+}
 
 bool EffectsExporter::hasEffects(Scene *sce)
 {
        Base *base = (Base *)sce->base.first;
        
        while (base) {
-               Object *ob= base->object;
+               Object *ob = base->object;
                int a;
                for (a = 0; a < ob->totcol; a++) {
-                       Material *ma = give_current_material(ob, a+1);
+                       Material *ma = give_current_material(ob, a + 1);
 
                        // no material, but check all of the slots
                        if (!ma) continue;
 
                        return true;
                }
-               base= base->next;
+               base = base->next;
        }
        return false;
 }
@@ -97,7 +98,7 @@ void EffectsExporter::writeBlinn(COLLADASW::EffectProfile &ep, Material *ma)
        ep.setShininess(ma->har, false, "shininess");
        // specular
        cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f);
-       ep.setSpecular(cot, false, "specular" );
+       ep.setSpecular(cot, false, "specular");
 }
 
 void EffectsExporter::writeLambert(COLLADASW::EffectProfile &ep, Material *ma)
@@ -111,10 +112,10 @@ void EffectsExporter::writePhong(COLLADASW::EffectProfile &ep, Material *ma)
        COLLADASW::ColorOrTexture cot;
        ep.setShaderType(COLLADASW::EffectProfile::PHONG);
        // shininess
-       ep.setShininess(ma->har, false, "shininess" );
+       ep.setShininess(ma->har, false, "shininess");
        // specular
        cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f);
-       ep.setSpecular(cot, false, "specular" );
+       ep.setSpecular(cot, false, "specular");
 }
 
 void EffectsExporter::operator()(Material *ma, Object *ob)
@@ -129,7 +130,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
        ep.setProfileType(COLLADASW::EffectProfile::COMMON);
        ep.openProfile();
        // set shader type - one of three blinn, phong or lambert
-       if (ma->spec>0.0f) {
+       if (ma->spec > 0.0f) {
                if (ma->spec_shader == MA_SPEC_BLINN) {
                        writeBlinn(ep, ma);
                }
@@ -144,8 +145,8 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
                        writeLambert(ep, ma);
                }
                else {
-               // \todo figure out handling of all spec+diff shader combos blender has, for now write phong
-               writePhong(ep, ma);
+                       // \todo figure out handling of all spec+diff shader combos blender has, for now write phong
+                       writePhong(ep, ma);
                }
        }
        
@@ -168,7 +169,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
        }
 
        // emission
-       cot=getcol(ma->emit, ma->emit, ma->emit, 1.0f);
+       cot = getcol(ma->emit, ma->emit, ma->emit, 1.0f);
        ep.setEmission(cot, false, "emission");
 
        // diffuse multiplied by diffuse intensity
@@ -178,7 +179,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
        // ambient
        /* ma->ambX is calculated only on render, so lets do it here manually and not rely on ma->ambX. */
        if (this->scene->world)
-               cot = getcol(this->scene->world->ambr*ma->amb, this->scene->world->ambg*ma->amb, this->scene->world->ambb*ma->amb, 1.0f);
+               cot = getcol(this->scene->world->ambr * ma->amb, this->scene->world->ambg * ma->amb, this->scene->world->ambb * ma->amb, 1.0f);
        else
                cot = getcol(ma->amb, ma->amb, ma->amb, 1.0f);
 
@@ -191,9 +192,9 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
                ep.setReflectivity(ma->ray_mirror);
        }
        // else {
-       //      cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f);
-       //      ep.setReflective(cot);
-       //      ep.setReflectivity(ma->spec);
+       //  cot = getcol(ma->specr, ma->specg, ma->specb, 1.0f);
+       //  ep.setReflective(cot);
+       //  ep.setReflectivity(ma->spec);
        // }
 
        // specular
@@ -229,7 +230,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
                if (im_samp_map.find(key) == im_samp_map.end()) {
                        // //<newparam> <surface> <init_from>
                        // COLLADASW::Surface surface(COLLADASW::Surface::SURFACE_TYPE_2D,
-                       //                                                 key + COLLADASW::Surface::SURFACE_SID_SUFFIX);
+                       //                         key + COLLADASW::Surface::SURFACE_SID_SUFFIX);
                        // COLLADASW::SurfaceInitOption sio(COLLADASW::SurfaceInitOption::INIT_FROM);
                        // sio.setImageReference(key);
                        // surface.setInitOption(sio);
@@ -239,8 +240,8 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
                        
                        //<newparam> <sampler> <source>
                        COLLADASW::Sampler sampler(COLLADASW::Sampler::SAMPLER_TYPE_2D,
-                                                                          key + COLLADASW::Sampler::SAMPLER_SID_SUFFIX,
-                                                                          key + COLLADASW::Sampler::SURFACE_SID_SUFFIX);
+                                                  key + COLLADASW::Sampler::SAMPLER_SID_SUFFIX,
+                                                  key + COLLADASW::Sampler::SURFACE_SID_SUFFIX);
                        sampler.setImageId(key);
                        // copy values to arrays since they will live longer
                        samplers[a] = sampler;
@@ -273,7 +274,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
                std::string key(id_name(ima));
                key = translate_id(key);
                int i = im_samp_map[key];
-               COLLADASW::Sampler *sampler = (COLLADASW::Sampler*)samp_surf[i][0];
+               COLLADASW::Sampler *sampler = (COLLADASW::Sampler *)samp_surf[i][0];
                //COLLADASW::Surface *surface = (COLLADASW::Surface*)samp_surf[i][1];
 
                std::string uvname = strlen(t->uvname) ? t->uvname : active_uv;
@@ -320,7 +321,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
        ep.addProfileElements();
        bool twoSided = false;
        if (ob->type == OB_MESH && ob->data) {
-               Mesh *me = (Mesh*)ob->data;
+               Mesh *me = (Mesh *)ob->data;
                if (me->flag & ME_TWOSIDED)
                        twoSided = true;
        }
@@ -335,9 +336,9 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
 }
 
 COLLADASW::ColorOrTexture EffectsExporter::createTexture(Image *ima,
-                                                                               std::string& uv_layer_name,
-                                                                               COLLADASW::Sampler *sampler
-                                                                               /*COLLADASW::Surface *surface*/)
+                                                         std::string& uv_layer_name,
+                                                         COLLADASW::Sampler *sampler
+                                                         /*COLLADASW::Surface *surface*/)
 {
        
        COLLADASW::Texture texture(translate_id(id_name(ima)));
index 530158e..7ac138a 100644 (file)
@@ -45,36 +45,36 @@ ErrorHandler::~ErrorHandler()
 }
 
 //--------------------------------------------------------------------
-bool ErrorHandler::handleError( const COLLADASaxFWL::IError* error )
+bool ErrorHandler::handleError(const COLLADASaxFWL::IError *error)
 {
        mError = true;
        
-       if ( error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXPARSER ) {
-               COLLADASaxFWL::SaxParserError* saxParserError = (COLLADASaxFWL::SaxParserError*) error;
+       if (error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXPARSER) {
+               COLLADASaxFWL::SaxParserError *saxParserError = (COLLADASaxFWL::SaxParserError *) error;
                const GeneratedSaxParser::ParserError& parserError = saxParserError->getError();
 
                // Workaround to avoid wrong error
-               if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_VALIDATION_MIN_OCCURS_UNMATCHED) {
-                       if ( strcmp(parserError.getElement(), "effect") == 0 ) {
+               if (parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_VALIDATION_MIN_OCCURS_UNMATCHED) {
+                       if (strcmp(parserError.getElement(), "effect") == 0) {
                                mError = false;
                        }
                }
-               if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_VALIDATION_SEQUENCE_PREVIOUS_SIBLING_NOT_PRESENT) {
-                       if ( !((strcmp(parserError.getElement(), "extra") == 0) &&
-                              (strcmp(parserError.getAdditionalText().c_str(), "sibling: fx_profile_abstract") == 0)))
+               if (parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_VALIDATION_SEQUENCE_PREVIOUS_SIBLING_NOT_PRESENT) {
+                       if (!((strcmp(parserError.getElement(), "extra") == 0) &&
+                             (strcmp(parserError.getAdditionalText().c_str(), "sibling: fx_profile_abstract") == 0)))
                        {
                                mError = false;
                        }
                }
 
-               if ( parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_COULD_NOT_OPEN_FILE) {
+               if (parserError.getErrorType() == GeneratedSaxParser::ParserError::ERROR_COULD_NOT_OPEN_FILE) {
                        std::cout << "Couldn't open file" << std::endl;
                }
 
                std::cout << "Schema validation error: " << parserError.getErrorMessage() << std::endl;
        }
-       else if ( error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXFWL ) {
-               COLLADASaxFWL::SaxFWLError* saxFWLError = (COLLADASaxFWL::SaxFWLError*) error;
+       else if (error->getErrorClass() == COLLADASaxFWL::IError::ERROR_SAXFWL) {
+               COLLADASaxFWL::SaxFWLError *saxFWLError = (COLLADASaxFWL::SaxFWLError *) error;
                std::cout << "Sax FWL Error: " << saxFWLError->getErrorMessage() << std::endl;
        }
        else {
index 6606fe1..df49b4f 100644 (file)
@@ -35,9 +35,10 @@ ExtraHandler::ExtraHandler(DocumentImporter *dimp, AnimationImporter *aimp) : cu
        this->aimp = aimp;
 }
 
-ExtraHandler::~ExtraHandler() {}
+ExtraHandler::~ExtraHandler() {
+}
 
-bool ExtraHandler::elementBegin( const char* elementName, const char** attributes)
+bool ExtraHandler::elementBegin(const char *elementName, const char **attributes)
 {
        // \todo attribute handling for profile tags
        currentElement = std::string(elementName);
@@ -45,37 +46,38 @@ bool ExtraHandler::elementBegin( const char* elementName, const char** attribute
        return true;
 }
 
-bool ExtraHandler::elementEnd(const char* elementName )
+bool ExtraHandler::elementEnd(const char *elementName)
 {
        return true;
 }
 
-bool ExtraHandler::textData(const chartext, size_t textLength)
+bool ExtraHandler::textData(const char *text, size_t textLength)
 {
        char buf[1024];
        
        if (currentElement.length() == 0 || currentExtraTags == 0) return false;
        
-       BLI_snprintf(buf, textLength+1, "%s", text);
+       BLI_snprintf(buf, textLength + 1, "%s", text);
        currentExtraTags->addTag(currentElement, std::string(buf));
        return true;
 }
 
-bool ExtraHandler::parseElement ( 
-       const char* profileName, 
-       const unsigned long& elementHash, 
-       const COLLADAFW::UniqueId& uniqueId ) {
-               if (BLI_strcaseeq(profileName, "blender")) {
-                       //printf("In parseElement for supported profile %s for id %s\n", profileName, uniqueId.toAscii().c_str());
-                       currentUid = uniqueId;
-                       ExtraTags *et = dimp->getExtraTags(uniqueId);
-                       if (!et) {
-                               et = new ExtraTags(std::string(profileName));
-                               dimp->addExtraTags(uniqueId, et);
-                       }
-                       currentExtraTags = et;
-                       return true;
+bool ExtraHandler::parseElement(
+        const char *profileName,
+        const unsigned long& elementHash,
+        const COLLADAFW::UniqueId& uniqueId)
+{
+       if (BLI_strcaseeq(profileName, "blender")) {
+               //printf("In parseElement for supported profile %s for id %s\n", profileName, uniqueId.toAscii().c_str());
+               currentUid = uniqueId;
+               ExtraTags *et = dimp->getExtraTags(uniqueId);
+               if (!et) {
+                       et = new ExtraTags(std::string(profileName));
+                       dimp->addExtraTags(uniqueId, et);
                }
-               //printf("In parseElement for unsupported profile %s for id %s\n", profileName, uniqueId.toAscii().c_str());
-               return false;
+               currentExtraTags = et;
+               return true;
+       }
+       //printf("In parseElement for unsupported profile %s for id %s\n", profileName, uniqueId.toAscii().c_str());
+       return false;
 }
index c5a1268..6af6143 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "ExtraTags.h"
 
-ExtraTags::ExtraTags( std::string profile)
+ExtraTags::ExtraTags(std::string profile)
 {
        this->profile = profile;
        this->tags = std::map<std::string, std::string>();
@@ -42,19 +42,19 @@ ExtraTags::~ExtraTags()
 {
 }
 
-bool ExtraTags::isProfile( std::string profile)
+bool ExtraTags::isProfile(std::string profile)
 {
        return this->profile == profile;
 }
 
-bool ExtraTags::addTag( std::string tag,  std::string data)
+bool ExtraTags::addTag(std::string tag,  std::string data)
 {
        tags[tag] = data;
        
        return true;
 }
 
-int ExtraTags::asInt( std::string tag, bool *ok)
+int ExtraTags::asInt(std::string tag, bool *ok)
 {
        if (tags.find(tag) == tags.end()) {
                *ok = false;
@@ -64,7 +64,7 @@ int ExtraTags::asInt( std::string tag, bool *ok)
        return atoi(tags[tag].c_str());
 }
 
-float ExtraTags::asFloat( std::string tag, bool *ok)
+float ExtraTags::asFloat(std::string tag, bool *ok)
 {
        if (tags.find(tag) == tags.end()) {
                *ok = false;
@@ -74,7 +74,7 @@ float ExtraTags::asFloat( std::string tag, bool *ok)
        return (float)atof(tags[tag].c_str());
 }
 
-std::string ExtraTags::asString( std::string tag, bool *ok)
+std::string ExtraTags::asString(std::string tag, bool *ok)
 {
        if (tags.find(tag) == tags.end()) {
                *ok = false;
index bc06de4..94b977c 100644 (file)
@@ -38,7 +38,7 @@
 #include "DNA_meshdata_types.h"
 
 extern "C" {
-    #include "BKE_DerivedMesh.h"
+       #include "BKE_DerivedMesh.h"
        #include "BKE_main.h"
        #include "BKE_global.h"
        #include "BKE_library.h"
@@ -52,7 +52,8 @@ extern "C" {
 #include "collada_utils.h"
 
 // TODO: optimize UV sets by making indexed list with duplicates removed
-GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryGeometries(sw), export_settings(export_settings) {}
+GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryGeometries(sw), export_settings(export_settings) {
+}
 
 
 void GeometryExporter::exportGeom(Scene *sce)
@@ -76,11 +77,11 @@ void GeometryExporter::operator()(Object *ob)
 
        bool use_instantiation = this->export_settings->use_object_instantiation;
        Mesh *me;
-       if ( this->export_settings->apply_modifiers ) {
+       if (this->export_settings->apply_modifiers) {
                me = bc_to_mesh_apply_modifiers(mScene, ob);
        } 
        else {
-               me = (Mesh*)ob->data;
+               me = (Mesh *)ob->data;
        }
        BKE_mesh_tessface_ensure(me);
 
@@ -90,8 +91,10 @@ void GeometryExporter::operator()(Object *ob)
 
        // Skip if linked geometry was already exported from another reference
        if (use_instantiation && 
-               exportedGeometry.find(geom_id) != exportedGeometry.end())
+           exportedGeometry.find(geom_id) != exportedGeometry.end())
+       {
                return;
+       }
 
        std::string geom_name = (use_instantiation) ? id_name(ob->data) : id_name(ob);
 
@@ -132,7 +135,7 @@ void GeometryExporter::operator()(Object *ob)
 
        // XXX slow             
        if (ob->totcol) {
-               for (int a = 0; a < ob->totcol; a++)    {
+               for (int a = 0; a < ob->totcol; a++)    {
                        createPolylist(a, has_uvs, has_color, ob, me, geom_id, norind);
                }
        }
@@ -161,9 +164,9 @@ void GeometryExporter::operator()(Object *ob)
 
 
 void GeometryExporter::createLooseEdgeList(Object *ob,
-                                            Mesh   *me,
-                                            std::string& geom_id,
-                                            std::vector<Face>& norind)
+                                           Mesh   *me,
+                                           std::string& geom_id,
+                                           std::vector<Face>& norind)
 {
 
        MEdge *medges = me->medge;
@@ -204,8 +207,8 @@ void GeometryExporter::createLooseEdgeList(Object *ob,
 
                for (index = 0; index < edges_in_linelist; index++) 
                {
-                       lines.appendValues(edge_list[2*index+1]);
-                       lines.appendValues(edge_list[2*index]);
+                       lines.appendValues(edge_list[2 * index + 1]);
+                       lines.appendValues(edge_list[2 * index]);
                }
                lines.finish();
        }
@@ -214,12 +217,12 @@ void GeometryExporter::createLooseEdgeList(Object *ob,
 
 // powerful because it handles both cases when there is material and when there's not
 void GeometryExporter::createPolylist(short material_index,
-                                       bool has_uvs,
-                                       bool has_color,
-                                       Object *ob,
-                                       Mesh *me,
-                                       std::string& geom_id,
-                                       std::vector<Face>& norind)
+                                      bool has_uvs,
+                                      bool has_color,
+                                      Object *ob,
+                                      Mesh *me,
+                                      std::string& geom_id,
+                                      std::vector<Face>& norind)
 {
        MFace *mfaces = me->mface;
        int totfaces = me->totface;
@@ -280,10 +283,10 @@ void GeometryExporter::createPolylist(short material_index,
        for (i = 0; i < num_layers; i++) {
                // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i);
                COLLADASW::Input input3(COLLADASW::InputSemantic::TEXCOORD,
-                                                               makeUrl(makeTexcoordSourceId(geom_id, i)),
-                                                               2, // offset always 2, this is only until we have optimized UV sets
-                                                               i  // set number equals UV map index
-                                                               );
+                                       makeUrl(makeTexcoordSourceId(geom_id, i)),
+                                       2, // offset always 2, this is only until we have optimized UV sets
+                                       i  // set number equals UV map index
+                                       );
                til.push_back(input3);
        }
 
@@ -342,7 +345,7 @@ void GeometryExporter::createVertsSource(std::string geom_id, Mesh *me)
        COLLADASW::FloatSourceF source(mSW);
        source.setId(getIdBySemantics(geom_id, COLLADASW::InputSemantic::POSITION));
        source.setArrayId(getIdBySemantics(geom_id, COLLADASW::InputSemantic::POSITION) +
-                                         ARRAY_ID_SUFFIX);
+                         ARRAY_ID_SUFFIX);
        source.setAccessorCount(totverts);
        source.setAccessorStride(3);
        COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
@@ -350,7 +353,7 @@ void GeometryExporter::createVertsSource(std::string geom_id, Mesh *me)
        param.push_back("Y");
        param.push_back("Z");
        /*main function, it creates <source id = "">, <float_array id = ""
-         count = ""> */
+          count = ""> */
        source.prepareToAppendValues();
        //appends data to <float_array>
        int i = 0;
@@ -388,7 +391,7 @@ void GeometryExporter::createVertexColorSource(std::string geom_id, Mesh *me)
 
        int index = CustomData_get_active_layer_index(&me->fdata, CD_MCOL);
 
-       MCol *mcol = (MCol*)me->fdata.layers[index].data;
+       MCol *mcol = (MCol *)me->fdata.layers[index].data;
        MCol *c = mcol;
 
        for (i = 0, f = me->mface; i < me->totface; i++, c += 4, f++)
@@ -422,10 +425,10 @@ void GeometryExporter::createTexcoordsSource(std::string geom_id, Mesh *me)
        for (i = 0; i < totfaces; i++) {
                MFace *f = &mfaces[i];
                if (f->v4 == 0) {
-                       totuv+=3;
+                       totuv += 3;
                }
                else {
-                       totuv+=4;
+                       totuv += 4;
                }
        }
 
@@ -434,7 +437,7 @@ void GeometryExporter::createTexcoordsSource(std::string geom_id, Mesh *me)
        // write <source> for each layer
        // each <source> will get id like meshName + "map-channel-1"
        for (int a = 0; a < num_layers; a++) {
-               MTFace *tface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, a);
+               MTFace *tface = (MTFace *)CustomData_get_layer_n(&me->fdata, CD_MTFACE, a);
                // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, a);
                
                COLLADASW::FloatSourceF source(mSW);
@@ -455,7 +458,7 @@ void GeometryExporter::createTexcoordsSource(std::string geom_id, Mesh *me)
                        
                        for (int j = 0; j < (f->v4 == 0 ? 3 : 4); j++) {
                                source.appendValues(tface[i].uv[j][0],
-                                                                       tface[i].uv[j][1]);
+                                                   tface[i].uv[j][1]);
                        }
                }
                
@@ -475,7 +478,7 @@ void GeometryExporter::createNormalsSource(std::string geom_id, Mesh *me, std::v
        COLLADASW::FloatSourceF source(mSW);
        source.setId(getIdBySemantics(geom_id, COLLADASW::InputSemantic::NORMAL));
        source.setArrayId(getIdBySemantics(geom_id, COLLADASW::InputSemantic::NORMAL) +
-                                         ARRAY_ID_SUFFIX);
+                         ARRAY_ID_SUFFIX);
        source.setAccessorCount((unsigned long)nor.size());
        source.setAccessorStride(3);
        COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
@@ -563,8 +566,9 @@ COLLADASW::URI GeometryExporter::makeUrl(std::string id)
        return COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, id);
 }
 
-
-/* int GeometryExporter::getTriCount(MFace *faces, int totface) {
+#if 0
+int GeometryExporter::getTriCount(MFace *faces, int totface)
+{
        int i;
        int tris = 0;
        for (i = 0; i < totface; i++) {
@@ -576,4 +580,5 @@ COLLADASW::URI GeometryExporter::makeUrl(std::string id)
        }
 
        return tris;
-       }*/
+}
+#endif
index 1999c68..105b895 100644 (file)
 #include "BLI_string.h"
 
 ImagesExporter::ImagesExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryImages(sw), export_settings(export_settings)
-{}
+{
+}
 
+/* TODO - shouldn't this use the objects LinkNode's ? */
 bool ImagesExporter::hasImages(Scene *sce)
 {
        Base *base = (Base *)sce->base.first;
        
        while (base) {
-               Object *ob= base->object;
+               Object *ob = base->object;
                int a;
                for (a = 0; a < ob->totcol; a++) {
-                       Material *ma = give_current_material(ob, a+1);
+                       Material *ma = give_current_material(ob, a + 1);
 
                        // no material, but check all of the slots
                        if (!ma) continue;
@@ -63,7 +65,7 @@ bool ImagesExporter::hasImages(Scene *sce)
                        }
 
                }
-               base= base->next;
+               base = base->next;
        }
        return false;
 }
index f83289f..788bd2a 100644 (file)
@@ -43,8 +43,8 @@
 
 void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_material, Object *ob)
 {
-       for (int a = 0; a < ob->totcol; a++)    {
-               Material *ma = give_current_material(ob, a+1);
+       for (int a = 0; a < ob->totcol; a++) {
+               Material *ma = give_current_material(ob, a + 1);
                        
                COLLADASW::InstanceMaterialList& iml = bind_material.getInstanceMaterialList();
 
@@ -56,7 +56,7 @@ void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_materia
                        COLLADASW::InstanceMaterial im(ostr.str(), COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, matid));
                        
                        // create <bind_vertex_input> for each uv map
-                       Mesh *me = (Mesh*)ob->data;
+                       Mesh *me = (Mesh *)ob->data;
                        int totlayer = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
                        
                        for (int b = 0; b < totlayer; b++) {
index 4430661..af13d61 100644 (file)
@@ -39,7 +39,7 @@ template<class Functor>
 void forEachLampObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set)
 {
        LinkNode *node;
-       for (node=export_set; node; node = node->next) {
+       for (node = export_set; node; node = node->next) {
                Object *ob = (Object *)node->link;
 
                if (ob->type == OB_LAMP && ob->data) {
@@ -48,7 +48,8 @@ void forEachLampObjectInExportSet(Scene *sce, Functor &f, LinkNode *export_set)
        }
 }
 
-LightsExporter::LightsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings): COLLADASW::LibraryLights(sw), export_settings(export_settings) {}
+LightsExporter::LightsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryLights(sw), export_settings(export_settings) {
+}
 
 void LightsExporter::exportLights(Scene *sce)
 {
@@ -61,7 +62,7 @@ void LightsExporter::exportLights(Scene *sce)
 
 void LightsExporter::operator()(Object *ob)
 {
-       Lamp *la = (Lamp*)ob->data;
+       Lamp *la = (Lamp *)ob->data;
        std::string la_id(get_light_id(ob));
        std::string la_name(id_name(la));
        COLLADASW::Color col(la->r * la->energy, la->g * la->energy, la->b * la->energy);
@@ -71,7 +72,7 @@ void LightsExporter::operator()(Object *ob)
        
        constatt = 1.0f;
        
-       if (la->falloff_type==LA_FALLOFF_INVLINEAR) {
+       if (la->falloff_type == LA_FALLOFF_INVLINEAR) {
                linatt = 1.0f / d;
                quadatt = 0.0f;
        }
index ec075e7..106861c 100644 (file)
@@ -31,7 +31,8 @@
 #include "COLLADABUUtils.h"
 #include "collada_internal.h"
 
-MaterialsExporter::MaterialsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings): COLLADASW::LibraryMaterials(sw), export_settings(export_settings) {}
+MaterialsExporter::MaterialsExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryMaterials(sw), export_settings(export_settings) {
+}
 
 void MaterialsExporter::exportMaterials(Scene *sce)
 {
@@ -45,23 +46,23 @@ void MaterialsExporter::exportMaterials(Scene *sce)
        }
 }
 
-
+/* TODO - shouldn't this use the scenes object LinkNode's ? */
 bool MaterialsExporter::hasMaterials(Scene *sce)
 {
        Base *base = (Base *)sce->base.first;
        
        while (base) {
-               Object *ob= base->object;
+               Object *ob = base->object;
                int a;
                for (a = 0; a < ob->totcol; a++) {
-                       Material *ma = give_current_material(ob, a+1);
+                       Material *ma = give_current_material(ob, a + 1);
 
                        // no material, but check all of the slots
                        if (!ma) continue;
 
                        return true;
                }
-               base= base->next;
+               base = base->next;
        }
        return false;
 }
index bcfec7a..59927e9 100644 (file)
@@ -72,24 +72,24 @@ static const char *bc_get_dae_name(T *node)
 static const char *bc_primTypeToStr(COLLADAFW::MeshPrimitive::PrimitiveType type)
 {
        switch (type) {
-       case COLLADAFW::MeshPrimitive::LINES:
-               return "LINES";
-       case COLLADAFW::MeshPrimitive::LINE_STRIPS:
-               return "LINESTRIPS";
-       case COLLADAFW::MeshPrimitive::POLYGONS:
-               return "POLYGONS";
-       case COLLADAFW::MeshPrimitive::POLYLIST:
-               return "POLYLIST";
-       case COLLADAFW::MeshPrimitive::TRIANGLES:
-               return "TRIANGLES";
-       case COLLADAFW::MeshPrimitive::TRIANGLE_FANS:
-               return "TRIANGLE_FANS";
-       case COLLADAFW::MeshPrimitive::TRIANGLE_STRIPS:
-               return "TRIANGLE_FANS";
-       case COLLADAFW::MeshPrimitive::POINTS:
-               return "POINTS";
-       case COLLADAFW::MeshPrimitive::UNDEFINED_PRIMITIVE_TYPE:
-               return "UNDEFINED_PRIMITIVE_TYPE";
+               case COLLADAFW::MeshPrimitive::LINES:
+                       return "LINES";
+               case COLLADAFW::MeshPrimitive::LINE_STRIPS:
+                       return "LINESTRIPS";
+               case COLLADAFW::MeshPrimitive::POLYGONS:
+                       return "POLYGONS";
+               case COLLADAFW::MeshPrimitive::POLYLIST:
+                       return "POLYLIST";
+               case COLLADAFW::MeshPrimitive::TRIANGLES:
+                       return "TRIANGLES";
+               case COLLADAFW::MeshPrimitive::TRIANGLE_FANS:
+                       return "TRIANGLE_FANS";
+               case COLLADAFW::MeshPrimitive::TRIANGLE_STRIPS:
+                       return "TRIANGLE_FANS";
+               case COLLADAFW::MeshPrimitive::POINTS:
+                       return "POINTS";
+               case COLLADAFW::MeshPrimitive::UNDEFINED_PRIMITIVE_TYPE:
+                       return "UNDEFINED_PRIMITIVE_TYPE";
        }
        return "UNKNOWN";
 }
@@ -97,43 +97,44 @@ static const char *bc_primTypeToStr(COLLADAFW::MeshPrimitive::PrimitiveType type
 static const char *bc_geomTypeToStr(COLLADAFW::Geometry::GeometryType type)
 {
        switch (type) {
-       case COLLADAFW::Geometry::GEO_TYPE_MESH:
-               return "MESH";
-       case COLLADAFW::Geometry::GEO_TYPE_SPLINE:
-               return "SPLINE";
-       case COLLADAFW::Geometry::GEO_TYPE_CONVEX_MESH:
-               return "CONVEX_MESH";
-       case COLLADAFW::Geometry::GEO_TYPE_UNKNOWN:
-       default:
-               return "UNKNOWN";
+               case COLLADAFW::Geometry::GEO_TYPE_MESH:
+                       return "MESH";
+               case COLLADAFW::Geometry::GEO_TYPE_SPLINE:
+                       return "SPLINE";
+               case COLLADAFW::Geometry::GEO_TYPE_CONVEX_MESH:
+                       return "CONVEX_MESH";
+               case COLLADAFW::Geometry::GEO_TYPE_UNKNOWN:
+               default:
+                       return "UNKNOWN";
        }
 }
 
 
 UVDataWrapper::UVDataWrapper(COLLADAFW::MeshVertexData& vdata) : mVData(&vdata)
-{}
+{
+}
 
 #ifdef COLLADA_DEBUG
 void WVDataWrapper::print()
 {
        fprintf(stderr, "UVs:\n");
        switch (mVData->getType()) {
-       case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
+               case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
                {
-                       COLLADAFW::ArrayPrimitiveType<float>values = mVData->getFloatValues();
+                       COLLADAFW::ArrayPrimitiveType<float> *values = mVData->getFloatValues();
                        if (values->getCount()) {
                                for (int i = 0; i < values->getCount(); i += 2) {
-                                       fprintf(stderr, "%.1f, %.1f\n", (*values)[i], (*values)[i+1]);
+                                       fprintf(stderr, "%.1f, %.1f\n", (*values)[i], (*values)[i + 1]);
                                }
                        }
                }
                break;
-       case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE:
+               case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE:
                {
-                       COLLADAFW::ArrayPrimitiveType<double>values = mVData->getDoubleValues();
+                       COLLADAFW::ArrayPrimitiveType<double> *values = mVData->getDoubleValues();
                        if (values->getCount()) {
                                for (int i = 0; i < values->getCount(); i += 2) {
-                                       fprintf(stderr, "%.1f, %.1f\n", (float)(*values)[i], (float)(*values)[i+1]);
+                                       fprintf(stderr, "%.1f, %.1f\n", (float)(*values)[i], (float)(*values)[i + 1]);
                                }
                        }
                }
@@ -146,30 +147,30 @@ void WVDataWrapper::print()
 void UVDataWrapper::getUV(int uv_index, float *uv)
 {
        int stride = mVData->getStride(0);
-       if (stride==0) stride = 2;
+       if (stride == 0) stride = 2;
 
        switch (mVData->getType()) {
-       case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
+               case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
                {
-                       COLLADAFW::ArrayPrimitiveType<float>values = mVData->getFloatValues();
+                       COLLADAFW::ArrayPrimitiveType<float> *values = mVData->getFloatValues();
                        if (values->empty()) return;
-                       uv[0] = (*values)[uv_index*stride];
-                       uv[1] = (*values)[uv_index*stride + 1];
+                       uv[0] = (*values)[uv_index * stride];
+                       uv[1] = (*values)[uv_index * stride + 1];
                        
                }
                break;
-       case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE:
+               case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE:
                {
-                       COLLADAFW::ArrayPrimitiveType<double>values = mVData->getDoubleValues();
+                       COLLADAFW::ArrayPrimitiveType<double> *values = mVData->getDoubleValues();
                        if (values->empty()) return;
-                       uv[0] = (float)(*values)[uv_index*stride];
-                       uv[1] = (float)(*values)[uv_index*stride + 1];
+                       uv[0] = (float)(*values)[uv_index * stride];
+                       uv[1] = (float)(*values)[uv_index * stride + 1];
                        
                }
                break;
-       case COLLADAFW::MeshVertexData::DATA_TYPE_UNKNOWN:
-       default:
-               fprintf(stderr, "MeshImporter.getUV(): unknown data type\n");
+               case COLLADAFW::MeshVertexData::DATA_TYPE_UNKNOWN:
+               default:
+                       fprintf(stderr, "MeshImporter.getUV(): unknown data type\n");
        }
 }
 
@@ -198,7 +199,7 @@ void MeshImporter::rotate_face_indices(MFace *mface)
 #endif
 
 void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
-                                COLLADAFW::IndexList& index_list, unsigned int *tris_indices)
+                               COLLADAFW::IndexList& index_list, unsigned int *tris_indices)
 {
        // per face vertex indices, this means for quad we have 4 indices, not 8
        COLLADAFW::UIntValuesArray& indices = index_list.getIndices();
@@ -209,7 +210,7 @@ void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
 }
 
 void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
-                               COLLADAFW::IndexList& index_list, int index, bool quad)
+                               COLLADAFW::IndexList& index_list, int index, bool quad)
 {
        // per face vertex indices, this means for quad we have 4 indices, not 8
        COLLADAFW::UIntValuesArray& indices = index_list.getIndices();
@@ -223,31 +224,31 @@ void MeshImporter::set_face_uv(MTFace *mtface, UVDataWrapper &uvs,
 #ifdef COLLADA_DEBUG
        if (quad) {
                fprintf(stderr, "face uv:\n"
-                               "((%d, %d, %d, %d))\n"
-                               "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n",
-
-                               indices[index + 0],
-                               indices[index + 1],
-                               indices[index + 2],
-                               indices[index + 3],
-
-                               mtface->uv[0][0], mtface->uv[0][1],
-                               mtface->uv[1][0], mtface->uv[1][1],
-                               mtface->uv[2][0], mtface->uv[2][1],
-                               mtface->uv[3][0], mtface->uv[3][1]);
+                       "((%d, %d, %d, %d))\n"
+                       "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n",
+
+                       indices[index + 0],
+                       indices[index + 1],
+                       indices[index + 2],
+                       indices[index + 3],
+
+                       mtface->uv[0][0], mtface->uv[0][1],
+                       mtface->uv[1][0], mtface->uv[1][1],
+                       mtface->uv[2][0], mtface->uv[2][1],
+                       mtface->uv[3][0], mtface->uv[3][1]);
        }
        else {
                fprintf(stderr, "face uv:\n"
-                               "((%d, %d, %d))\n"
-                               "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n",
+                       "((%d, %d, %d))\n"
+                       "((%.1f, %.1f), (%.1f, %.1f), (%.1f, %.1f))\n",
 
-                               indices[index + 0],
-                               indices[index + 1],
-                               indices[index + 2],
+                       indices[index + 0],
+                       indices[index + 1],
+                       indices[index + 2],
 
-                               mtface->uv[0][0], mtface->uv[0][1],
-                               mtface->uv[1][0], mtface->uv[1][1],
-                               mtface->uv[2][0], mtface->uv[2][1]);
+                       mtface->uv[0][0], mtface->uv[0][1],
+                       mtface->uv[1][0], mtface->uv[1][1],
+                       mtface->uv[2][0], mtface->uv[2][1]);
        }
 #endif
 }
@@ -263,7 +264,7 @@ void MeshImporter::print_index_list(COLLADAFW::IndexList& index_list)
 }
 #endif
 
-bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) // checks if mesh has supported primitive types: lines, polylist, triangles, triangle_fans
+bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh)  // checks if mesh has supported primitive types: lines, polylist, triangles, triangle_fans
 {
        COLLADAFW::MeshPrimitiveArray& prim_arr = mesh->getMeshPrimitives();
 
@@ -279,26 +280,26 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh)    // checks if mesh has sup
                // OpenCollada passes POLYGONS type for <polylist>
                if (type == COLLADAFW::MeshPrimitive::POLYLIST || type == COLLADAFW::MeshPrimitive::POLYGONS) {
 
-                       COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp;
+                       COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons *)mp;
                        COLLADAFW::Polygons::VertexCountArray& vca = mpvc->getGroupedVerticesVertexCountArray();
                        
                        for (unsigned int j = 0; j < vca.getCount(); j++) {
                                int count = vca[j];
                                if (count < 3) {
                                        fprintf(stderr, "Primitive %s in %s has at least one face with vertex count < 3\n",
-                                                       type_str, name);
+                                               type_str, name);
                                        return false;
                                }
                        }
                                
                }
 
-               else if ( type == COLLADAFW::MeshPrimitive::LINES )
+               else if (type == COLLADAFW::MeshPrimitive::LINES)
                {
                        // TODO: Add Checker for line syntax here
                }
 
-               else if (type != COLLADAFW::MeshPrimitive::TRIANGLES && type!= COLLADAFW::MeshPrimitive::TRIANGLE_FANS) {
+               else if (type != COLLADAFW::MeshPrimitive::TRIANGLES && type != COLLADAFW::MeshPrimitive::TRIANGLE_FANS) {
                        fprintf(stderr, "Primitive type %s is not supported.\n", type_str);
                        return false;
                }
@@ -317,10 +318,10 @@ void MeshImporter::read_vertices(COLLADAFW::Mesh *mesh, Mesh *me)
        // vertices
        COLLADAFW::MeshVertexData& pos = mesh->getPositions();
        int stride = pos.getStride(0);
-       if (stride==0) stride = 3;
+       if (stride == 0) stride = 3;
        
        me->totvert = mesh->getPositions().getFloatValues()->getCount() / stride;
-       me->mvert = (MVert*)CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, me->totvert);
+       me->mvert = (MVert *)CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, me->totvert);
 
        MVert *mvert;
        int i;
@@ -339,12 +340,12 @@ int MeshImporter::triangulate_poly(unsigned int *indices, int totvert, MVert *ve
        
        dispbase.first = dispbase.last = NULL;
        
-       dl = (DispList*)MEM_callocN(sizeof(DispList), "poly disp");
+       dl = (DispList *)MEM_callocN(sizeof(DispList), "poly disp");
        dl->nr = totvert;
        dl->type = DL_POLY;
        dl->parts = 1;
-       dl->verts = vert = (float*)MEM_callocN(totvert * 3 * sizeof(float), "poly verts");
-       dl->index = (int*)MEM_callocN(sizeof(int) * 3 * totvert, "dl index");
+       dl->verts = vert = (float *)MEM_callocN(totvert * 3 * sizeof(float), "poly verts");
+       dl->index = (int *)MEM_callocN(sizeof(int) * 3 * totvert, "dl index");
 
        BLI_addtail(&dispbase, dl);
        
@@ -356,14 +357,14 @@ int MeshImporter::triangulate_poly(unsigned int *indices, int totvert, MVert *ve
        BKE_displist_fill(&dispbase, &dispbase, 0);
 
        int tottri = 0;
-       dl= (DispList*)dispbase.first;
+       dl = (DispList *)dispbase.first;
 
        if (dl->type == DL_INDEX3) {
                tottri = dl->parts;
 
                int *index = dl->index;
-               for (i= 0; i < tottri; i++) {
-                       int t[3]= {*index, *(index + 1), *(index + 2)};
+               for (i = 0; i < tottri; i++) {
+                       int t[3] = {*index, *(index + 1), *(index + 2)};
 
                        std::sort(t, t + 3);
 
@@ -394,9 +395,9 @@ int MeshImporter::count_new_tris(COLLADAFW::Mesh *mesh, Mesh *me)
                unsigned int *indices = mp->getPositionIndices().getData();
                
                if (type == COLLADAFW::MeshPrimitive::POLYLIST ||
-                       type == COLLADAFW::MeshPrimitive::POLYGONS) {
-                       
-                       COLLADAFW::Polygons *mpvc =     (COLLADAFW::Polygons*)mp;
+                   type == COLLADAFW::MeshPrimitive::POLYGONS)
+               {
+                       COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons *)mp;
                        COLLADAFW::Polygons::VertexCountArray& vcounta = mpvc->getGroupedVerticesVertexCountArray();
                        
                        for (unsigned int j = 0; j < prim_totface; j++) {
@@ -433,8 +434,8 @@ bool MeshImporter::primitive_has_useable_normals(COLLADAFW::MeshPrimitive *mp) {
                        has_useable_normals = true;
                else {
                        fprintf(stderr,
-                               "Warning: Number of normals %d is different from the number of vertices %d, skipping normals\n",
-                               normals_count, index_count );   
+                               "Warning: Number of normals %d is different from the number of vertices %d, skipping normals\n",
+                               normals_count, index_count);
                }
        }
 
@@ -496,7 +497,7 @@ void MeshImporter::allocate_face_data(COLLADAFW::Mesh *mesh, Mesh *me, int new_t
        // allocate space for faces
        if (total_facecount > 0) {
                me->totface = total_facecount + new_tris;
-               me->mface   = (MFace*)CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, me->totface);
+               me->mface   = (MFace *)CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, me->totface);
        }
 }
 
@@ -566,7 +567,7 @@ void MeshImporter::mesh_add_edges(Mesh *mesh, int len)
 void MeshImporter::read_lines(COLLADAFW::Mesh *mesh, Mesh *me)
 {
        unsigned int loose_edge_count = get_loose_edge_count(mesh);
-       if(loose_edge_count > 0) {
+       if (loose_edge_count > 0) {
 
                unsigned int face_edge_count  = me->totedge;
                unsigned int total_edge_count = loose_edge_count + face_edge_count;
@@ -587,11 +588,11 @@ void MeshImporter::read_lines(COLLADAFW::Mesh *mesh, Mesh *me)
                                unsigned int *indices    = mp->getPositionIndices().getData();
                                
                                for (int i = 0; i < edge_count; i++, med++) {
-                                       med->bweight= 0;
-                                       med->crease = 0;
-                                       med->flag   = 0;
-                                       med->v1     = indices[ 2*i ];
-                                       med->v2     = indices[ 2*i + 1];
+                                       med->bweight = 0;
+                                       med->crease  = 0;
+                                       med->flag    = 0;
+                                       med->v1      = indices[2 * i];
+                                       med->v2      = indices[2 * i + 1];
                                }
                        }
                }
@@ -630,7 +631,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T
        }
 
        // activate the first uv map
-       if (totuvset) me->mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, 0);
+       if (totuvset) me->mtface = (MTFace *)CustomData_get_layer_n(&me->fdata, CD_MTFACE, 0);
 
        UVDataWrapper uvs(mesh->getUVCoords());
 
@@ -669,11 +670,11 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T
 
 #ifdef COLLADA_DEBUG
                /*
-               fprintf(stderr, "Primitive %d:\n", i);
-               for (unsigned int j = 0; j < totuvset; j++) {
-                       print_index_list(*index_list_array[j]);
-               }
-               */
+                  fprintf(stderr, "Primitive %d:\n", i);
+                  for (unsigned int j = 0; j < totuvset; j++) {
+                   print_index_list(*index_list_array[j]);
+                  }
+                */
 #endif
                
                if (type == COLLADAFW::MeshPrimitive::TRIANGLES) {
@@ -686,14 +687,14 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T
                                for (unsigned int k = 0; k < totuvset; k++) {
                                        if (!index_list_array.empty() && index_list_array[k]) {
                                                // get mtface by face index and uv set index
-                                               MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k);
+                                               MTFace *mtface = (MTFace *)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k);
                                                set_face_uv(&mtface[face_index], uvs, k, *index_list_array[k], index, false);
                                        }
                                }
 #else
                                for (unsigned int k = 0; k < index_list_array.getCount(); k++) {
                                        // get mtface by face index and uv set index
-                                       MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k);
+                                       MTFace *mtface = (MTFace *)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k);
                                        set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, false);
                                }
 #endif
@@ -725,24 +726,24 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T
 
                                for (unsigned int vertex_index = 0; vertex_index < vertex_count - 2; vertex_index++) {
                                        // For each triangle store indeces of its 3 vertices
-                                       unsigned int triangle_vertex_indices[3]={first_vertex, indices[1], indices[2]};
+                                       unsigned int triangle_vertex_indices[3] = {first_vertex, indices[1], indices[2]};
                                        set_face_indices(mface, triangle_vertex_indices, false);
                                        test_index_face(mface, &me->fdata, face_index, 3);
 
                                        if (mp_has_normals) {  // vertex normals, same inplementation as for the triangles
                                                // the same for vertces normals
-                                               unsigned int vertex_normal_indices[3]={first_normal, nind[1], nind[2]};
+                                               unsigned int vertex_normal_indices[3] = {first_normal, nind[1], nind[2]};
                                                if (!flat_face(vertex_normal_indices, nor, 3))
                                                        mface->flag |= ME_SMOOTH;
-                                                       nind++;
-                                               }
-
-                                               mface++;        // same inplementation as for the triangles
-                                               indices++;
-                                               face_index++;
-                                               prim.totface++;
+                                               nind++;
                                        }
                                
+                                       mface++;  // same inplementation as for the triangles
+                                       indices++;
+                                       face_index++;
+                                       prim.totface++;
+                               }
+
                                // Moving cursor  to the next triangle fan.
                                if (mp_has_normals)
                                        nind += 2;
@@ -751,7 +752,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T
                        }
                }
                else if (type == COLLADAFW::MeshPrimitive::POLYLIST || type == COLLADAFW::MeshPrimitive::POLYGONS) {
-                       COLLADAFW::Polygons *mpvc =     (COLLADAFW::Polygons*)mp;
+                       COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons *)mp;
                        COLLADAFW::Polygons::VertexCountArray& vcounta = mpvc->getGroupedVerticesVertexCountArray();
 
                        for (unsigned int j = 0; j < prim_totface; j++) {
@@ -769,14 +770,14 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T
                                        for (unsigned int k = 0; k < totuvset; k++) {
                                                if (!index_list_array.empty() && index_list_array[k]) {
                                                        // get mtface by face index and uv set index
-                                                       MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k);
+                                                       MTFace *mtface = (MTFace *)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k);
                                                        set_face_uv(&mtface[face_index], uvs, k, *index_list_array[k], index, mface->v4 != 0);
                                                }
                                        }
 #else
                                        for (unsigned int k = 0; k < index_list_array.getCount(); k++) {
                                                // get mtface by face index and uv set index
-                                               MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k);
+                                               MTFace *mtface = (MTFace *)CustomData_get_layer_n(&me->fdata, CD_MTFACE, k);
                                                set_face_uv(&mtface[face_index], uvs, *index_list_array[k], index, vcount == 4);
                                        }
 #endif
@@ -819,7 +820,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T
                                                for (unsigned int l = 0; l < totuvset; l++) {
                                                        if (!index_list_array.empty() && index_list_array[l]) {
                                                                // get mtface by face index and uv set index
-                                                               MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, l);
+                                                               MTFace *mtface = (MTFace *)CustomData_get_layer_n(&me->fdata, CD_MTFACE, l);
                                                                set_face_uv(&mtface[face_index], uvs, l, *index_list_array[l], uv_indices);
                                                        }
                                                }
@@ -828,7 +829,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T
                                                        int uvset_index = index_list_array[l]->getSetIndex();
 
                                                        // get mtface by face index and uv set index
-                                                       MTFace *mtface = (MTFace*)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index);
+                                                       MTFace *mtface = (MTFace *)CustomData_get_layer_n(&me->fdata, CD_MTFACE, uvset_index);
                                                        set_face_uv(&mtface[face_index], uvs, *index_list_array[l], uv_indices);
                                                }
 #endif
@@ -873,9 +874,9 @@ void MeshImporter::get_vector(float v[3], COLLADAFW::MeshVertexData& arr, int i,
        i *= stride;
        
        switch (arr.getType()) {
-       case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
+               case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
                {
-                       COLLADAFW::ArrayPrimitiveType<float>values = arr.getFloatValues();
+                       COLLADAFW::ArrayPrimitiveType<float> *values = arr.getFloatValues();
                        if (values->empty()) return;
 
                        v[0] = (*values)[i++];
@@ -884,9 +885,9 @@ void MeshImporter::get_vector(float v[3], COLLADAFW::MeshVertexData& arr, int i,
 
                }
                break;
-       case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE:
+               case COLLADAFW::MeshVertexData::DATA_TYPE_DOUBLE:
                {
-                       COLLADAFW::ArrayPrimitiveType<double>values = arr.getDoubleValues();
+                       COLLADAFW::ArrayPrimitiveType<double> *values = arr.getDoubleValues();
                        if (values->empty()) return;
 
                        v[0] = (float)(*values)[i++];
@@ -894,8 +895,8 @@ void MeshImporter::get_vector(float v[3], COLLADAFW::MeshVertexData& arr, int i,
                        v[2] = (float)(*values)[i];
                }
                break;
-       default:
-               break;
+               default:
+                       break;
        }
 }
 
@@ -921,12 +922,13 @@ bool MeshImporter::flat_face(unsigned int *nind, COLLADAFW::MeshVertexData& nor,
        return true;
 }
 
-MeshImporter::MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Scene *sce) : unitconverter(unitconv), scene(sce), armature_importer(arm) {}
+MeshImporter::MeshImporter(UnitConverter *unitconv, ArmatureImporter *arm, Scene *sce) : unitconverter(unitconv), scene(sce), armature_importer(arm) {
+}
 
 void MeshImporter::bmeshConversion()
 {
-       for (std::map<COLLADAFW::UniqueId, Mesh*>::iterator m = uid_mesh_map.begin();
-                       m != uid_mesh_map.end(); ++m)
+       for (std::map<COLLADAFW::UniqueId, Mesh *>::iterator m = uid_mesh_map.begin();
+            m != uid_mesh_map.end(); ++m)
        {
                if ((*m).second) {
                        Mesh *me = (*m).second;
@@ -947,21 +949,21 @@ Object *MeshImporter::get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid
 }
 
 MTex *MeshImporter::assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBinding &ctexture,
-                                                                Mesh *me, TexIndexTextureArrayMap& texindex_texarray_map,
-                                                                MTex *color_texture)
+                                               Mesh *me, TexIndexTextureArrayMap& texindex_texarray_map,
+                                               MTex *color_texture)
 {
        const COLLADAFW::TextureMapId texture_index = ctexture.getTextureMapId();
        size_t setindex = ctexture.getSetIndex();
        std::string uvname = ctexture.getSemantic();
        
-       if (setindex==-1) return NULL;
+       if (setindex == -1) return NULL;
        
        const CustomData *data = &me->fdata;
        int layer_index = CustomData_get_layer_index(data, CD_MTFACE);
 
        if (layer_index == -1) return NULL;
 
-       CustomDataLayer *cdl = &data->layers[layer_index+setindex];
+       CustomDataLayer *cdl = &data->layers[layer_index + setindex];
        
        /* set uvname to bind_vertex_input semantic */
        BLI_strncpy(cdl->name, uvname.c_str(), sizeof(cdl->name));
@@ -972,9 +974,9 @@ MTex *MeshImporter::assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBindi
                return color_texture;
        }
        
-       std::vector<MTex*> textures = texindex_texarray_map[texture_index];
+       std::vector<MTex *> textures = texindex_texarray_map[texture_index];
        
-       std::vector<MTex*>::iterator it;
+       std::vector<MTex *>::iterator it;
        
        for (it = textures.begin(); it != textures.end(); it++) {
                
@@ -989,12 +991,12 @@ MTex *MeshImporter::assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBindi
 }
 
 MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmaterial,
-                                                               std::map<COLLADAFW::UniqueId, Material*>& uid_material_map,
-                                                               Object *ob, const COLLADAFW::UniqueId *geom_uid, 
-                                                               MTex **color_texture, char *layername, MTFace *texture_face,
-                                                               std::map<Material*, TexIndexTextureArrayMap>& material_texture_mapping_map, short mat_index)
+                                              std::map<COLLADAFW::UniqueId, Material *>& uid_material_map,
+                                              Object *ob, const COLLADAFW::UniqueId *geom_uid,
+                                              MTex **color_texture, char *layername, MTFace *texture_face,
+                                              std::map<Material *, TexIndexTextureArrayMap>& material_texture_mapping_map, short mat_index)
 {
-       Mesh *me = (Mesh*)ob->data;
+       Mesh *me = (Mesh *)ob->data;
        const COLLADAFW::UniqueId& ma_uid = cmaterial.getReferencedMaterial();
        
        // do we know this material?
@@ -1008,9 +1010,9 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
        // again. Make sure we don't overwrite them on the next occurrences, so keep list of
        // what we already have handled.
        std::multimap<COLLADAFW::UniqueId, COLLADAFW::UniqueId>::iterator it;
-       it=materials_mapped_to_geom.find(*geom_uid);
-       while (it!=materials_mapped_to_geom.end()) {
-               if (it->second == ma_uid && it->first == *geom_uid) return NULL; // do nothing if already found
+       it = materials_mapped_to_geom.find(*geom_uid);
+       while (it != materials_mapped_to_geom.end()) {
+               if (it->second == ma_uid && it->first == *geom_uid) return NULL;  // do nothing if already found
                it++;
        }
        // first time we get geom_uid, ma_uid pair. Save for later check.
@@ -1020,22 +1022,22 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
        assign_material(ob, ma, ob->totcol + 1);
        
        COLLADAFW::TextureCoordinateBindingArray& tex_array = 
-               cmaterial.getTextureCoordinateBindingArray();
+           cmaterial.getTextureCoordinateBindingArray();
        TexIndexTextureArrayMap texindex_texarray_map = material_texture_mapping_map[ma];
        unsigned int i;
        // loop through <bind_vertex_inputs>
        for (i = 0; i < tex_array.getCount(); i++) {
                
                *color_texture = assign_textures_to_uvlayer(tex_array[i], me, texindex_texarray_map,
-                                                                                                       *color_texture);
+                                                           *color_texture);
        }
        
        // set texture face
        if (*color_texture &&
-               strlen((*color_texture)->uvname) &&
-               strcmp(layername, (*color_texture)->uvname) != 0) {
-               texture_face = (MTFace*)CustomData_get_layer_named(&me->fdata, CD_MTFACE,
-                                                                                                                  (*color_texture)->uvname);
+           strlen((*color_texture)->uvname) &&
+           strcmp(layername, (*color_texture)->uvname) != 0) {
+               texture_face = (MTFace *)CustomData_get_layer_named(&me->fdata, CD_MTFACE,
+                                                                   (*color_texture)->uvname);
                strcpy(layername, (*color_texture)->uvname);
        }
        
@@ -1057,7 +1059,7 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
                                mface->mat_nr = mat_index;
                                // bind texture images to faces
                                if (texture_face && (*color_texture)) {
-                                       texture_face->tpage = (Image*)(*color_texture)->tex->ima;
+                                       texture_face->tpage = (Image *)(*color_texture)->tex->ima;
                                        texture_face++;
                                }
                        }
@@ -1068,9 +1070,9 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
 }
 
 Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::InstanceGeometry *geom,
-                                                  bool isController,
-                                                  std::map<COLLADAFW::UniqueId, Material*>& uid_material_map,
-                                                  std::map<Material*, TexIndexTextureArrayMap>& material_texture_mapping_map)
+                                         bool isController,
+                                         std::map<COLLADAFW::UniqueId, Material *>& uid_material_map,
+                                         std::map<Material *, TexIndexTextureArrayMap>& material_texture_mapping_map)
 {
        const COLLADAFW::UniqueId *geom_uid = &geom->getInstanciatedObjectId();
        
@@ -1097,7 +1099,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
        
        // name Object
        const std::string& id = node->getName().size() ? node->getName() : node->getOriginalId();
-       const char *name = (id.length())? id.c_str(): NULL;
+       const char *name = (id.length()) ? id.c_str() : NULL;
        
        // add object
        Object *ob = bc_add_object(scene, OB_MESH, name);
@@ -1106,7 +1108,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
        uid_object_map[*geom_uid] = ob;
        
        // replace ob->data freeing the old one
-       Mesh *old_mesh = (Mesh*)ob->data;
+       Mesh *old_mesh = (Mesh *)ob->data;
 
        set_mesh(ob, uid_mesh_map[*geom_uid]);
        
@@ -1118,15 +1120,15 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
        MTex *color_texture = NULL;
        
        COLLADAFW::MaterialBindingArray& mat_array =
-               geom->getMaterialBindings();
+           geom->getMaterialBindings();
        
        // loop through geom's materials
-       for (unsigned int i = 0; i < mat_array.getCount(); i++) {
+       for (unsigned int i = 0; i < mat_array.getCount(); i++) {
                
                if (mat_array[i].getReferencedMaterial().isValid()) {
                        texture_face = assign_material_to_geom(mat_array[i], uid_material_map, ob, geom_uid,
-                                                                                                  &color_texture, layername, texture_face,
-                                                                                                  material_texture_mapping_map, i);
+                                                              &color_texture, layername, texture_face,
+                                                              material_texture_mapping_map, i);
                }
                else {
                        fprintf(stderr, "invalid referenced material for %s\n", mat_array[i].getName().c_str());
@@ -1137,7 +1139,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
 }
 
 // create a mesh storing a pointer in a map so it can be retrieved later by geometry UID
-bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom) 
+bool MeshImporter::write_geometry(const COLLADAFW::Geometry *geom)
 {
        // TODO: import also uvs, normals
        // XXX what to do with normal indices?
@@ -1150,7 +1152,7 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom)
                return true;
        }
        
-       COLLADAFW::Mesh *mesh = (COLLADAFW::Mesh*)geom;
+       COLLADAFW::Mesh *mesh = (COLLADAFW::Mesh *)geom;
        
        if (!is_nice_mesh(mesh)) {
                fprintf(stderr, "Ignoring mesh %s\n", bc_get_dae_name(mesh));
@@ -1158,7 +1160,7 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom)
        }
        
        const std::string& str_geom_id = mesh->getName().size() ? mesh->getName() : mesh->getOriginalId();
-       Mesh *me = BKE_mesh_add((char*)str_geom_id.c_str());
+       Mesh *me = BKE_mesh_add((char *)str_geom_id.c_str());
        me->id.us--; // is already 1 here, but will be set later in set_mesh
 
        // store the Mesh pointer to link it later with an Object
index 603a700..63bf949 100644 (file)
@@ -30,7 +30,8 @@
 
 SceneExporter::SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm, const ExportSettings *export_settings)
        : COLLADASW::LibraryVisualScenes(sw), arm_exporter(arm), export_settings(export_settings)
-{}
+{
+}
        
 void SceneExporter::exportScene(Scene *sce)
 {
@@ -48,14 +49,14 @@ void SceneExporter::exportHierarchy(Scene *sce)
        std::vector<Object *> base_objects;
 
        // Ensure all objects in the export_set are marked
-       for(node = this->export_settings->export_set; node; node = node->next) {
-               Object *ob = (Object*) node->link;
+       for (node = this->export_settings->export_set; node; node = node->next) {
+               Object *ob = (Object *) node->link;
                ob->id.flag |= LIB_DOIT;
        }
        
        // Now find all exportable base ojects (highest in export hierarchy)
-       for(node = this->export_settings->export_set; node; node = node->next) {
-               Object *ob = (Object*) node->link;
+       for (node = this->export_settings->export_set; node; node = node->next) {
+               Object *ob = (Object *) node->link;
                if (bc_is_base_node(this->export_settings->export_set, ob)) 
                {
                        switch (ob->type) {
@@ -71,7 +72,7 @@ void SceneExporter::exportHierarchy(Scene *sce)
        }
 
        // And now export the base objects:
-       for(int index=0; index < base_objects.size(); index++) {
+       for (int index = 0; index < base_objects.size(); index++) {
                Object *ob = base_objects[index];
                if (bc_is_marked(ob)) {
                        bc_remove_mark(ob);
@@ -84,7 +85,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
 {
        // Add associated armature first if available
        Object *ob_arm = bc_get_assigned_armature(ob);
-       if(ob_arm != NULL && bc_is_marked(ob_arm)) {
+       if (ob_arm != NULL && bc_is_marked(ob_arm)) {
                bc_remove_mark(ob_arm);
                writeNodes(ob_arm, sce);
        }
@@ -97,10 +98,10 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
        colladaNode.start();
 
        bool is_skinned_mesh = arm_exporter->is_skinned_mesh(ob);
-       std::list<Object*> child_objects;
+       std::list<Object *> child_objects;
 
        // list child objects
-       LinkNode *node = this->export_settings->export_set ;
+       LinkNode *node = this->export_settings->export_set;
        while (node) {
                // cob - child object
                Object *cob = (Object *)node->link;
@@ -132,7 +133,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
                if (this->export_settings->include_armatures && is_skinned_mesh) {
                        instance_controller_created = arm_exporter->add_instance_controller(ob);
                }
-               if (!instance_controller_created){
+               if (!instance_controller_created) {
                        COLLADASW::InstanceGeometry instGeom(mSW);
                        instGeom.setUrl(COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, get_geometry_id(ob, this->export_settings->use_object_instantiation)));
 
@@ -165,7 +166,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
                        GroupObject *go = NULL;
                        Group *gr = ob->dup_group;
                        /* printf("group detected '%s'\n", gr->id.name+2); */
-                       for (go = (GroupObject*)(gr->gobject.first); go; go=go->next) {
+                       for (go = (GroupObject *)(gr->gobject.first); go; go = go->next) {
                                printf("\t%s\n", go->ob->id.name);
                        }
                }
@@ -175,8 +176,8 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
                colladaNode.end();
        }
 
-       for (std::list<Object*>::iterator i= child_objects.begin(); i != child_objects.end(); ++i) {
-               if(bc_is_marked(*i)) {
+       for (std::list<Object *>::iterator i = child_objects.begin(); i != child_objects.end(); ++i) {
+               if (bc_is_marked(*i)) {
                        bc_remove_mark(*i);
                        writeNodes(*i, sce);
                }
index edc8981..0116f89 100644 (file)
@@ -57,14 +57,15 @@ static const char *bc_get_joint_name(T *node)
 // This is used to store data passed in write_controller_data.
 // Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members
 // so that arrays don't get freed until we free them explicitly.
-SkinInfo::SkinInfo() {}
+SkinInfo::SkinInfo() {
+}
 
 SkinInfo::SkinInfo(const SkinInfo& skin) : weights(skin.weights),
-                                                                joint_data(skin.joint_data),
-                                                                unit_converter(skin.unit_converter),
-                                                                ob_arm(skin.ob_arm),
-                                                                controller_uid(skin.controller_uid),
-                                                                parent(skin.parent)
+       joint_data(skin.joint_data),
+       unit_converter(skin.unit_converter),
+       ob_arm(skin.ob_arm),
+       controller_uid(skin.controller_uid),