diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-06-13 02:05:33 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-06-13 02:05:33 +0400 |
commit | 2e8a2f7668e5687a0a9a5087e76eeb739c818b2b (patch) | |
tree | 75aa5fe8746df4cd369afff88c4fd367cb78f72c /source/blender/collada/AnimationExporter.cpp | |
parent | 46c95d37c6fae2268a7f39f90ef46e9c3c696e3f (diff) |
style cleanup
Diffstat (limited to 'source/blender/collada/AnimationExporter.cpp')
-rw-r--r-- | source/blender/collada/AnimationExporter.cpp | 227 |
1 files changed, 114 insertions, 113 deletions
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index beb098ba0fc..cb675618ea5 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -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); - char* boneName = 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(""); } -char* AnimationExporter::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++) |