Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-08-07 13:40:12 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-08-07 14:38:06 +0300
commitdee359e26e7dd6eb0b51594497d90421801ed877 (patch)
tree8f0ca116c8438f403b93675049281763541d4815 /source/blender/io/collada
parentdbf4f52fe0b7644ab607a6edd66facc6f1736693 (diff)
Cleanup: IO, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/io` module. No functional changes.
Diffstat (limited to 'source/blender/io/collada')
-rw-r--r--source/blender/io/collada/AnimationExporter.cpp21
-rw-r--r--source/blender/io/collada/AnimationImporter.cpp162
-rw-r--r--source/blender/io/collada/BCAnimationCurve.cpp5
-rw-r--r--source/blender/io/collada/DocumentImporter.cpp3
-rw-r--r--source/blender/io/collada/collada_utils.cpp25
5 files changed, 101 insertions, 115 deletions
diff --git a/source/blender/io/collada/AnimationExporter.cpp b/source/blender/io/collada/AnimationExporter.cpp
index 1515e5413f0..a4302a680a3 100644
--- a/source/blender/io/collada/AnimationExporter.cpp
+++ b/source/blender/io/collada/AnimationExporter.cpp
@@ -395,15 +395,15 @@ bool AnimationExporter::is_bone_deform_group(Bone *bone)
return true;
}
/* 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 */
- is_def = is_bone_deform_group(child);
- if (is_def) {
- return true;
- }
+
+ 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;
}
}
+
/* no deform bone found in children also */
return false;
}
@@ -840,12 +840,11 @@ std::string AnimationExporter::get_collada_sid(const BCAnimationCurve &curve,
if (is_angle) {
return tm_name + std::string(axis_name) + ".ANGLE";
}
- else if (!axis_name.empty()) {
+ if (!axis_name.empty()) {
return tm_name + "." + std::string(axis_name);
}
- else {
- return tm_name;
- }
+
+ return tm_name;
}
return tm_name;
diff --git a/source/blender/io/collada/AnimationImporter.cpp b/source/blender/io/collada/AnimationImporter.cpp
index b53aa95a11f..1dada68293e 100644
--- a/source/blender/io/collada/AnimationImporter.cpp
+++ b/source/blender/io/collada/AnimationImporter.cpp
@@ -717,37 +717,36 @@ void AnimationImporter::Assign_float_animations(const COLLADAFW::UniqueId &listi
if (animlist_map.find(listid) == animlist_map.end()) {
return;
}
- else {
- /* anim_type has animations */
- const COLLADAFW::AnimationList *animlist = animlist_map[listid];
- const COLLADAFW::AnimationList::AnimationBindings &bindings = animlist->getAnimationBindings();
- /* all the curves belonging to the current binding */
- std::vector<FCurve *> animcurves;
- for (unsigned int j = 0; j < bindings.getCount(); j++) {
- animcurves = curve_map[bindings[j].animation];
-
- BLI_strncpy(rna_path, anim_type, sizeof(rna_path));
- modify_fcurve(&animcurves, rna_path, 0);
- std::vector<FCurve *>::iterator iter;
- /* Add the curves of the current animation to the object */
- for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
- FCurve *fcu = *iter;
- /* All anim_types whose values are to be converted from Degree to Radians can be ORed here
+
+ /* anim_type has animations */
+ const COLLADAFW::AnimationList *animlist = animlist_map[listid];
+ const COLLADAFW::AnimationList::AnimationBindings &bindings = animlist->getAnimationBindings();
+ /* all the curves belonging to the current binding */
+ std::vector<FCurve *> animcurves;
+ for (unsigned int j = 0; j < bindings.getCount(); j++) {
+ animcurves = curve_map[bindings[j].animation];
+
+ BLI_strncpy(rna_path, anim_type, sizeof(rna_path));
+ modify_fcurve(&animcurves, rna_path, 0);
+ std::vector<FCurve *>::iterator iter;
+ /* Add the curves of the current animation to the object */
+ for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
+ FCurve *fcu = *iter;
+ /* All anim_types whose values are to be converted from Degree to Radians can be ORed here
+ */
+ if (STREQ("spot_size", anim_type)) {
+ /* NOTE: Do NOT convert if imported file was made by blender <= 2.69.10
+ * Reason: old blender versions stored spot_size in radians (was a bug)
*/
- if (STREQ("spot_size", anim_type)) {
- /* NOTE: Do NOT convert if imported file was made by blender <= 2.69.10
- * Reason: old blender versions stored spot_size in radians (was a bug)
- */
- if (this->import_from_version.empty() ||
- BLI_strcasecmp_natural(this->import_from_version.c_str(), "2.69.10") != -1) {
- fcurve_deg_to_rad(fcu);
- }
+ if (this->import_from_version.empty() ||
+ BLI_strcasecmp_natural(this->import_from_version.c_str(), "2.69.10") != -1) {
+ fcurve_deg_to_rad(fcu);
}
- /** XXX What About animtype "rotation" ? */
-
- BLI_addtail(AnimCurves, fcu);
- fcurve_is_used(fcu);
}
+ /** XXX What About animtype "rotation" ? */
+
+ BLI_addtail(AnimCurves, fcu);
+ fcurve_is_used(fcu);
}
}
}
@@ -780,35 +779,34 @@ void AnimationImporter::Assign_lens_animations(const COLLADAFW::UniqueId &listid
if (animlist_map.find(listid) == animlist_map.end()) {
return;
}
- else {
- /* anim_type has animations */
- const COLLADAFW::AnimationList *animlist = animlist_map[listid];
- const COLLADAFW::AnimationList::AnimationBindings &bindings = animlist->getAnimationBindings();
- /* all the curves belonging to the current binding */
- std::vector<FCurve *> animcurves;
- for (unsigned int j = 0; j < bindings.getCount(); j++) {
- animcurves = curve_map[bindings[j].animation];
- BLI_strncpy(rna_path, anim_type, sizeof(rna_path));
+ /* anim_type has animations */
+ const COLLADAFW::AnimationList *animlist = animlist_map[listid];
+ const COLLADAFW::AnimationList::AnimationBindings &bindings = animlist->getAnimationBindings();
+ /* all the curves belonging to the current binding */
+ std::vector<FCurve *> animcurves;
+ for (unsigned int j = 0; j < bindings.getCount(); j++) {
+ animcurves = curve_map[bindings[j].animation];
- 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;
+ BLI_strncpy(rna_path, anim_type, sizeof(rna_path));
- for (unsigned int i = 0; i < fcu->totvert; i++) {
- fcu->bezt[i].vec[0][1] = convert_to_focal_length(
- fcu->bezt[i].vec[0][1], fov_type, aspect, cam->sensor_x);
- fcu->bezt[i].vec[1][1] = convert_to_focal_length(
- fcu->bezt[i].vec[1][1], fov_type, aspect, cam->sensor_x);
- fcu->bezt[i].vec[2][1] = convert_to_focal_length(
- fcu->bezt[i].vec[2][1], fov_type, aspect, cam->sensor_x);
- }
+ 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;
- BLI_addtail(AnimCurves, fcu);
- fcurve_is_used(fcu);
+ for (unsigned int i = 0; i < fcu->totvert; i++) {
+ fcu->bezt[i].vec[0][1] = convert_to_focal_length(
+ fcu->bezt[i].vec[0][1], fov_type, aspect, cam->sensor_x);
+ fcu->bezt[i].vec[1][1] = convert_to_focal_length(
+ fcu->bezt[i].vec[1][1], fov_type, aspect, cam->sensor_x);
+ fcu->bezt[i].vec[2][1] = convert_to_focal_length(
+ fcu->bezt[i].vec[2][1], fov_type, aspect, cam->sensor_x);
}
+
+ BLI_addtail(AnimCurves, fcu);
+ fcurve_is_used(fcu);
}
}
}
@@ -1077,35 +1075,34 @@ void AnimationImporter::translate_Animations(
if (animlist_map.find(listid) == animlist_map.end()) {
continue;
}
- else {
- /* transformation has animations */
- const COLLADAFW::AnimationList *animlist = animlist_map[listid];
- const COLLADAFW::AnimationList::AnimationBindings &bindings =
- animlist->getAnimationBindings();
- /* all the curves belonging to the current binding */
- std::vector<FCurve *> animcurves;
- for (unsigned int j = 0; j < bindings.getCount(); j++) {
- animcurves = curve_map[bindings[j].animation];
- if (is_matrix) {
- apply_matrix_curves(ob, animcurves, root, node, transform);
- }
- 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);
-
- 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;
-
- BLI_addtail(AnimCurves, fcu);
- fcurve_is_used(fcu);
- }
+
+ /* transformation has animations */
+ const COLLADAFW::AnimationList *animlist = animlist_map[listid];
+ const COLLADAFW::AnimationList::AnimationBindings &bindings =
+ animlist->getAnimationBindings();
+ /* all the curves belonging to the current binding */
+ std::vector<FCurve *> animcurves;
+ for (unsigned int j = 0; j < bindings.getCount(); j++) {
+ animcurves = curve_map[bindings[j].animation];
+ if (is_matrix) {
+ apply_matrix_curves(ob, animcurves, root, node, transform);
+ }
+ 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);
+
+ 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;
+
+ BLI_addtail(AnimCurves, fcu);
+ fcurve_is_used(fcu);
}
}
}
+
if (is_rotation && !(is_joint || is_matrix)) {
ob->rotmode = ROT_MODE_EUL;
}
@@ -1423,10 +1420,9 @@ AnimationImporter::AnimMix *AnimationImporter::get_animation_type(
if (animlist_map.find(listid) == animlist_map.end()) {
continue;
}
- else {
- types->transform = types->transform | BC_NODE_TRANSFORM;
- break;
- }
+
+ types->transform = types->transform | BC_NODE_TRANSFORM;
+ break;
}
const COLLADAFW::InstanceLightPointerArray &nodeLights = node->getInstanceLights();
@@ -1995,7 +1991,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm,
return true;
}
- else if (is_scale || is_translate) {
+ if (is_scale || is_translate) {
bool is_xyz = animclass == COLLADAFW::AnimationList::POSITION_XYZ;
if ((!is_xyz && curves.size() != 1) || (is_xyz && curves.size() != 3)) {
diff --git a/source/blender/io/collada/BCAnimationCurve.cpp b/source/blender/io/collada/BCAnimationCurve.cpp
index 61dded368b5..5fdbb65fb6e 100644
--- a/source/blender/io/collada/BCAnimationCurve.cpp
+++ b/source/blender/io/collada/BCAnimationCurve.cpp
@@ -559,9 +559,8 @@ inline bool operator<(const BCAnimationCurve &lhs, const BCAnimationCurve &rhs)
const int rha = rhs.get_channel_index();
return lha < rha;
}
- else {
- return lhtgt < rhtgt;
- }
+
+ return lhtgt < rhtgt;
}
BCCurveKey::BCCurveKey()
diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp
index 0f84db79c28..83c8a805076 100644
--- a/source/blender/io/collada/DocumentImporter.cpp
+++ b/source/blender/io/collada/DocumentImporter.cpp
@@ -1254,9 +1254,6 @@ bool DocumentImporter::is_armature(COLLADAFW::Node *node)
if (child_nodes[i]->getType() == COLLADAFW::Node::JOINT) {
return true;
}
- else {
- continue;
- }
}
/* no child is JOINT */
diff --git a/source/blender/io/collada/collada_utils.cpp b/source/blender/io/collada/collada_utils.cpp
index df35a1d2780..2493b3a386b 100644
--- a/source/blender/io/collada/collada_utils.cpp
+++ b/source/blender/io/collada/collada_utils.cpp
@@ -88,9 +88,8 @@ float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray &array, unsigned in
if (array.getType() == COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT) {
return array.getFloatValues()->getData()[index];
}
- else {
- return array.getDoubleValues()->getData()[index];
- }
+
+ return array.getDoubleValues()->getData()[index];
}
/* copied from /editors/object/object_relations.c */
@@ -330,9 +329,8 @@ bool bc_is_root_bone(Bone *aBone, bool deform_bones_only)
}
return (aBone == root);
}
- else {
- return !(aBone->parent);
- }
+
+ return !(aBone->parent);
}
int bc_get_active_UVLayer(Object *ob)
@@ -1322,9 +1320,8 @@ COLLADASW::ColorOrTexture bc_get_base_color(Material *ma)
if (ma->use_nodes && shader) {
return bc_get_cot_from_shader(shader, "Base Color", default_color, false);
}
- else {
- return bc_get_cot(default_color);
- }
+
+ return bc_get_cot(default_color);
}
COLLADASW::ColorOrTexture bc_get_emission(Material *ma)
@@ -1334,9 +1331,8 @@ COLLADASW::ColorOrTexture bc_get_emission(Material *ma)
if (ma->use_nodes && shader) {
return bc_get_cot_from_shader(shader, "Emission", default_color);
}
- else {
- return bc_get_cot(default_color); /* default black */
- }
+
+ return bc_get_cot(default_color); /* default black */
}
COLLADASW::ColorOrTexture bc_get_ambient(Material *ma)
@@ -1419,9 +1415,8 @@ COLLADASW::ColorOrTexture bc_get_cot_from_shader(bNode *shader,
float *col = dcol->value;
return bc_get_cot(col, with_alpha);
}
- else {
- return bc_get_cot(default_color, with_alpha);
- }
+
+ return bc_get_cot(default_color, with_alpha);
}
bNode *bc_get_master_shader(Material *ma)