From aba4e6810f8b4d0e459137b64e061a2cadc457d1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 31 May 2019 23:21:16 +1000 Subject: Cleanup: style, use braces in source/ (include disabled blocks) --- source/blender/collada/AnimationExporter.cpp | 5 ++-- source/blender/collada/AnimationImporter.cpp | 42 ++++++++++++++++++---------- source/blender/collada/ArmatureImporter.cpp | 9 ++++-- source/blender/collada/EffectExporter.cpp | 3 +- source/blender/collada/collada_utils.h | 3 +- 5 files changed, 41 insertions(+), 21 deletions(-) (limited to 'source/blender/collada') diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 9ed79396dee..c30c0d4ea08 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -389,8 +389,8 @@ bool AnimationExporter::is_bone_deform_group(Bone *bone) /* Check if current bone is deform */ if ((bone->flag & BONE_NO_DEFORM) == 0) { return true; - /* Check child bones */ } + /* Check child bones */ else { for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) { /* loop through all the children until deform bone is found, and then return */ @@ -854,8 +854,9 @@ void AnimationExporter::export_morph_animation(Object *ob, BCAnimationSampler &s { FCurve *fcu; Key *key = BKE_key_from_object(ob); - if (!key) + if (!key) { return; + } if (key->adt && key->adt->action) { fcu = (FCurve *)key->adt->action->curves.first; diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 992b5083fbc..311df47cdd5 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -200,8 +200,9 @@ void AnimationImporter::add_fcurves_to_object(Main *bmain, bool is_rotation = p && *(p + strlen("rotation_euler")) == '\0'; /* convert degrees to radians for rotation */ - if (is_rotation) + if (is_rotation) { fcurve_deg_to_rad(fcu); + } #endif for (it = curves.begin(), i = 0; it != curves.end(); it++, i++) { @@ -355,16 +356,19 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act) FCurve *eulcu[3] = {NULL, NULL, NULL}; - if (fcurves_actionGroup_map.find(grp) == fcurves_actionGroup_map.end()) + if (fcurves_actionGroup_map.find(grp) == fcurves_actionGroup_map.end()) { continue; + } std::vector &rot_fcurves = fcurves_actionGroup_map[grp]; - if (rot_fcurves.size() > 3) + if (rot_fcurves.size() > 3) { continue; + } - for (i = 0; i < rot_fcurves.size(); i++) + for (i = 0; i < rot_fcurves.size(); i++) { eulcu[rot_fcurves[i]->array_index] = rot_fcurves[i]; + } char joint_path[100]; char rna_path[100]; @@ -389,8 +393,9 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act) FCurve *cu = eulcu[i]; - if (!cu) + if (!cu) { continue; + } for (int j = 0; j < cu->totvert; j++) { float frame = cu->bezt[j].vec[1][0]; @@ -412,16 +417,18 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act) eul_to_quat(quat, eul); - for (int k = 0; k < 4; k++) + for (int k = 0; k < 4; k++) { create_bezt(quatcu[k], frame, quat[k], U.ipo_new); + } } } /* now replace old Euler curves */ for (i = 0; i < 3; i++) { - if (!eulcu[i]) + if (!eulcu[i]) { continue; + } action_groups_remove_channel(act, eulcu[i]); free_fcurve(eulcu[i]); @@ -429,8 +436,9 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act) chan->rotmode = ROT_MODE_QUAT; - for (i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { action_groups_add_channel(act, grp, quatcu[i]); + } } bPoseChannel *pchan; @@ -1671,8 +1679,9 @@ Object *AnimationImporter::translate_animation_OLD( newcu[i] = create_fcurve(axis, rna_path); #ifdef ARMATURE_TEST - if (is_joint) + if (is_joint) { job_curves[i] = create_fcurve(axis, tm_str); + } #endif } @@ -1774,12 +1783,15 @@ Object *AnimationImporter::translate_animation_OLD( for (i = 0; i < totcu; i++) { if (is_matrix) { - if (i < 4) + if (i < 4) { add_bezt(job_curves[i], fra, rot[i]); - else if (i < 7) + } + else if (i < 7) { add_bezt(job_curves[i], fra, loc[i - 4]); - else + } + else { add_bezt(job_curves[i], fra, scale[i - 7]); + } } else { add_bezt(job_curves[i], fra, val[i]); @@ -1803,8 +1815,9 @@ Object *AnimationImporter::translate_animation_OLD( } #ifdef ARMATURE_TEST - if (is_joint) + if (is_joint) { BLI_addtail(&job->adt->action->curves, job_curves[i]); + } #endif } @@ -2153,8 +2166,9 @@ bool AnimationImporter::evaluate_joint_world_transform_at_frame( else { COLLADAFW::NodePointerArray &children = node->getChildNodes(); for (int i = 0; i < children.getCount(); i++) { - if (evaluate_joint_world_transform_at_frame(mat, m, children[i], end, fra)) + if (evaluate_joint_world_transform_at_frame(mat, m, children[i], end, fra)) { return true; + } } } diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 080a62536f5..de66c6ebdb2 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -439,14 +439,16 @@ Object *ArmatureImporter::get_empty_for_leaves() Object *ArmatureImporter::find_armature(COLLADAFW::Node *node) { JointData *jd = get_joint_data(node); - if (jd) + if (jd) { return jd->ob_arm; + } COLLADAFW::NodePointerArray &children = node->getChildNodes(); for (int i = 0; i < children.getCount(); i++) { Object *ob_arm = find_armature(children[i]); - if (ob_arm) + if (ob_arm) { return ob_arm; + } } return NULL; @@ -457,8 +459,9 @@ ArmatureJoints &ArmatureImporter::get_armature_joints(Object *ob_arm) /* try finding it */ std::vector::iterator it; for (it = armature_joints.begin(); it != armature_joints.end(); it++) { - if ((*it).ob_arm == ob_arm) + if ((*it).ob_arm == ob_arm) { return *it; + } } /* not found, create one */ diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp index c58edd60611..676d939e8f5 100644 --- a/source/blender/collada/EffectExporter.cpp +++ b/source/blender/collada/EffectExporter.cpp @@ -201,8 +201,9 @@ void EffectsExporter::operator()(Material *ma, Object *ob) Image *ima = t->tex->ima; // Image not set for texture - if (!ima) + if (!ima) { continue; + } std::string key(id_name(ima)); key = translate_id(key); diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h index 240e6200cf3..5c90e762373 100644 --- a/source/blender/collada/collada_utils.h +++ b/source/blender/collada/collada_utils.h @@ -180,8 +180,9 @@ inline bool bc_startswith(std::string const &value, std::string const &starting) #if 0 /* UNUSED */ inline bool bc_endswith(std::string const &value, std::string const &ending) { - if (ending.size() > value.size()) + if (ending.size() > value.size()) { return false; + } return std::equal(ending.rbegin(), ending.rend(), value.rbegin()); } #endif -- cgit v1.2.3