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:
-rw-r--r--source/blender/io/avi/intern/avi.c10
-rw-r--r--source/blender/io/avi/intern/avi_rgb.c45
-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
7 files changed, 127 insertions, 144 deletions
diff --git a/source/blender/io/avi/intern/avi.c b/source/blender/io/avi/intern/avi.c
index e829a15deba..0ab51b7a084 100644
--- a/source/blender/io/avi/intern/avi.c
+++ b/source/blender/io/avi/intern/avi.c
@@ -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);
diff --git a/source/blender/io/avi/intern/avi_rgb.c b/source/blender/io/avi/intern/avi_rgb.c
index 44542af96ae..8af728f0737 100644
--- a/source/blender/io/avi/intern/avi_rgb.c
+++ b/source/blender/io/avi/intern/avi_rgb.c
@@ -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++;
- }
- 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);
- }
+ buf = imb_alloc_pixels(
+ movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "fromavirgbbuf");
- 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)
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)