diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 11:52:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-24 11:52:14 +0400 |
commit | b8a71efeba70d6c3ebc579f5043daa4162da86e8 (patch) | |
tree | d2d89da2a59f8955583f4968a35e48c578fd4d4c /source/blender/collada | |
parent | 81d8f17843f92c6d6abbacb652ca22917910f4bc (diff) |
style cleanup: follow style guide for/with/if spacing
Diffstat (limited to 'source/blender/collada')
20 files changed, 126 insertions, 126 deletions
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index d6eb406ced7..5f8ceeeebb3 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -40,7 +40,7 @@ void forEachObjectInScene(Scene *sce, Functor &f) void AnimationExporter::exportAnimations(Scene *sce) { - if(hasAnimations(sce)) { + if (hasAnimations(sce)) { this->scene = sce; openLibrary(); @@ -59,7 +59,7 @@ void AnimationExporter::operator() (Object *ob) /* bool isMatAnim = false; */ /* UNUSED */ //Export transform animations - if(ob->adt && ob->adt->action) + if (ob->adt && ob->adt->action) { fcu = (FCurve*)ob->adt->action->curves.first; @@ -88,7 +88,7 @@ void AnimationExporter::operator() (Object *ob) } //Export Lamp parameter animations - if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action ) + 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) { @@ -102,7 +102,7 @@ void AnimationExporter::operator() (Object *ob) } //Export Camera parameter animations - if( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action ) + 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) { @@ -117,11 +117,11 @@ void AnimationExporter::operator() (Object *ob) } //Export Material parameter animations. - for(int a = 0; a < ob->totcol; a++) + for (int a = 0; a < ob->totcol; a++) { Material *ma = give_current_material(ob, a+1); if (!ma) continue; - if(ma->adt && ma->adt->action) + if (ma->adt && ma->adt->action) { /* isMatAnim = true; */ fcu = (FCurve*)ma->adt->action->curves.first; @@ -152,7 +152,7 @@ float * AnimationExporter::get_eul_source_for_quat(Object *ob ) { char * transformName = extract_transform_name( fcu->rna_path ); - if( !strcmp(transformName, "rotation_quaternion") ) { + 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]; } @@ -184,7 +184,7 @@ std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu ) 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); @@ -257,7 +257,7 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa std::string output_id; //quat rotations are skipped for now, because of complications with determining axis. - if(quatRotation) + if (quatRotation) { float * eul = get_eul_source_for_quat(ob); float * eul_axis = (float*)MEM_callocN(sizeof(float) * fcu->totvert, "quat output source values"); @@ -317,7 +317,7 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa 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); } @@ -348,7 +348,7 @@ 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 { @@ -374,11 +374,11 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B { std::string bone_name = getObjectBoneName(ob_arm,fcu); int val = BLI_strcasecmp((char*)bone_name.c_str(),bone->name); - if(val==0) break; + if (val==0) break; fcu = fcu->next; } - if(!(fcu)) return; + if (!(fcu)) return; bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); if (!pchan) return; @@ -779,7 +779,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob // SECOND_LIFE_COMPATIBILITY // AFAIK animation to second life is via BVH, but no // reason to not have the collada-animation be correct - if(export_settings->second_life) + if (export_settings->second_life) { float temp[4][4]; copy_m4_m4(temp, bone->arm_mat); @@ -788,7 +788,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob mult_m4_m4m4(mat, mat, temp); - if(bone->parent) + if (bone->parent) { copy_m4_m4(temp, bone->parent->arm_mat); temp[3][0] = temp[3][1] = temp[3][2] = 0.0f; @@ -1134,21 +1134,21 @@ bool AnimationExporter::hasAnimations(Scene *sce) FCurve *fcu = 0; //Check for object transform animations - if(ob->adt && ob->adt->action) + if (ob->adt && ob->adt->action) 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 ) + 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 ) + 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++) + for (int a = 0; a < ob->totcol; a++) { Material *ma = give_current_material(ob, a+1); if (!ma) continue; - if(ma->adt && ma->adt->action) + if (ma->adt && ma->adt->action) { fcu = (FCurve*)ma->adt->action->curves.first; } diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 097e9902de5..0e66a292e94 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -119,7 +119,7 @@ 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 || + if ( curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER || curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_STEP) { COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues(); @@ -132,7 +132,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) // outtangent bez.vec[2][0] = bc_get_float_value(outtan, (j * 2 * dim ) + (2 * i)) * fps; bez.vec[2][1] = bc_get_float_value(outtan, (j * 2 * dim )+ (2 * i) + 1); - if(curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER) + if (curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER) bez.ipo = BEZT_IPO_BEZ; else bez.ipo = BEZT_IPO_CONST; @@ -964,25 +964,25 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node , if (ef != NULL) { /* can be NULL [#28909] */ const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects(); COLLADAFW::EffectCommon *efc = commonEffects[0]; - if((animType->material & MATERIAL_SHININESS) != 0){ + 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" ); } - if((animType->material & MATERIAL_IOR) != 0){ + 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" ); } - if((animType->material & MATERIAL_SPEC_COLOR) != 0){ + 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" ); } - if((animType->material & MATERIAL_DIFF_COLOR) != 0){ + 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" ); @@ -1185,7 +1185,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD const COLLADAFW::Effect *ef = (COLLADAFW::Effect *) (FW_object_map[matuid]); if (ef != NULL) { /* can be NULL [#28909] */ const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects(); - if(!commonEffects.empty()) { + if (!commonEffects.empty()) { COLLADAFW::EffectCommon *efc = commonEffects[0]; types->material = setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS); types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR); diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index 47d41a9680f..743d3c2a158 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -193,7 +193,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce, while( i != child_objects.end() ) { - if((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name))) + if ((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name))) { float backup_parinv[4][4]; copy_m4_m4(backup_parinv, (*i)->parentinv); @@ -210,7 +210,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce, // TODO: when such objects are animated as // single matrix the tweak must be applied // to the result. - if(export_settings->second_life) + if (export_settings->second_life) { // tweak objects parentinverse to match compatibility float temp[4][4]; @@ -274,7 +274,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW: } // SECOND_LIFE_COMPATIBILITY - if(export_settings->second_life) + if (export_settings->second_life) { // Remove rotations vs armature from transform // parent_rest_rot * mat * irest_rot @@ -285,7 +285,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW: mult_m4_m4m4(mat, mat, temp); - if(bone->parent) + if (bone->parent) { copy_m4_m4(temp, bone->parent->arm_mat); temp[3][0] = temp[3][1] = temp[3][2] = 0.0f; @@ -370,18 +370,18 @@ void ArmatureExporter::export_controller(Object* ob, Object *ob_arm) for (j = 0; j < vert->totweight; j++) { int joint_index = joint_index_by_def_index[vert->dw[j].def_nr]; - if(joint_index != -1 && vert->dw[j].weight > 0.0f) + if (joint_index != -1 && vert->dw[j].weight > 0.0f) { jw[joint_index] += vert->dw[j].weight; sumw += vert->dw[j].weight; } } - if(sumw > 0.0f) + if (sumw > 0.0f) { float invsumw = 1.0f/sumw; vcounts.push_back(jw.size()); - for(std::map<int, float>::iterator m = jw.begin(); m != jw.end(); ++m) + for (std::map<int, float>::iterator m = jw.begin(); m != jw.end(); ++m) { joints.push_back((*m).first); weights.push_back(invsumw*(*m).second); @@ -502,7 +502,7 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase float inv_bind_mat[4][4]; // SECOND_LIFE_COMPATIBILITY - if(export_settings->second_life) + if (export_settings->second_life) { // Only translations, no rotation vs armature float temp[4][4]; @@ -560,7 +560,7 @@ std::string ArmatureExporter::add_weights_source(Mesh *me, const std::string& co source.prepareToAppendValues(); - for(std::list<float>::const_iterator i = weights.begin(); i != weights.end(); ++i) { + for (std::list<float>::const_iterator i = weights.begin(); i != weights.end(); ++i) { source.appendValues(*i); } @@ -597,7 +597,7 @@ void ArmatureExporter::add_vertex_weights_element(const std::string& weights_sou // write deformer index - weight index pairs int weight_index = 0; - for(std::list<int>::const_iterator i = joints.begin(); i != joints.end(); ++i) + for (std::list<int>::const_iterator i = joints.begin(); i != joints.end(); ++i) { weightselem.appendValues(*i, weight_index++); } diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 8a5461710f6..50ec2985552 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -278,7 +278,7 @@ void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone, COLLADAFW: TagsMap::iterator etit; ExtraTags *et = 0; etit = uid_tags_map.find(node->getUniqueId().toAscii()); - if(etit != uid_tags_map.end()) + if (etit != uid_tags_map.end()) { et = etit->second; //else return; @@ -306,7 +306,7 @@ void ArmatureImporter::fix_leaf_bones( ) float vec[3] = {0.0f, 0.0f, 0.1f}; // if parent: take parent length and direction - if(leaf.bone->parent) sub_v3_v3v3(vec, leaf.bone->parent->tail, leaf.bone->parent->head); + if (leaf.bone->parent) sub_v3_v3v3(vec, leaf.bone->parent->tail, leaf.bone->parent->head); copy_v3_v3(leaf.bone->tail, leaf.bone->head); add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec); @@ -767,7 +767,7 @@ Object *ArmatureImporter::get_armature_for_joint(COLLADAFW::Node *node) std::map<COLLADAFW::UniqueId, Object*>::iterator arm; for (arm = unskinned_armature_map.begin(); arm != unskinned_armature_map.end(); arm++) { - if(arm->first == node->getUniqueId() ) + if (arm->first == node->getUniqueId() ) return arm->second; } return NULL; diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp index 6e04a1773bb..647a871e5b1 100644 --- a/source/blender/collada/DocumentExporter.cpp +++ b/source/blender/collada/DocumentExporter.cpp @@ -130,7 +130,7 @@ extern char build_rev[]; char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int n) { int layer_index = CustomData_get_layer_index(data, type); - if(layer_index < 0) return NULL; + if (layer_index < 0) return NULL; return data->layers[layer_index+n].name; } @@ -139,7 +139,7 @@ char *bc_CustomData_get_active_layer_name(const CustomData *data, int type) { /* get the layer index of the active layer of type */ int layer_index = CustomData_get_active_layer_index(data, type); - if(layer_index < 0) return NULL; + if (layer_index < 0) return NULL; return data->layers[layer_index].name; } @@ -178,30 +178,30 @@ void DocumentExporter::exportCurrentScene(Scene *sce) switch(RNA_property_enum_get(&unit_settings, system)) { case USER_UNIT_NONE: case USER_UNIT_METRIC: - if(linearmeasure == 0.001f) { + if (linearmeasure == 0.001f) { unitname = "millimeter"; } - else if(linearmeasure == 0.01f) { + else if (linearmeasure == 0.01f) { unitname = "centimeter"; } - else if(linearmeasure == 0.1f) { + else if (linearmeasure == 0.1f) { unitname = "decimeter"; } - else if(linearmeasure == 1.0f) { + else if (linearmeasure == 1.0f) { unitname = "meter"; } - else if(linearmeasure == 1000.0f) { + else if (linearmeasure == 1000.0f) { unitname = "kilometer"; } break; case USER_UNIT_IMPERIAL: - if(linearmeasure == 0.0254f) { + if (linearmeasure == 0.0254f) { unitname = "inch"; } - else if(linearmeasure == 0.3048f) { + else if (linearmeasure == 0.3048f) { unitname = "foot"; } - else if(linearmeasure == 0.9144f) { + else if (linearmeasure == 0.9144f) { unitname = "yard"; } break; @@ -211,7 +211,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce) asset.setUnit(unitname, linearmeasure); asset.setUpAxisType(COLLADASW::Asset::Z_UP); - if(U.author[0] != '\0') { + if (U.author[0] != '\0') { asset.getContributor().mAuthor = U.author; } else { @@ -227,13 +227,13 @@ void DocumentExporter::exportCurrentScene(Scene *sce) asset.add(); // <library_cameras> - if(has_object_type(sce, OB_CAMERA)) { + if (has_object_type(sce, OB_CAMERA)) { CamerasExporter ce(&sw, this->export_settings); ce.exportCameras(sce); } // <library_lights> - if(has_object_type(sce, OB_LAMP)) { + if (has_object_type(sce, OB_LAMP)) { LightsExporter le(&sw, this->export_settings); le.exportLights(sce); } @@ -251,7 +251,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce) me.exportMaterials(sce); // <library_geometries> - if(has_object_type(sce, OB_MESH)) { + if (has_object_type(sce, OB_MESH)) { GeometryExporter ge(&sw, this->export_settings); ge.exportGeom(sce); } @@ -262,7 +262,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce) // <library_controllers> ArmatureExporter arm_exporter(&sw, this->export_settings); - if(has_object_type(sce, OB_ARMATURE)) { + if (has_object_type(sce, OB_ARMATURE)) { arm_exporter.export_controllers(sce); } diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 4ad79e0b309..9e604978f64 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -126,7 +126,7 @@ bool DocumentImporter::import() return false; } - if(errorHandler.hasError()) + if (errorHandler.hasError()) return false; /** TODO set up scene graph and such here */ @@ -161,7 +161,7 @@ void DocumentImporter::start(){} void DocumentImporter::finish() { - if(mImportStage!=General) + if (mImportStage!=General) return; /** TODO Break up and put into 2-pass parsing of DAE */ @@ -339,7 +339,7 @@ Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod // transformation matrix and apply it to the newly instantiated // object to account for node hierarchy transforms in // .dae - if(source_node) { + if (source_node) { COLLADABU::Math::Matrix4 mat4 = source_node->getTransformationMatrix(); COLLADABU::Math::Matrix4 bmat4 = mat4.transpose(); // transpose to get blender row-major order float mat[4][4]; @@ -492,7 +492,7 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren \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. @@ -515,7 +515,7 @@ bool DocumentImporter::writeVisualScene ( const COLLADAFW::VisualScene* visualSc \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); @@ -533,7 +533,7 @@ bool DocumentImporter::writeLibraryNodes ( const COLLADAFW::LibraryNodes* librar \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); @@ -543,7 +543,7 @@ bool DocumentImporter::writeGeometry ( const COLLADAFW::Geometry* geom ) \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(); @@ -699,10 +699,10 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia } } - if(ef->getOpacity().isTexture()) { + if (ef->getOpacity().isTexture()) { COLLADAFW::Texture ctex = ef->getOpacity().getTexture(); mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map); - if(mtex != NULL) { + if (mtex != NULL) { mtex->mapto = MAP_ALPHA; mtex->tex->imaflag |= TEX_USEALPHA; i++; @@ -732,7 +732,7 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect ) { - if(mImportStage!=General) + if (mImportStage!=General) return true; const COLLADAFW::UniqueId& uid = effect->getUniqueId(); @@ -744,7 +744,7 @@ 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++ ) + for (iter = uid_material_map.begin(); iter != uid_material_map.end() ; iter++ ) { if ( iter->second == ma ) { this->FW_object_map[iter->first] = effect; @@ -770,7 +770,7 @@ bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect ) \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; @@ -886,7 +886,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) \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 @@ -911,7 +911,7 @@ bool DocumentImporter::writeImage( const COLLADAFW::Image* image ) \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; @@ -920,7 +920,7 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) TagsMap::iterator etit; ExtraTags *et = 0; etit = uid_tags_map.find(light->getUniqueId().toAscii()); - if(etit != uid_tags_map.end()) + if (etit != uid_tags_map.end()) et = etit->second; la_id = light->getOriginalId(); @@ -934,7 +934,7 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) } // if we find an ExtraTags for this, use that instead. - if(et && et->isProfile("blender")) { + if (et && et->isProfile("blender")) { et->setData("type", &(lamp->type)); et->setData("flag", &(lamp->flag)); et->setData("mode", &(lamp->mode)); @@ -1007,12 +1007,12 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) lamp->b = col.getBlue(); } - if(IS_EQ(linatt, 0.0f) && quadatt > 0.0f) { + if (IS_EQ(linatt, 0.0f) && quadatt > 0.0f) { att2 = quadatt; d = sqrt(1.0f/quadatt); } // linear light - else if(IS_EQ(quadatt, 0.0f) && linatt > 0.0f) { + else if (IS_EQ(quadatt, 0.0f) && linatt > 0.0f) { att1 = linatt; d = (1.0f/linatt); } @@ -1041,9 +1041,9 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) lamp->type = LA_SPOT; lamp->att1 = att1; lamp->att2 = att2; - if(IS_EQ(att1, 0.0f) && att2 > 0) + if (IS_EQ(att1, 0.0f) && att2 > 0) lamp->falloff_type = LA_FALLOFF_INVSQUARE; - if(IS_EQ(att2, 0.0f) && att1 > 0) + if (IS_EQ(att2, 0.0f) && att1 > 0) lamp->falloff_type = LA_FALLOFF_INVLINEAR; lamp->spotsize = light->getFallOffAngle().getValue(); lamp->spotblend = light->getFallOffExponent().getValue(); @@ -1061,9 +1061,9 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) lamp->type = LA_LOCAL; lamp->att1 = att1; lamp->att2 = att2; - if(IS_EQ(att1, 0.0f) && att2 > 0) + if (IS_EQ(att1, 0.0f) && att2 > 0) lamp->falloff_type = LA_FALLOFF_INVSQUARE; - if(IS_EQ(att2, 0.0f) && att1 > 0) + if (IS_EQ(att2, 0.0f) && att1 > 0) lamp->falloff_type = LA_FALLOFF_INVLINEAR; } break; @@ -1084,7 +1084,7 @@ 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 ) { - if(mImportStage!=General) + if (mImportStage!=General) return true; // return true; @@ -1094,7 +1094,7 @@ bool DocumentImporter::writeAnimation( const COLLADAFW::Animation* anim ) // called on post-process stage after writeVisualScenes bool DocumentImporter::writeAnimationList( const COLLADAFW::AnimationList* animationList ) { - if(mImportStage!=General) + if (mImportStage!=General) return true; // return true; @@ -1111,7 +1111,7 @@ bool DocumentImporter::writeSkinControllerData( const COLLADAFW::SkinControllerD // this is called on postprocess, before writeVisualScenes bool DocumentImporter::writeController( const COLLADAFW::Controller* controller ) { - if(mImportStage!=General) + if (mImportStage!=General) return true; return armature_importer.write_controller(controller); @@ -1129,7 +1129,7 @@ bool DocumentImporter::writeKinematicsScene( const COLLADAFW::KinematicsScene* k 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()]; diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp index 0dbd44f2b73..dd20e7b85b0 100644 --- a/source/blender/collada/EffectExporter.cpp +++ b/source/blender/collada/EffectExporter.cpp @@ -63,7 +63,7 @@ bool EffectsExporter::hasEffects(Scene *sce) while(base) { Object *ob= base->object; int a; - for(a = 0; a < ob->totcol; a++) + for (a = 0; a < ob->totcol; a++) { Material *ma = give_current_material(ob, a+1); @@ -79,7 +79,7 @@ bool EffectsExporter::hasEffects(Scene *sce) void EffectsExporter::exportEffects(Scene *sce) { - if(hasEffects(sce)) { + if (hasEffects(sce)) { this->scene = sce; openLibrary(); MaterialFunctor mf; @@ -129,7 +129,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); } @@ -140,7 +140,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob) } } else { - if(ma->diff_shader == MA_DIFF_LAMBERT) { + if (ma->diff_shader == MA_DIFF_LAMBERT) { writeLambert(ep, ma); } else { @@ -177,7 +177,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) + 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); else cot = getcol(ma->amb, ma->amb, ma->amb, 1.0f); @@ -220,7 +220,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob) Image *ima = t->tex->ima; // Image not set for texture - if(!ima) continue; + if (!ima) continue; std::string key(id_name(ima)); key = translate_id(key); @@ -266,7 +266,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob) Image *ima = t->tex->ima; // Image not set for texture - if(!ima) continue; + if (!ima) continue; // we assume map input is always TEXCO_UV diff --git a/source/blender/collada/ExtraHandler.cpp b/source/blender/collada/ExtraHandler.cpp index d6d3aa87cfd..6606fe1a27b 100644 --- a/source/blender/collada/ExtraHandler.cpp +++ b/source/blender/collada/ExtraHandler.cpp @@ -54,7 +54,7 @@ bool ExtraHandler::textData(const char* text, size_t textLength) { char buf[1024]; - if(currentElement.length() == 0 || currentExtraTags == 0) return false; + if (currentElement.length() == 0 || currentExtraTags == 0) return false; BLI_snprintf(buf, textLength+1, "%s", text); currentExtraTags->addTag(currentElement, std::string(buf)); @@ -65,11 +65,11 @@ bool ExtraHandler::parseElement ( const char* profileName, const unsigned long& elementHash, const COLLADAFW::UniqueId& uniqueId ) { - if(BLI_strcaseeq(profileName, "blender")) { + 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) { + if (!et) { et = new ExtraTags(std::string(profileName)); dimp->addExtraTags(uniqueId, et); } diff --git a/source/blender/collada/ExtraTags.cpp b/source/blender/collada/ExtraTags.cpp index b1b1936e254..c5a126894cb 100644 --- a/source/blender/collada/ExtraTags.cpp +++ b/source/blender/collada/ExtraTags.cpp @@ -56,7 +56,7 @@ bool ExtraTags::addTag( std::string tag, std::string data) int ExtraTags::asInt( std::string tag, bool *ok) { - if(tags.find(tag) == tags.end()) { + if (tags.find(tag) == tags.end()) { *ok = false; return -1; } @@ -66,7 +66,7 @@ int ExtraTags::asInt( std::string tag, bool *ok) float ExtraTags::asFloat( std::string tag, bool *ok) { - if(tags.find(tag) == tags.end()) { + if (tags.find(tag) == tags.end()) { *ok = false; return -1.0f; } @@ -76,7 +76,7 @@ float ExtraTags::asFloat( std::string tag, bool *ok) std::string ExtraTags::asString( std::string tag, bool *ok) { - if(tags.find(tag) == tags.end()) { + if (tags.find(tag) == tags.end()) { *ok = false; return ""; } @@ -89,28 +89,28 @@ void ExtraTags::setData(std::string tag, short *data) { bool ok = false; int tmp = asInt(tag, &ok); - if(ok) + if (ok) *data = (short)tmp; } void ExtraTags::setData(std::string tag, int *data) { bool ok = false; int tmp = asInt(tag, &ok); - if(ok) + if (ok) *data = tmp; } void ExtraTags::setData(std::string tag, float *data) { bool ok = false; float tmp = asFloat(tag, &ok); - if(ok) + if (ok) *data = tmp; } void ExtraTags::setData(std::string tag, char *data) { bool ok = false; int tmp = asInt(tag, &ok); - if(ok) + if (ok) *data = (char)tmp; } diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp index 2af1df90f51..ca112abc0af 100644 --- a/source/blender/collada/GeometryExporter.cpp +++ b/source/blender/collada/GeometryExporter.cpp @@ -109,7 +109,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, geom_id, norind); } } diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp index 3926cb48253..3775a63c71d 100644 --- a/source/blender/collada/ImageExporter.cpp +++ b/source/blender/collada/ImageExporter.cpp @@ -51,7 +51,7 @@ bool ImagesExporter::hasImages(Scene *sce) while(base) { Object *ob= base->object; int a; - for(a = 0; a < ob->totcol; a++) + for (a = 0; a < ob->totcol; a++) { Material *ma = give_current_material(ob, a+1); @@ -71,7 +71,7 @@ bool ImagesExporter::hasImages(Scene *sce) void ImagesExporter::exportImages(Scene *sce) { - if(hasImages(sce)) { + if (hasImages(sce)) { openLibrary(); MaterialFunctor mf; mf.forEachMaterialInScene<ImagesExporter>(sce, *this, this->export_settings->selected); diff --git a/source/blender/collada/InstanceWriter.cpp b/source/blender/collada/InstanceWriter.cpp index 40ca1bc3b0e..a605bdeefcc 100644 --- a/source/blender/collada/InstanceWriter.cpp +++ b/source/blender/collada/InstanceWriter.cpp @@ -43,7 +43,7 @@ void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_material, Object *ob) { - for(int a = 0; a < ob->totcol; a++) { + for (int a = 0; a < ob->totcol; a++) { Material *ma = give_current_material(ob, a+1); COLLADASW::InstanceMaterialList& iml = bind_material.getInstanceMaterialList(); diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp index d74a1d1033d..51242b36b64 100644 --- a/source/blender/collada/LightExporter.cpp +++ b/source/blender/collada/LightExporter.cpp @@ -73,7 +73,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; } diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp index b66779953ef..1e3358c9216 100644 --- a/source/blender/collada/MaterialExporter.cpp +++ b/source/blender/collada/MaterialExporter.cpp @@ -35,7 +35,7 @@ MaterialsExporter::MaterialsExporter(COLLADASW::StreamWriter *sw, const ExportSe void MaterialsExporter::exportMaterials(Scene *sce) { - if(hasMaterials(sce)) { + if (hasMaterials(sce)) { openLibrary(); MaterialFunctor mf; @@ -53,7 +53,7 @@ bool MaterialsExporter::hasMaterials(Scene *sce) while(base) { Object *ob= base->object; int a; - for(a = 0; a < ob->totcol; a++) + for (a = 0; a < ob->totcol; a++) { Material *ma = give_current_material(ob, a+1); diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index 2539756dbdf..e50005634ba 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -145,7 +145,7 @@ 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: @@ -281,7 +281,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) // checks if mesh has sup COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp; COLLADAFW::Polygons::VertexCountArray& vca = mpvc->getGroupedVerticesVertexCountArray(); - for(unsigned int j = 0; j < vca.getCount(); j++){ + 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", @@ -291,7 +291,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh) // checks if mesh has sup } } - 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; } @@ -310,7 +310,7 @@ 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); @@ -742,12 +742,12 @@ MTex *MeshImporter::assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBindi 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; + if (layer_index == -1) return NULL; CustomDataLayer *cdl = &data->layers[layer_index+setindex]; @@ -798,7 +798,7 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri 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 + 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. @@ -913,7 +913,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta // loop through geom's materials for (unsigned int i = 0; i < mat_array.getCount(); i++) { - if(mat_array[i].getReferencedMaterial().isValid()) { + 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); diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp index b6be8a57f7a..9010fd5062a 100644 --- a/source/blender/collada/SceneExporter.cpp +++ b/source/blender/collada/SceneExporter.cpp @@ -47,7 +47,7 @@ void SceneExporter::exportHierarchy(Scene *sce) Object *ob = base->object; if (!ob->parent) { - if(sce->lay & ob->lay) { + if (sce->lay & ob->lay) { switch(ob->type) { case OB_MESH: case OB_CAMERA: @@ -144,17 +144,17 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce) // empty object else if (ob->type == OB_EMPTY) { // TODO: handle groups (OB_DUPLIGROUP - if((ob->transflag & OB_DUPLIGROUP) == OB_DUPLIGROUP && ob->dup_group) { + if ((ob->transflag & OB_DUPLIGROUP) == OB_DUPLIGROUP && ob->dup_group) { 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); } } } - for(std::list<Object*>::iterator i= child_objects.begin(); i != child_objects.end(); ++i) + for (std::list<Object*>::iterator i= child_objects.begin(); i != child_objects.end(); ++i) { writeNodes(*i, sce); } diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp index 10a965308b1..f441833233c 100644 --- a/source/blender/collada/TransformWriter.cpp +++ b/source/blender/collada/TransformWriter.cpp @@ -95,18 +95,18 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob) */ /* Using parentinv should allow use of existing curves */ - if(ob->parent) + if (ob->parent) { // If parentinv is identity don't add it. bool add_parinv = false; - for(int i = 0; i < 16; ++i) + for (int i = 0; i < 16; ++i) { float f = (i % 4 == i / 4) ? 1.0f : 0.0f; add_parinv |= (ob->parentinv[i % 4][i / 4] != f); } - if(add_parinv) + if (add_parinv) { double dmat[4][4]; UnitConverter converter; diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp index 39114f6543b..70bf0556b5b 100644 --- a/source/blender/collada/collada.cpp +++ b/source/blender/collada/collada.cpp @@ -44,7 +44,7 @@ extern "C" int collada_import(bContext *C, const char *filepath) { DocumentImporter imp (C, filepath); - if(imp.import()) return 1; + if (imp.import()) return 1; return 0; } @@ -58,9 +58,9 @@ extern "C" export_settings.filepath = (char *)filepath; /* annoying, collada crashes if file cant be created! [#27162] */ - if(!BLI_exists(filepath)) { + if (!BLI_exists(filepath)) { BLI_make_existing_file(filepath); /* makes the dir if its not there */ - if(BLI_file_touch(filepath) == 0) { + if (BLI_file_touch(filepath) == 0) { return 0; } } diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp index d7263e07eb8..fc4093bd795 100644 --- a/source/blender/collada/collada_internal.cpp +++ b/source/blender/collada/collada_internal.cpp @@ -206,7 +206,7 @@ std::string translate_id(const std::string &id) { id_translated[i] = translate_name_map[(unsigned int)id_translated[i]]; } - // It's so much workload now, the if() should speed up things. + // It's so much workload now, the if () should speed up things. if (id_translated != id) { // Search duplicates diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index c3aa73510d1..4aed29defbc 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -61,8 +61,8 @@ int bc_test_parent_loop(Object *par, Object *ob) { /* test if 'ob' is a parent somewhere in par's parents */ - if(par == NULL) return 0; - if(ob == par) return 1; + if (par == NULL) return 0; + if (ob == par) return 1; return bc_test_parent_loop(par->parent, ob); } |