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.
This commit is contained in:
@@ -116,9 +116,8 @@ int AVI_get_stream(AviMovie *movie, int avist_type, int stream_num)
|
||||
if (stream_num == 0) {
|
||||
return cur_stream;
|
||||
}
|
||||
else {
|
||||
stream_num--;
|
||||
}
|
||||
|
||||
stream_num--;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -572,9 +571,8 @@ AviError AVI_open_movie(const char *name, AviMovie *movie)
|
||||
if (GET_FCC(movie->fp) == FCC("movi")) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
BLI_fseek(movie->fp, size - 4, SEEK_CUR);
|
||||
}
|
||||
|
||||
BLI_fseek(movie->fp, size - 4, SEEK_CUR);
|
||||
}
|
||||
else {
|
||||
BLI_fseek(movie->fp, size, SEEK_CUR);
|
||||
|
||||
@@ -96,35 +96,34 @@ void *avi_converter_from_avi_rgb(AviMovie *movie,
|
||||
|
||||
return buf;
|
||||
}
|
||||
else {
|
||||
buf = imb_alloc_pixels(
|
||||
movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "fromavirgbbuf");
|
||||
|
||||
if (buf) {
|
||||
size_t rowstride = movie->header->Width * 3;
|
||||
BLI_assert(bits != 16);
|
||||
if (movie->header->Width % 2) {
|
||||
rowstride++;
|
||||
}
|
||||
buf = imb_alloc_pixels(
|
||||
movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "fromavirgbbuf");
|
||||
|
||||
for (size_t y = 0; y < movie->header->Height; y++) {
|
||||
memcpy(&buf[y * movie->header->Width * 3],
|
||||
&buffer[((movie->header->Height - 1) - y) * rowstride],
|
||||
movie->header->Width * 3);
|
||||
}
|
||||
|
||||
for (size_t y = 0; y < (size_t)movie->header->Height * (size_t)movie->header->Width * 3;
|
||||
y += 3) {
|
||||
int i = buf[y];
|
||||
buf[y] = buf[y + 2];
|
||||
buf[y + 2] = i;
|
||||
}
|
||||
if (buf) {
|
||||
size_t rowstride = movie->header->Width * 3;
|
||||
BLI_assert(bits != 16);
|
||||
if (movie->header->Width % 2) {
|
||||
rowstride++;
|
||||
}
|
||||
|
||||
MEM_freeN(buffer);
|
||||
for (size_t y = 0; y < movie->header->Height; y++) {
|
||||
memcpy(&buf[y * movie->header->Width * 3],
|
||||
&buffer[((movie->header->Height - 1) - y) * rowstride],
|
||||
movie->header->Width * 3);
|
||||
}
|
||||
|
||||
return buf;
|
||||
for (size_t y = 0; y < (size_t)movie->header->Height * (size_t)movie->header->Width * 3;
|
||||
y += 3) {
|
||||
int i = buf[y];
|
||||
buf[y] = buf[y + 2];
|
||||
buf[y + 2] = i;
|
||||
}
|
||||
}
|
||||
|
||||
MEM_freeN(buffer);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
void *avi_converter_to_avi_rgb(AviMovie *movie, int stream, unsigned char *buffer, size_t *size)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
/* 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);
|
||||
|
||||
BLI_addtail(AnimCurves, fcu);
|
||||
fcurve_is_used(fcu);
|
||||
}
|
||||
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)) {
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user