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:30:43 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-08-07 14:38:06 +0300
commit1b272a649b40e99dba4185167f6cee7cbece1942 (patch)
tree2785f52c566b36cbdcbf9355f698dc520ffbb482 /source/blender
parentcfc6f9eb18e701f5be601b95c45004e8cf7fbc81 (diff)
Cleanup: Blenkernel, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/blenkernel` module. No functional changes.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/camera.c124
-rw-r--r--source/blender/blenkernel/intern/collection.c31
-rw-r--r--source/blender/blenkernel/intern/colorband.c21
-rw-r--r--source/blender/blenkernel/intern/colortools.c45
-rw-r--r--source/blender/blenkernel/intern/constraint.c20
-rw-r--r--source/blender/blenkernel/intern/context.c97
-rw-r--r--source/blender/blenkernel/intern/curveprofile.c5
-rw-r--r--source/blender/blenkernel/intern/customdata.c17
-rw-r--r--source/blender/blenkernel/intern/customdata_file.c10
-rw-r--r--source/blender/blenkernel/intern/data_transfer.c29
-rw-r--r--source/blender/blenkernel/intern/deform.c83
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c6
-rw-r--r--source/blender/blenkernel/intern/editmesh_cache.c9
-rw-r--r--source/blender/blenkernel/intern/effect.c4
-rw-r--r--source/blender/blenkernel/intern/fcurve.c4
-rw-r--r--source/blender/blenkernel/intern/fcurve_driver.c35
-rw-r--r--source/blender/blenkernel/intern/fluid.c6
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c71
-rw-r--r--source/blender/blenkernel/intern/font.c67
-rw-r--r--source/blender/blenkernel/intern/gpencil.c68
-rw-r--r--source/blender/blenkernel/intern/gpencil_geom.c49
-rw-r--r--source/blender/blenkernel/intern/gpencil_modifier.c5
-rw-r--r--source/blender/blenkernel/intern/icons.c19
-rw-r--r--source/blender/blenkernel/intern/idprop.c25
-rw-r--r--source/blender/blenkernel/intern/idtype.c5
-rw-r--r--source/blender/blenkernel/intern/image.c241
-rw-r--r--source/blender/blenkernel/intern/ipo.c14
-rw-r--r--source/blender/blenkernel/intern/lattice.c10
-rw-r--r--source/blender/blenkernel/intern/layer.c25
-rw-r--r--source/blender/blenkernel/intern/lib_id.c15
-rw-r--r--source/blender/blenkernel/intern/lib_override.c5
-rw-r--r--source/blender/blenkernel/intern/lib_query.c5
-rw-r--r--source/blender/blenkernel/intern/mask.c134
-rw-r--r--source/blender/blenkernel/intern/mask_evaluate.c5
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c66
-rw-r--r--source/blender/blenkernel/intern/material.c41
-rw-r--r--source/blender/blenkernel/intern/mball.c5
-rw-r--r--source/blender/blenkernel/intern/mesh.c56
-rw-r--r--source/blender/blenkernel/intern/mesh_evaluate.c34
-rw-r--r--source/blender/blenkernel/intern/mesh_mapping.c7
-rw-r--r--source/blender/blenkernel/intern/mesh_merge.c18
-rw-r--r--source/blender/blenkernel/intern/mesh_remap.c10
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c32
-rw-r--r--source/blender/blenkernel/intern/modifier.c23
-rw-r--r--source/blender/blenkernel/intern/movieclip.c5
-rw-r--r--source/blender/blenkernel/intern/multires.c11
-rw-r--r--source/blender/blenkernel/intern/multires_unsubdivide.c2
-rw-r--r--source/blender/blenkernel/intern/nla.c103
-rw-r--r--source/blender/blenkernel/intern/node.c32
-rw-r--r--source/blender/blenkernel/intern/object.c73
-rw-r--r--source/blender/blenkernel/intern/object_deform.c2
-rw-r--r--source/blender/blenkernel/intern/object_dupli.c19
-rw-r--r--source/blender/blenkernel/intern/ocean.c5
-rw-r--r--source/blender/blenkernel/intern/packedFile.c9
-rw-r--r--source/blender/blenkernel/intern/paint.c38
-rw-r--r--source/blender/blenkernel/intern/particle.c180
-rw-r--r--source/blender/blenkernel/intern/particle_child.c7
-rw-r--r--source/blender/blenkernel/intern/particle_distribute.c12
-rw-r--r--source/blender/blenkernel/intern/particle_system.c317
-rw-r--r--source/blender/blenkernel/intern/pbvh.c86
-rw-r--r--source/blender/blenkernel/intern/pbvh_bmesh.c14
-rw-r--r--source/blender/blenkernel/intern/pointcache.c29
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c4
-rw-r--r--source/blender/blenkernel/intern/scene.c164
-rw-r--r--source/blender/blenkernel/intern/seqcache.c23
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c7
-rw-r--r--source/blender/blenkernel/intern/sequencer.c122
-rw-r--r--source/blender/blenkernel/intern/shader_fx.c5
-rw-r--r--source/blender/blenkernel/intern/shrinkwrap.c33
-rw-r--r--source/blender/blenkernel/intern/softbody.c11
-rw-r--r--source/blender/blenkernel/intern/sound.c10
-rw-r--r--source/blender/blenkernel/intern/studiolight.c45
-rw-r--r--source/blender/blenkernel/intern/subdiv_displacement_multires.c9
-rw-r--r--source/blender/blenkernel/intern/subdiv_eval.c2
-rw-r--r--source/blender/blenkernel/intern/subdiv_foreach.c4
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c34
-rw-r--r--source/blender/blenkernel/intern/text.c37
-rw-r--r--source/blender/blenkernel/intern/texture.c4
-rw-r--r--source/blender/blenkernel/intern/tracking.c181
-rw-r--r--source/blender/blenkernel/intern/tracking_solver.c2
-rw-r--r--source/blender/blenkernel/intern/tracking_stabilize.c14
-rw-r--r--source/blender/blenkernel/intern/undo_system.c5
-rw-r--r--source/blender/blenkernel/intern/unit.c10
-rw-r--r--source/blender/blenkernel/intern/volume.cc25
-rw-r--r--source/blender/blenkernel/intern/volume_render.cc5
-rw-r--r--source/blender/blenkernel/intern/workspace.c12
86 files changed, 1521 insertions, 1792 deletions
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index 7c0e4064cdb..d8b4150b2b1 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -186,9 +186,8 @@ int BKE_camera_sensor_fit(int sensor_fit, float sizex, float sizey)
if (sizex >= sizey) {
return CAMERA_SENSOR_FIT_HOR;
}
- else {
- return CAMERA_SENSOR_FIT_VERT;
- }
+
+ return CAMERA_SENSOR_FIT_VERT;
}
return sensor_fit;
@@ -636,64 +635,63 @@ static bool camera_frame_fit_calc_from_data(CameraParams *params,
return true;
}
- else {
- float plane_isect_1[3], plane_isect_1_no[3], plane_isect_1_other[3];
- float plane_isect_2[3], plane_isect_2_no[3], plane_isect_2_other[3];
- float plane_isect_pt_1[3], plane_isect_pt_2[3];
+ float plane_isect_1[3], plane_isect_1_no[3], plane_isect_1_other[3];
+ float plane_isect_2[3], plane_isect_2_no[3], plane_isect_2_other[3];
- /* apply the dist-from-plane's to the transformed plane points */
- for (i = 0; i < CAMERA_VIEWFRAME_NUM_PLANES; i++) {
- float co[3];
- mul_v3_v3fl(co, data->normal_tx[i], sqrtf_signed(data->dist_vals_sq[i]));
- plane_from_point_normal_v3(plane_tx[i], co, data->normal_tx[i]);
- }
+ float plane_isect_pt_1[3], plane_isect_pt_2[3];
- if ((!isect_plane_plane_v3(plane_tx[0], plane_tx[2], plane_isect_1, plane_isect_1_no)) ||
- (!isect_plane_plane_v3(plane_tx[1], plane_tx[3], plane_isect_2, plane_isect_2_no))) {
- return false;
- }
+ /* apply the dist-from-plane's to the transformed plane points */
+ for (i = 0; i < CAMERA_VIEWFRAME_NUM_PLANES; i++) {
+ float co[3];
+ mul_v3_v3fl(co, data->normal_tx[i], sqrtf_signed(data->dist_vals_sq[i]));
+ plane_from_point_normal_v3(plane_tx[i], co, data->normal_tx[i]);
+ }
- add_v3_v3v3(plane_isect_1_other, plane_isect_1, plane_isect_1_no);
- add_v3_v3v3(plane_isect_2_other, plane_isect_2, plane_isect_2_no);
+ if ((!isect_plane_plane_v3(plane_tx[0], plane_tx[2], plane_isect_1, plane_isect_1_no)) ||
+ (!isect_plane_plane_v3(plane_tx[1], plane_tx[3], plane_isect_2, plane_isect_2_no))) {
+ return false;
+ }
- if (isect_line_line_v3(plane_isect_1,
- plane_isect_1_other,
- plane_isect_2,
- plane_isect_2_other,
- plane_isect_pt_1,
- plane_isect_pt_2) != 0) {
- float cam_plane_no[3];
- float plane_isect_delta[3];
- float plane_isect_delta_len;
+ add_v3_v3v3(plane_isect_1_other, plane_isect_1, plane_isect_1_no);
+ add_v3_v3v3(plane_isect_2_other, plane_isect_2, plane_isect_2_no);
- float shift_fac = BKE_camera_sensor_size(
- params->sensor_fit, params->sensor_x, params->sensor_y) /
- params->lens;
+ if (isect_line_line_v3(plane_isect_1,
+ plane_isect_1_other,
+ plane_isect_2,
+ plane_isect_2_other,
+ plane_isect_pt_1,
+ plane_isect_pt_2) != 0) {
+ float cam_plane_no[3];
+ float plane_isect_delta[3];
+ float plane_isect_delta_len;
- /* we want (0, 0, -1) transformed by camera_rotmat, this is a quicker shortcut. */
- negate_v3_v3(cam_plane_no, data->camera_rotmat[2]);
+ float shift_fac = BKE_camera_sensor_size(
+ params->sensor_fit, params->sensor_x, params->sensor_y) /
+ params->lens;
- sub_v3_v3v3(plane_isect_delta, plane_isect_pt_2, plane_isect_pt_1);
- plane_isect_delta_len = len_v3(plane_isect_delta);
+ /* we want (0, 0, -1) transformed by camera_rotmat, this is a quicker shortcut. */
+ negate_v3_v3(cam_plane_no, data->camera_rotmat[2]);
- if (dot_v3v3(plane_isect_delta, cam_plane_no) > 0.0f) {
- copy_v3_v3(r_co, plane_isect_pt_1);
+ sub_v3_v3v3(plane_isect_delta, plane_isect_pt_2, plane_isect_pt_1);
+ plane_isect_delta_len = len_v3(plane_isect_delta);
- /* offset shift */
- normalize_v3(plane_isect_1_no);
- madd_v3_v3fl(r_co, plane_isect_1_no, params->shifty * plane_isect_delta_len * shift_fac);
- }
- else {
- copy_v3_v3(r_co, plane_isect_pt_2);
+ if (dot_v3v3(plane_isect_delta, cam_plane_no) > 0.0f) {
+ copy_v3_v3(r_co, plane_isect_pt_1);
- /* offset shift */
- normalize_v3(plane_isect_2_no);
- madd_v3_v3fl(r_co, plane_isect_2_no, params->shiftx * plane_isect_delta_len * shift_fac);
- }
+ /* offset shift */
+ normalize_v3(plane_isect_1_no);
+ madd_v3_v3fl(r_co, plane_isect_1_no, params->shifty * plane_isect_delta_len * shift_fac);
+ }
+ else {
+ copy_v3_v3(r_co, plane_isect_pt_2);
- return true;
+ /* offset shift */
+ normalize_v3(plane_isect_2_no);
+ madd_v3_v3fl(r_co, plane_isect_2_no, params->shiftx * plane_isect_delta_len * shift_fac);
}
+
+ return true;
}
return false;
@@ -775,11 +773,10 @@ static void camera_stereo3d_model_matrix(const Object *camera,
camera_model_matrix(camera, r_modelmat);
return;
}
- else {
- float size[3];
- mat4_to_size(size, camera->obmat);
- size_to_mat4(sizemat, size);
- }
+
+ float size[3];
+ mat4_to_size(size, camera->obmat);
+ size_to_mat4(sizemat, size);
if (pivot == CAM_S3D_PIVOT_CENTER) {
fac = 0.5f;
@@ -931,9 +928,8 @@ bool BKE_camera_multiview_spherical_stereo(const RenderData *rd, const Object *c
if (camera->type != OB_CAMERA) {
return false;
}
- else {
- cam = camera->data;
- }
+
+ cam = camera->data;
if ((rd->views_format == SCE_VIEWS_FORMAT_STEREO_3D) && ELEM(cam->type, CAM_PANO, CAM_PERSP) &&
((cam->stereo.flag & CAM_S3D_SPHERICAL) != 0)) {
@@ -984,13 +980,12 @@ Object *BKE_camera_multiview_render(const Scene *scene, Object *camera, const ch
if (!is_multiview) {
return camera;
}
- else if (scene->r.views_format == SCE_VIEWS_FORMAT_STEREO_3D) {
+ if (scene->r.views_format == SCE_VIEWS_FORMAT_STEREO_3D) {
return camera;
}
- else { /* SCE_VIEWS_FORMAT_MULTIVIEW */
- const char *suffix = BKE_scene_multiview_view_suffix_get(&scene->r, viewname);
- return camera_multiview_advanced(scene, camera, suffix);
- }
+ /* SCE_VIEWS_FORMAT_MULTIVIEW */
+ const char *suffix = BKE_scene_multiview_view_suffix_get(&scene->r, viewname);
+ return camera_multiview_advanced(scene, camera, suffix);
}
static float camera_stereo3d_shift_x(const Object *camera, const char *viewname)
@@ -1044,12 +1039,11 @@ float BKE_camera_multiview_shift_x(const RenderData *rd,
if (!is_multiview) {
return data->shiftx;
}
- else if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW) {
+ if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW) {
return data->shiftx;
}
- else { /* SCE_VIEWS_SETUP_BASIC */
- return camera_stereo3d_shift_x(camera, viewname);
- }
+ /* SCE_VIEWS_SETUP_BASIC */
+ return camera_stereo3d_shift_x(camera, viewname);
}
void BKE_camera_multiview_params(const RenderData *rd,
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 6118325c231..6d2432f53e4 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -540,9 +540,8 @@ const char *BKE_collection_ui_name_get(struct Collection *collection)
if (collection->flag & COLLECTION_IS_MASTER) {
return IFACE_("Scene Collection");
}
- else {
- return collection->id.name + 2;
- }
+
+ return collection->id.name + 2;
}
/** \} */
@@ -617,9 +616,8 @@ Base *BKE_collection_or_layer_objects(const ViewLayer *view_layer, Collection *c
if (collection) {
return BKE_collection_object_cache_get(collection).first;
}
- else {
- return FIRSTBASE(view_layer);
- }
+
+ return FIRSTBASE(view_layer);
}
/** \} */
@@ -671,14 +669,13 @@ static bool collection_object_cyclic_check_internal(Object *object, Collection *
if (dup_collection == collection) {
return true;
}
- else {
- FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (dup_collection, collection_object) {
- if (collection_object_cyclic_check_internal(collection_object, dup_collection)) {
- return true;
- }
+
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (dup_collection, collection_object) {
+ if (collection_object_cyclic_check_internal(collection_object, dup_collection)) {
+ return true;
}
- FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
}
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
/* un-flag the object, it's allowed to have the same collection multiple times in parallel */
dup_collection->id.tag |= LIB_TAG_DOIT;
@@ -725,9 +722,8 @@ static Collection *collection_next_find(Main *bmain, Scene *scene, Collection *c
if (scene && collection == scene->master_collection) {
return bmain->collections.first;
}
- else {
- return collection->id.next;
- }
+
+ return collection->id.next;
}
Collection *BKE_collection_object_find(Main *bmain,
@@ -1510,9 +1506,8 @@ bool BKE_collection_objects_select(ViewLayer *view_layer, Collection *collection
if (layer_collection != NULL) {
return BKE_layer_collection_objects_select(view_layer, layer_collection, deselect);
}
- else {
- return collection_objects_select(view_layer, collection, deselect);
- }
+
+ return collection_objects_select(view_layer, collection, deselect);
}
/** \} */
diff --git a/source/blender/blenkernel/intern/colorband.c b/source/blender/blenkernel/intern/colorband.c
index 499b0305c9d..323a2f0cf53 100644
--- a/source/blender/blenkernel/intern/colorband.c
+++ b/source/blender/blenkernel/intern/colorband.c
@@ -587,7 +587,7 @@ static int vergcband(const void *a1, const void *a2)
if (x1->pos > x2->pos) {
return 1;
}
- else if (x1->pos < x2->pos) {
+ if (x1->pos < x2->pos) {
return -1;
}
return 0;
@@ -620,18 +620,17 @@ CBData *BKE_colorband_element_add(struct ColorBand *coba, float position)
if (coba->tot == MAXCOLORBAND) {
return NULL;
}
- else {
- CBData *xnew;
- xnew = &coba->data[coba->tot];
- xnew->pos = position;
+ CBData *xnew;
- if (coba->tot != 0) {
- BKE_colorband_evaluate(coba, position, &xnew->r);
- }
- else {
- zero_v4(&xnew->r);
- }
+ xnew = &coba->data[coba->tot];
+ xnew->pos = position;
+
+ if (coba->tot != 0) {
+ BKE_colorband_evaluate(coba, position, &xnew->r);
+ }
+ else {
+ zero_v4(&xnew->r);
}
coba->tot++;
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index fc326ffb390..11928dada2b 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -603,28 +603,24 @@ static float curvemap_calc_extend(const CurveMapping *cumap,
/* extrapolate horizontally */
return first[1];
}
- else {
- if (cuma->ext_in[0] == 0.0f) {
- return first[1] + cuma->ext_in[1] * 10000.0f;
- }
- else {
- return first[1] + cuma->ext_in[1] * (x - first[0]) / cuma->ext_in[0];
- }
+
+ if (cuma->ext_in[0] == 0.0f) {
+ return first[1] + cuma->ext_in[1] * 10000.0f;
}
+
+ return first[1] + cuma->ext_in[1] * (x - first[0]) / cuma->ext_in[0];
}
- else if (x >= last[0]) {
+ if (x >= last[0]) {
if ((cumap->flag & CUMA_EXTEND_EXTRAPOLATE) == 0) {
/* extrapolate horizontally */
return last[1];
}
- else {
- if (cuma->ext_out[0] == 0.0f) {
- return last[1] - cuma->ext_out[1] * 10000.0f;
- }
- else {
- return last[1] + cuma->ext_out[1] * (x - last[0]) / cuma->ext_out[0];
- }
+
+ if (cuma->ext_out[0] == 0.0f) {
+ return last[1] - cuma->ext_out[1] * 10000.0f;
}
+
+ return last[1] + cuma->ext_out[1] * (x - last[0]) / cuma->ext_out[0];
}
return 0.0f;
}
@@ -870,7 +866,7 @@ static int sort_curvepoints(const void *a1, const void *a2)
if (x1->x > x2->x) {
return 1;
}
- else if (x1->x < x2->x) {
+ if (x1->x < x2->x) {
return -1;
}
return 0;
@@ -984,17 +980,16 @@ float BKE_curvemap_evaluateF(const CurveMapping *cumap, const CurveMap *cuma, fl
if (fi < 0.0f || fi > CM_TABLE) {
return curvemap_calc_extend(cumap, cuma, value, &cuma->table[0].x, &cuma->table[CM_TABLE].x);
}
- else {
- if (i < 0) {
- return cuma->table[0].y;
- }
- if (i >= CM_TABLE) {
- return cuma->table[CM_TABLE].y;
- }
- fi = fi - (float)i;
- return (1.0f - fi) * cuma->table[i].y + (fi)*cuma->table[i + 1].y;
+ if (i < 0) {
+ return cuma->table[0].y;
}
+ if (i >= CM_TABLE) {
+ return cuma->table[CM_TABLE].y;
+ }
+
+ fi = fi - (float)i;
+ return (1.0f - fi) * cuma->table[i].y + (fi)*cuma->table[i + 1].y;
}
/* works with curve 'cur' */
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 2ef32895db9..2bd8713a292 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -5284,9 +5284,8 @@ const bConstraintTypeInfo *BKE_constraint_typeinfo_from_type(int type)
/* there shouldn't be any segfaults here... */
return constraintsTypeInfo[type];
}
- else {
- CLOG_WARN(&LOG, "No valid constraint type-info data available. Type = %i", type);
- }
+
+ CLOG_WARN(&LOG, "No valid constraint type-info data available. Type = %i", type);
return NULL;
}
@@ -5300,9 +5299,8 @@ const bConstraintTypeInfo *BKE_constraint_typeinfo_get(bConstraint *con)
if (con) {
return BKE_constraint_typeinfo_from_type(con->type);
}
- else {
- return NULL;
- }
+
+ return NULL;
}
/* ************************* General Constraints API ************************** */
@@ -5384,9 +5382,8 @@ bool BKE_constraint_remove(ListBase *list, bConstraint *con)
BLI_freelinkN(list, con);
return true;
}
- else {
- return false;
- }
+
+ return false;
}
bool BKE_constraint_remove_ex(ListBase *list, Object *ob, bConstraint *con, bool clear_dep)
@@ -5399,9 +5396,8 @@ bool BKE_constraint_remove_ex(ListBase *list, Object *ob, bConstraint *con, bool
}
return true;
}
- else {
- return false;
- }
+
+ return false;
}
/* ......... */
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 30f021b0e81..e9ba3a5f873 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -255,13 +255,12 @@ static void *ctx_wm_python_context_get(const bContext *C,
if (RNA_struct_is_a(result.ptr.type, member_type)) {
return result.ptr.data;
}
- else {
- CLOG_WARN(&LOG,
- "PyContext '%s' is a '%s', expected a '%s'",
- member,
- RNA_struct_identifier(result.ptr.type),
- RNA_struct_identifier(member_type));
- }
+
+ CLOG_WARN(&LOG,
+ "PyContext '%s' is a '%s', expected a '%s'",
+ member,
+ RNA_struct_identifier(result.ptr.type),
+ RNA_struct_identifier(member_type));
}
}
#else
@@ -360,9 +359,8 @@ static void *ctx_data_pointer_get(const bContext *C, const char *member)
BLI_assert(result.type == CTX_DATA_TYPE_POINTER);
return result.ptr.data;
}
- else {
- return NULL;
- }
+
+ return NULL;
}
static int ctx_data_pointer_verify(const bContext *C, const char *member, void **pointer)
@@ -374,15 +372,14 @@ static int ctx_data_pointer_verify(const bContext *C, const char *member, void *
*pointer = NULL;
return 1;
}
- else if (ctx_data_get((bContext *)C, member, &result) == 1) {
+ if (ctx_data_get((bContext *)C, member, &result) == 1) {
BLI_assert(result.type == CTX_DATA_TYPE_POINTER);
*pointer = result.ptr.data;
return 1;
}
- else {
- *pointer = NULL;
- return 0;
- }
+
+ *pointer = NULL;
+ return 0;
}
static int ctx_data_collection_get(const bContext *C, const char *member, ListBase *list)
@@ -441,9 +438,8 @@ PointerRNA CTX_data_pointer_get(const bContext *C, const char *member)
BLI_assert(result.type == CTX_DATA_TYPE_POINTER);
return result.ptr;
}
- else {
- return PointerRNA_NULL;
- }
+
+ return PointerRNA_NULL;
}
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
@@ -454,13 +450,12 @@ PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, Stru
if (RNA_struct_is_a(ptr.type, type)) {
return ptr;
}
- else {
- CLOG_WARN(&LOG,
- "member '%s' is '%s', not '%s'",
- member,
- RNA_struct_identifier(ptr.type),
- RNA_struct_identifier(type));
- }
+
+ CLOG_WARN(&LOG,
+ "member '%s' is '%s', not '%s'",
+ member,
+ RNA_struct_identifier(ptr.type),
+ RNA_struct_identifier(type));
}
return PointerRNA_NULL;
@@ -473,9 +468,8 @@ PointerRNA CTX_data_pointer_get_type_silent(const bContext *C, const char *membe
if (ptr.data && RNA_struct_is_a(ptr.type, type)) {
return ptr;
}
- else {
- return PointerRNA_NULL;
- }
+
+ return PointerRNA_NULL;
}
ListBase CTX_data_collection_get(const bContext *C, const char *member)
@@ -486,10 +480,9 @@ ListBase CTX_data_collection_get(const bContext *C, const char *member)
BLI_assert(result.type == CTX_DATA_TYPE_COLLECTION);
return result.list;
}
- else {
- ListBase list = {NULL, NULL};
- return list;
- }
+
+ ListBase list = {NULL, NULL};
+ return list;
}
/* 1:found, -1:found but not set, 0:not found */
@@ -667,9 +660,8 @@ int ctx_data_list_count(const bContext *C, int (*func)(const bContext *, ListBas
BLI_freelistN(&list);
return tot;
}
- else {
- return 0;
- }
+
+ return 0;
}
void CTX_data_dir_set(bContextDataResult *result, const char **dir)
@@ -985,9 +977,8 @@ Main *CTX_data_main(const bContext *C)
if (ctx_data_pointer_verify(C, "blend_data", (void *)&bmain)) {
return bmain;
}
- else {
- return C->data.main;
- }
+
+ return C->data.main;
}
void CTX_data_main_set(bContext *C, Main *bmain)
@@ -1003,9 +994,8 @@ Scene *CTX_data_scene(const bContext *C)
if (ctx_data_pointer_verify(C, "scene", (void *)&scene)) {
return scene;
}
- else {
- return C->data.scene;
- }
+
+ return C->data.scene;
}
ViewLayer *CTX_data_view_layer(const bContext *C)
@@ -1102,34 +1092,34 @@ enum eContextObjectMode CTX_data_mode_enum_ex(const Object *obedit,
if (object_mode & OB_MODE_POSE) {
return CTX_MODE_POSE;
}
- else if (object_mode & OB_MODE_SCULPT) {
+ if (object_mode & OB_MODE_SCULPT) {
return CTX_MODE_SCULPT;
}
- else if (object_mode & OB_MODE_WEIGHT_PAINT) {
+ if (object_mode & OB_MODE_WEIGHT_PAINT) {
return CTX_MODE_PAINT_WEIGHT;
}
- else if (object_mode & OB_MODE_VERTEX_PAINT) {
+ if (object_mode & OB_MODE_VERTEX_PAINT) {
return CTX_MODE_PAINT_VERTEX;
}
- else if (object_mode & OB_MODE_TEXTURE_PAINT) {
+ if (object_mode & OB_MODE_TEXTURE_PAINT) {
return CTX_MODE_PAINT_TEXTURE;
}
- else if (object_mode & OB_MODE_PARTICLE_EDIT) {
+ if (object_mode & OB_MODE_PARTICLE_EDIT) {
return CTX_MODE_PARTICLE;
}
- else if (object_mode & OB_MODE_PAINT_GPENCIL) {
+ if (object_mode & OB_MODE_PAINT_GPENCIL) {
return CTX_MODE_PAINT_GPENCIL;
}
- else if (object_mode & OB_MODE_EDIT_GPENCIL) {
+ if (object_mode & OB_MODE_EDIT_GPENCIL) {
return CTX_MODE_EDIT_GPENCIL;
}
- else if (object_mode & OB_MODE_SCULPT_GPENCIL) {
+ if (object_mode & OB_MODE_SCULPT_GPENCIL) {
return CTX_MODE_SCULPT_GPENCIL;
}
- else if (object_mode & OB_MODE_WEIGHT_GPENCIL) {
+ if (object_mode & OB_MODE_WEIGHT_GPENCIL) {
return CTX_MODE_WEIGHT_GPENCIL;
}
- else if (object_mode & OB_MODE_VERTEX_GPENCIL) {
+ if (object_mode & OB_MODE_VERTEX_GPENCIL) {
return CTX_MODE_VERTEX_GPENCIL;
}
}
@@ -1173,9 +1163,8 @@ ToolSettings *CTX_data_tool_settings(const bContext *C)
if (scene) {
return scene->toolsettings;
}
- else {
- return NULL;
- }
+
+ return NULL;
}
int CTX_data_selected_nodes(const bContext *C, ListBase *list)
diff --git a/source/blender/blenkernel/intern/curveprofile.c b/source/blender/blenkernel/intern/curveprofile.c
index 0a41529aac1..0c9b71fad5d 100644
--- a/source/blender/blenkernel/intern/curveprofile.c
+++ b/source/blender/blenkernel/intern/curveprofile.c
@@ -689,9 +689,8 @@ static int sort_points_curvature(const void *in_a, const void *in_b)
if (a->bezt_curvature > b->bezt_curvature) {
return 0;
}
- else {
- return 1;
- }
+
+ return 1;
}
/**
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 7ddb0a6862d..0c1717ea184 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -771,7 +771,7 @@ static void layerCopyValue_mloopcol(const void *source,
if (mixmode == CDT_MIX_REPLACE_ABOVE_THRESHOLD && f < mixfactor) {
return; /* Do Nothing! */
}
- else if (mixmode == CDT_MIX_REPLACE_BELOW_THRESHOLD && f > mixfactor) {
+ if (mixmode == CDT_MIX_REPLACE_BELOW_THRESHOLD && f > mixfactor) {
return; /* Do Nothing! */
}
}
@@ -1358,7 +1358,7 @@ static void layerCopyValue_propcol(const void *source,
if (mixmode == CDT_MIX_REPLACE_ABOVE_THRESHOLD && f < mixfactor) {
return; /* Do Nothing! */
}
- else if (mixmode == CDT_MIX_REPLACE_BELOW_THRESHOLD && f > mixfactor) {
+ if (mixmode == CDT_MIX_REPLACE_BELOW_THRESHOLD && f > mixfactor) {
return; /* Do Nothing! */
}
}
@@ -2201,13 +2201,13 @@ bool CustomData_merge(const struct CustomData *source,
if (flag & CD_FLAG_NOCOPY) {
continue;
}
- else if (!(mask & CD_TYPE_AS_MASK(type))) {
+ if (!(mask & CD_TYPE_AS_MASK(type))) {
continue;
}
- else if ((maxnumber != -1) && (number >= maxnumber)) {
+ if ((maxnumber != -1) && (number >= maxnumber)) {
continue;
}
- else if (CustomData_get_named_layer_index(dest, type, layer->name) != -1) {
+ if (CustomData_get_named_layer_index(dest, type, layer->name) != -1) {
continue;
}
@@ -4052,9 +4052,8 @@ bool CustomData_data_equals(int type, const void *data1, const void *data2)
if (typeInfo->equal) {
return typeInfo->equal(data1, data2);
}
- else {
- return !memcmp(data1, data2, typeInfo->size);
- }
+
+ return !memcmp(data1, data2, typeInfo->size);
}
void CustomData_data_initminmax(int type, void *min, void *max)
@@ -4411,7 +4410,7 @@ int CustomData_layertype_layers_max(const int type)
if (typeInfo->defaultname == NULL) {
return 1;
}
- else if (typeInfo->layers_max == NULL) {
+ if (typeInfo->layers_max == NULL) {
return -1;
}
diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c
index 1463e50f6e3..4fa232a368b 100644
--- a/source/blender/blenkernel/intern/customdata_file.c
+++ b/source/blender/blenkernel/intern/customdata_file.c
@@ -101,9 +101,8 @@ static int cdf_endian(void)
if (ENDIAN_ORDER == L_ENDIAN) {
return CDF_ENDIAN_LITTLE;
}
- else {
- return CDF_ENDIAN_BIG;
- }
+
+ return CDF_ENDIAN_BIG;
}
CDataFile *cdf_create(int type)
@@ -318,9 +317,8 @@ bool cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay)
if (&cdf->layer[a] == blay) {
break;
}
- else {
- offset += cdf->layer[a].datasize;
- }
+
+ offset += cdf->layer[a].datasize;
}
return (fseek(cdf->readf, offset, SEEK_SET) == 0);
diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c
index 7bf87d0e639..179f2f44180 100644
--- a/source/blender/blenkernel/intern/data_transfer.c
+++ b/source/blender/blenkernel/intern/data_transfer.c
@@ -961,7 +961,7 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
}
return true;
}
- else if (cddata_type == CD_FAKE_BWEIGHT) {
+ if (cddata_type == CD_FAKE_BWEIGHT) {
const size_t elem_size = sizeof(*((MVert *)NULL));
const size_t data_size = sizeof(((MVert *)NULL)->bweight);
const size_t data_offset = offsetof(MVert, bweight);
@@ -993,7 +993,7 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
}
return true;
}
- else if (cddata_type == CD_FAKE_MDEFORMVERT) {
+ if (cddata_type == CD_FAKE_MDEFORMVERT) {
bool ret;
cd_src = &me_src->vdata;
@@ -1018,7 +1018,7 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
me_dst->dvert = CustomData_get_layer(&me_dst->vdata, CD_MDEFORMVERT);
return ret;
}
- else if (cddata_type == CD_FAKE_SHAPEKEY) {
+ if (cddata_type == CD_FAKE_SHAPEKEY) {
/* TODO: leaving shapekeys aside for now, quite specific case,
* since we can't access them from MVert :/ */
return false;
@@ -1049,7 +1049,7 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
}
return true;
}
- else if (cddata_type == CD_FAKE_CREASE) {
+ if (cddata_type == CD_FAKE_CREASE) {
const size_t elem_size = sizeof(*((MEdge *)NULL));
const size_t data_size = sizeof(((MEdge *)NULL)->crease);
const size_t data_offset = offsetof(MEdge, crease);
@@ -1081,7 +1081,7 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
}
return true;
}
- else if (cddata_type == CD_FAKE_BWEIGHT) {
+ if (cddata_type == CD_FAKE_BWEIGHT) {
const size_t elem_size = sizeof(*((MEdge *)NULL));
const size_t data_size = sizeof(((MEdge *)NULL)->bweight);
const size_t data_offset = offsetof(MEdge, bweight);
@@ -1113,7 +1113,7 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
}
return true;
}
- else if (r_map && ELEM(cddata_type, CD_FAKE_SHARP, CD_FAKE_SEAM)) {
+ if (r_map && ELEM(cddata_type, CD_FAKE_SHARP, CD_FAKE_SEAM)) {
const size_t elem_size = sizeof(*((MEdge *)NULL));
const size_t data_size = sizeof(((MEdge *)NULL)->flag);
const size_t data_offset = offsetof(MEdge, flag);
@@ -1136,9 +1136,8 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
interp_data);
return true;
}
- else {
- return false;
- }
+
+ return false;
}
else if (elem_type == ME_LOOP) {
if (cddata_type == CD_FAKE_UV) {
@@ -1176,9 +1175,8 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
}
return true;
}
- else {
- return false;
- }
+
+ return false;
}
else if (elem_type == ME_POLY) {
if (cddata_type == CD_FAKE_UV) {
@@ -1209,7 +1207,7 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
}
return true;
}
- else if (r_map && cddata_type == CD_FAKE_SHARP) {
+ if (r_map && cddata_type == CD_FAKE_SHARP) {
const size_t elem_size = sizeof(*((MPoly *)NULL));
const size_t data_size = sizeof(((MPoly *)NULL)->flag);
const size_t data_offset = offsetof(MPoly, flag);
@@ -1232,9 +1230,8 @@ static bool data_transfer_layersmapping_generate(ListBase *r_map,
interp_data);
return true;
}
- else {
- return false;
- }
+
+ return false;
}
return false;
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 98fc5f9a23a..1a32deac776 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -510,36 +510,35 @@ int *BKE_object_defgroup_flip_map(const Object *ob, int *flip_map_len, const boo
if (defbase_tot == 0) {
return NULL;
}
- else {
- bDeformGroup *dg;
- char name_flip[sizeof(dg->name)];
- int i, flip_num, *map = MEM_mallocN(defbase_tot * sizeof(int), __func__);
- for (i = 0; i < defbase_tot; i++) {
- map[i] = -1;
- }
+ bDeformGroup *dg;
+ char name_flip[sizeof(dg->name)];
+ int i, flip_num, *map = MEM_mallocN(defbase_tot * sizeof(int), __func__);
- for (dg = ob->defbase.first, i = 0; dg; dg = dg->next, i++) {
- if (map[i] == -1) { /* may be calculated previously */
+ for (i = 0; i < defbase_tot; i++) {
+ map[i] = -1;
+ }
- /* in case no valid value is found, use this */
- if (use_default) {
- map[i] = i;
- }
+ for (dg = ob->defbase.first, i = 0; dg; dg = dg->next, i++) {
+ if (map[i] == -1) { /* may be calculated previously */
- BLI_string_flip_side_name(name_flip, dg->name, false, sizeof(name_flip));
+ /* in case no valid value is found, use this */
+ if (use_default) {
+ map[i] = i;
+ }
- if (!STREQ(name_flip, dg->name)) {
- flip_num = BKE_object_defgroup_name_index(ob, name_flip);
- if (flip_num >= 0) {
- map[i] = flip_num;
- map[flip_num] = i; /* save an extra lookup */
- }
+ BLI_string_flip_side_name(name_flip, dg->name, false, sizeof(name_flip));
+
+ if (!STREQ(name_flip, dg->name)) {
+ flip_num = BKE_object_defgroup_name_index(ob, name_flip);
+ if (flip_num >= 0) {
+ map[i] = flip_num;
+ map[flip_num] = i; /* save an extra lookup */
}
}
}
- return map;
}
+ return map;
}
/**
@@ -555,29 +554,28 @@ int *BKE_object_defgroup_flip_map_single(const Object *ob,
if (defbase_tot == 0) {
return NULL;
}
- else {
- bDeformGroup *dg;
- char name_flip[sizeof(dg->name)];
- int i, flip_num, *map = MEM_mallocN(defbase_tot * sizeof(int), __func__);
- for (i = 0; i < defbase_tot; i++) {
- map[i] = use_default ? i : -1;
- }
+ bDeformGroup *dg;
+ char name_flip[sizeof(dg->name)];
+ int i, flip_num, *map = MEM_mallocN(defbase_tot * sizeof(int), __func__);
- dg = BLI_findlink(&ob->defbase, defgroup);
+ for (i = 0; i < defbase_tot; i++) {
+ map[i] = use_default ? i : -1;
+ }
- BLI_string_flip_side_name(name_flip, dg->name, false, sizeof(name_flip));
- if (!STREQ(name_flip, dg->name)) {
- flip_num = BKE_object_defgroup_name_index(ob, name_flip);
+ dg = BLI_findlink(&ob->defbase, defgroup);
- if (flip_num != -1) {
- map[defgroup] = flip_num;
- map[flip_num] = defgroup;
- }
- }
+ BLI_string_flip_side_name(name_flip, dg->name, false, sizeof(name_flip));
+ if (!STREQ(name_flip, dg->name)) {
+ flip_num = BKE_object_defgroup_name_index(ob, name_flip);
- return map;
+ if (flip_num != -1) {
+ map[defgroup] = flip_num;
+ map[flip_num] = defgroup;
+ }
}
+
+ return map;
}
int BKE_object_defgroup_flip_index(const Object *ob, int index, const bool use_default)
@@ -658,7 +656,7 @@ float BKE_defvert_array_find_weight_safe(const struct MDeformVert *dvert,
if (defgroup == -1) {
return 1.0f;
}
- else if (dvert == NULL) {
+ if (dvert == NULL) {
return 0.0f;
}
@@ -909,10 +907,9 @@ float BKE_defvert_calc_lock_relative_weight(float weight,
if (weight != 0.0f) {
return 1.0f;
}
- else {
- /* resolve 0/0 to 0 */
- return 0.0f;
- }
+
+ /* resolve 0/0 to 0 */
+ return 0.0f;
}
/* non-degenerate division */
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 7b7b7ceb84b..62fb7a937b2 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -320,7 +320,7 @@ static int dynamicPaint_surfaceNumOfPoints(DynamicPaintSurface *surface)
if (surface->format == MOD_DPAINT_SURFACE_F_PTEX) {
return 0; /* not supported atm */
}
- else if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
+ if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
const Mesh *canvas_mesh = dynamicPaint_canvas_mesh_get(surface->canvas);
return (canvas_mesh) ? canvas_mesh->totvert : 0;
}
@@ -353,7 +353,7 @@ bool dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface, Object
Mesh *me = ob->data;
return (CustomData_get_named_layer_index(&me->ldata, CD_MLOOPCOL, name) != -1);
}
- else if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) {
+ if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) {
return (BKE_object_defgroup_name_index(ob, name) != -1);
}
}
@@ -3742,7 +3742,7 @@ static bool meshBrush_boundsIntersect(Bounds3D *b1,
if (brush->collision == MOD_DPAINT_COL_VOLUME) {
return boundsIntersect(b1, b2);
}
- else if (brush->collision == MOD_DPAINT_COL_DIST || brush->collision == MOD_DPAINT_COL_VOLDIST) {
+ if (brush->collision == MOD_DPAINT_COL_DIST || brush->collision == MOD_DPAINT_COL_VOLDIST) {
return boundsIntersectDist(b1, b2, brush_radius);
}
return true;
diff --git a/source/blender/blenkernel/intern/editmesh_cache.c b/source/blender/blenkernel/intern/editmesh_cache.c
index 5017a48d14e..d0509c94fc6 100644
--- a/source/blender/blenkernel/intern/editmesh_cache.c
+++ b/source/blender/blenkernel/intern/editmesh_cache.c
@@ -148,11 +148,10 @@ bool BKE_editmesh_cache_calc_minmax(struct BMEditMesh *em,
}
return true;
}
- else {
- zero_v3(min);
- zero_v3(max);
- return false;
- }
+
+ zero_v3(min);
+ zero_v3(max);
+ return false;
}
/** \} */
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index a43553ee89f..97f9cebf58b 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -313,10 +313,10 @@ ListBase *BKE_effectors_create(Depsgraph *depsgraph,
if (ob == ob_src) {
continue;
}
- else if (weights->weight[ob->pd->forcefield] == 0.0f) {
+ if (weights->weight[ob->pd->forcefield] == 0.0f) {
continue;
}
- else if (ob->pd->shape == PFIELD_SHAPE_POINTS && BKE_object_get_evaluated_mesh(ob) == NULL) {
+ if (ob->pd->shape == PFIELD_SHAPE_POINTS && BKE_object_get_evaluated_mesh(ob) == NULL) {
continue;
}
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index acbbf50701a..abed90e7192 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -320,7 +320,7 @@ int BKE_fcurves_filter(ListBase *dst, ListBase *src, const char *dataPrefix, con
if (ELEM(NULL, dst, src, dataPrefix, dataName)) {
return 0;
}
- else if ((dataPrefix[0] == 0) || (dataName[0] == 0)) {
+ if ((dataPrefix[0] == 0) || (dataName[0] == 0)) {
return 0;
}
@@ -915,7 +915,7 @@ void bezt_add_to_cfra_elem(ListBase *lb, BezTriple *bezt)
return;
}
/* should key be inserted before this column? */
- else if (ce->cfra > bezt->vec[1][0]) {
+ if (ce->cfra > bezt->vec[1][0]) {
break;
}
}
diff --git a/source/blender/blenkernel/intern/fcurve_driver.c b/source/blender/blenkernel/intern/fcurve_driver.c
index 87cb77930f5..b11a3cb9457 100644
--- a/source/blender/blenkernel/intern/fcurve_driver.c
+++ b/source/blender/blenkernel/intern/fcurve_driver.c
@@ -488,10 +488,9 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
dtar->flag |= DTAR_FLAG_INVALID;
return 0.0f;
}
- else {
- /* Target should be valid now. */
- dtar->flag &= ~DTAR_FLAG_INVALID;
- }
+
+ /* Target should be valid now. */
+ dtar->flag &= ~DTAR_FLAG_INVALID;
/* Try to get pose-channel. */
pchan = BKE_pose_channel_find_name(ob->pose, dtar->pchan_name);
@@ -560,20 +559,17 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
/* Not valid channel. */
return 0.0f;
}
- else if (dtar->transChan == DTAR_TRANSCHAN_SCALE_AVG) {
+ if (dtar->transChan == DTAR_TRANSCHAN_SCALE_AVG) {
/* Cubic root of the change in volume, equal to the geometric mean
* of scale over all three axes unless the matrix includes shear. */
return cbrtf(mat4_to_volume_scale(mat));
}
- else if (ELEM(dtar->transChan,
- DTAR_TRANSCHAN_SCALEX,
- DTAR_TRANSCHAN_SCALEY,
- DTAR_TRANSCHAN_SCALEZ)) {
+ if (ELEM(dtar->transChan, DTAR_TRANSCHAN_SCALEX, DTAR_TRANSCHAN_SCALEY, DTAR_TRANSCHAN_SCALEZ)) {
/* Extract scale, and choose the right axis,
* inline 'mat4_to_size'. */
return len_v3(mat[dtar->transChan - DTAR_TRANSCHAN_SCALEX]);
}
- else if (dtar->transChan >= DTAR_TRANSCHAN_ROTX) {
+ if (dtar->transChan >= DTAR_TRANSCHAN_ROTX) {
/* Extract rotation as eulers (if needed)
* - definitely if rotation order isn't eulers already
* - if eulers, then we have 2 options:
@@ -602,10 +598,9 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
return quat[channel];
}
- else {
- /* Extract location and choose right axis. */
- return mat[3][dtar->transChan];
- }
+
+ /* Extract location and choose right axis. */
+ return mat[3][dtar->transChan];
}
/* Convert a quaternion to pseudo-angles representing the weighted amount of rotation. */
@@ -715,9 +710,8 @@ static const DriverVarTypeInfo *get_dvar_typeinfo(int type)
if ((type >= 0) && (type < MAX_DVAR_TYPES)) {
return &dvar_types[type];
}
- else {
- return NULL;
- }
+
+ return NULL;
}
/** \} */
@@ -1126,10 +1120,9 @@ bool BKE_driver_expression_depends_on_time(ChannelDriver *driver)
/* Simple expressions can be checked exactly. */
return driver_check_simple_expr_depends_on_time(driver->expr_simple);
}
- else {
- /* Otherwise, heuristically scan the expression string for certain patterns. */
- return python_driver_exression_depends_on_time(driver->expression);
- }
+
+ /* Otherwise, heuristically scan the expression string for certain patterns. */
+ return python_driver_exression_depends_on_time(driver->expression);
}
/* Reset cached compiled expression data */
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index 2245af31f0d..6acff73957c 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -533,14 +533,14 @@ static bool BKE_fluid_modifier_init(
/* Allocate fluid. */
return BKE_fluid_reallocate_fluid(fds, fds->res, 0);
}
- else if (fmd->type & MOD_FLUID_TYPE_FLOW) {
+ if (fmd->type & MOD_FLUID_TYPE_FLOW) {
if (!fmd->flow) {
BKE_fluid_modifier_create_type_data(fmd);
}
fmd->time = scene_framenr;
return true;
}
- else if (fmd->type & MOD_FLUID_TYPE_EFFEC) {
+ if (fmd->type & MOD_FLUID_TYPE_EFFEC) {
if (!fmd->effector) {
BKE_fluid_modifier_create_type_data(fmd);
}
@@ -575,7 +575,7 @@ static int get_light(ViewLayer *view_layer, float *light)
copy_v3_v3(light, base_tmp->object->obmat[3]);
return 1;
}
- else if (!found_light) {
+ if (!found_light) {
copy_v3_v3(light, base_tmp->object->obmat[3]);
found_light = 1;
}
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index c85283e3653..c973b681fe7 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -285,9 +285,8 @@ static double sinc(double x)
if (fabs(x) < 0.0001) {
return 1.0;
}
- else {
- return sin(M_PI * x) / (M_PI * x);
- }
+
+ return sin(M_PI * x) / (M_PI * x);
}
static void fcm_fn_generator_evaluate(
@@ -525,29 +524,28 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[],
CLOG_WARN(&LOG, "encountered invalid array");
return 0;
}
- else {
- /* check whether to add before/after/on */
- float framenum;
- /* 'First' Point (when only one point, this case is used) */
- framenum = array[0].time;
- if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) {
- *r_exists = true;
- return 0;
- }
- else if (frame < framenum) {
- return 0;
- }
+ /* check whether to add before/after/on */
+ float framenum;
- /* 'Last' Point */
- framenum = array[(arraylen - 1)].time;
- if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) {
- *r_exists = true;
- return (arraylen - 1);
- }
- else if (frame > framenum) {
- return arraylen;
- }
+ /* 'First' Point (when only one point, this case is used) */
+ framenum = array[0].time;
+ if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) {
+ *r_exists = true;
+ return 0;
+ }
+ if (frame < framenum) {
+ return 0;
+ }
+
+ /* 'Last' Point */
+ framenum = array[(arraylen - 1)].time;
+ if (IS_EQT(frame, framenum, BINARYSEARCH_FRAMEEQ_THRESH)) {
+ *r_exists = true;
+ return (arraylen - 1);
+ }
+ if (frame > framenum) {
+ return arraylen;
}
/* most of the time, this loop is just to find where to put it
@@ -1076,9 +1074,8 @@ const FModifierTypeInfo *get_fmodifier_typeinfo(const int type)
/* there shouldn't be any segfaults here... */
return fmodifiersTypeInfo[type];
}
- else {
- CLOG_ERROR(&LOG, "No valid F-Curve Modifier type-info data available. Type = %i", type);
- }
+
+ CLOG_ERROR(&LOG, "No valid F-Curve Modifier type-info data available. Type = %i", type);
return NULL;
}
@@ -1092,9 +1089,8 @@ const FModifierTypeInfo *fmodifier_get_typeinfo(const FModifier *fcm)
if (fcm) {
return get_fmodifier_typeinfo(fcm->type);
}
- else {
- return NULL;
- }
+
+ return NULL;
}
/* API --------------------------- */
@@ -1239,12 +1235,11 @@ bool remove_fmodifier(ListBase *modifiers, FModifier *fcm)
return true;
}
- else {
- /* XXX this case can probably be removed some day, as it shouldn't happen... */
- CLOG_STR_ERROR(&LOG, "no modifier stack given");
- MEM_freeN(fcm);
- return false;
- }
+
+ /* XXX this case can probably be removed some day, as it shouldn't happen... */
+ CLOG_STR_ERROR(&LOG, "no modifier stack given");
+ MEM_freeN(fcm);
+ return false;
}
/* Remove all of a given F-Curve's modifiers */
@@ -1397,13 +1392,13 @@ static float eval_fmodifier_influence(FModifier *fcm, float evaltime)
/* out of range */
return 0.0f;
}
- else if ((evaltime > fcm->sfra) && (evaltime < fcm->sfra + fcm->blendin)) {
+ if ((evaltime > fcm->sfra) && (evaltime < fcm->sfra + fcm->blendin)) {
/* blend in range */
float a = fcm->sfra;
float b = fcm->sfra + fcm->blendin;
return influence * (evaltime - a) / (b - a);
}
- else if ((evaltime < fcm->efra) && (evaltime > fcm->efra - fcm->blendout)) {
+ if ((evaltime < fcm->efra) && (evaltime > fcm->efra - fcm->blendout)) {
/* blend out range */
float a = fcm->efra;
float b = fcm->efra - fcm->blendout;
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 958acf0589b..4bedba8f76b 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -193,13 +193,12 @@ static PackedFile *get_builtin_packedfile(void)
return NULL;
}
- else {
- void *mem = MEM_mallocN(builtin_font_size, "vfd_builtin");
- memcpy(mem, builtin_font_data, builtin_font_size);
+ void *mem = MEM_mallocN(builtin_font_size, "vfd_builtin");
- return BKE_packedfile_new_from_memory(mem, builtin_font_size);
- }
+ memcpy(mem, builtin_font_data, builtin_font_size);
+
+ return BKE_packedfile_new_from_memory(mem, builtin_font_size);
}
static VFontData *vfont_get_data(VFont *vfont)
@@ -621,12 +620,11 @@ int BKE_vfont_select_get(Object *ob, int *r_start, int *r_end)
if (start == end + 1) {
return 0;
}
- else {
- BLI_assert(start < end + 1);
- *r_start = start;
- *r_end = end;
- return direction;
- }
+
+ BLI_assert(start < end + 1);
+ *r_start = start;
+ *r_end = end;
+ return direction;
}
void BKE_vfont_select_clamp(Object *ob)
@@ -647,12 +645,11 @@ static float char_width(Curve *cu, VChar *che, CharInfo *info)
if (che == NULL) {
return 0.0f;
}
- else if (info->flag & CU_CHINFO_SMALLCAPS_CHECK) {
+ if (info->flag & CU_CHINFO_SMALLCAPS_CHECK) {
return che->width * cu->smallcaps_scale;
}
- else {
- return che->width;
- }
+
+ return che->width;
}
static void textbox_scale(TextBox *tb_dst, const TextBox *tb_src, float scale)
@@ -1603,32 +1600,32 @@ static bool vfont_to_curve(Object *ob,
}
return true;
}
+
+ ok = true;
+finally:
+ if (r_text) {
+ *r_text = mem;
+ *r_text_len = slen;
+ *r_text_free = (ef == NULL);
+ }
else {
- ok = true;
- finally:
- if (r_text) {
- *r_text = mem;
- *r_text_len = slen;
- *r_text_free = (ef == NULL);
+ if (ef == NULL) {
+ MEM_freeN((void *)mem);
+ }
+ }
+
+ if (chartransdata) {
+ if (ok && r_chartransdata) {
+ *r_chartransdata = chartransdata;
}
else {
- if (ef == NULL) {
- MEM_freeN((void *)mem);
- }
+ MEM_freeN(chartransdata);
}
+ }
- if (chartransdata) {
- if (ok && r_chartransdata) {
- *r_chartransdata = chartransdata;
- }
- else {
- MEM_freeN(chartransdata);
- }
- }
+ /* Store the effective scale, to use for the textbox lines. */
+ cu->fsize_realtime = font_size;
- /* Store the effective scale, to use for the textbox lines. */
- cu->fsize_realtime = font_size;
- }
return ok;
#undef MARGIN_X_MIN
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index eeb55c44d6e..c64f1b86eab 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -381,7 +381,7 @@ bGPDframe *BKE_gpencil_frame_addcopy(bGPDlayer *gpl, int cframe)
/* no layer */
return NULL;
}
- else if (gpl->actframe == NULL) {
+ if (gpl->actframe == NULL) {
/* no active frame, so just create a new one from scratch */
return BKE_gpencil_frame_addnew(gpl, cframe);
}
@@ -398,7 +398,7 @@ bGPDframe *BKE_gpencil_frame_addcopy(bGPDlayer *gpl, int cframe)
found = true;
break;
}
- else if (gpf->framenum == cframe) {
+ if (gpf->framenum == cframe) {
/* This only happens when we're editing with framelock on...
* - Delete the new frame and don't do anything else here...
*/
@@ -1009,7 +1009,7 @@ bGPDframe *BKE_gpencil_layer_frame_get(bGPDlayer *gpl, int cframe, eGP_GetFrame_
found = true;
break;
}
- else if ((gpf->next) && (gpf->next->framenum > cframe)) {
+ if ((gpf->next) && (gpf->next->framenum > cframe)) {
found = true;
break;
}
@@ -1484,10 +1484,9 @@ Material *BKE_gpencil_object_material_ensure_from_brush(Main *bmain, Object *ob,
return ma;
}
- else {
- /* using active material instead */
- return BKE_object_material_get(ob, ob->actcol);
- }
+
+ /* using active material instead */
+ return BKE_object_material_get(ob, ob->actcol);
}
/**
@@ -1546,9 +1545,8 @@ Material *BKE_gpencil_object_material_from_brush_get(Object *ob, Brush *brush)
Material *ma = BKE_gpencil_brush_material_get(brush);
return ma;
}
- else {
- return BKE_object_material_get(ob, ob->actcol);
- }
+
+ return BKE_object_material_get(ob, ob->actcol);
}
/**
@@ -1562,9 +1560,8 @@ int BKE_gpencil_object_material_get_index_from_brush(Object *ob, Brush *brush)
if ((brush) && (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED)) {
return BKE_gpencil_object_material_index_get(ob, brush->gpencil_settings->material);
}
- else {
- return ob->actcol - 1;
- }
+
+ return ob->actcol - 1;
}
/**
@@ -1581,9 +1578,8 @@ Material *BKE_gpencil_object_material_ensure_from_active_input_toolsettings(Main
return BKE_gpencil_object_material_ensure_from_active_input_brush(
bmain, ob, ts->gp_paint->paint.brush);
}
- else {
- return BKE_gpencil_object_material_ensure_from_active_input_brush(bmain, ob, NULL);
- }
+
+ return BKE_gpencil_object_material_ensure_from_active_input_brush(bmain, ob, NULL);
}
/**
@@ -1602,7 +1598,7 @@ Material *BKE_gpencil_object_material_ensure_from_active_input_brush(Main *bmain
if (ma) {
return ma;
}
- else if (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) {
+ if (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) {
/* it is easier to just unpin a NULL material, instead of setting a new one */
brush->gpencil_settings->flag &= ~GP_BRUSH_MATERIAL_PINNED;
}
@@ -2425,31 +2421,29 @@ void BKE_gpencil_parent_matrix_get(const Depsgraph *depsgraph,
unit_m4(diff_mat);
return;
}
- else {
- if ((gpl->partype == PAROBJECT) || (gpl->partype == PARSKEL)) {
- mul_m4_m4m4(diff_mat, obparent_eval->obmat, gpl->inverse);
+
+ if ((gpl->partype == PAROBJECT) || (gpl->partype == PARSKEL)) {
+ mul_m4_m4m4(diff_mat, obparent_eval->obmat, gpl->inverse);
+ add_v3_v3(diff_mat[3], ob_eval->obmat[3]);
+ return;
+ }
+ if (gpl->partype == PARBONE) {
+ bPoseChannel *pchan = BKE_pose_channel_find_name(obparent_eval->pose, gpl->parsubstr);
+ if (pchan) {
+ float tmp_mat[4][4];
+ mul_m4_m4m4(tmp_mat, obparent_eval->obmat, pchan->pose_mat);
+ mul_m4_m4m4(diff_mat, tmp_mat, gpl->inverse);
add_v3_v3(diff_mat[3], ob_eval->obmat[3]);
- return;
- }
- else if (gpl->partype == PARBONE) {
- bPoseChannel *pchan = BKE_pose_channel_find_name(obparent_eval->pose, gpl->parsubstr);
- if (pchan) {
- float tmp_mat[4][4];
- mul_m4_m4m4(tmp_mat, obparent_eval->obmat, pchan->pose_mat);
- mul_m4_m4m4(diff_mat, tmp_mat, gpl->inverse);
- add_v3_v3(diff_mat[3], ob_eval->obmat[3]);
- }
- else {
- /* if bone not found use object (armature) */
- mul_m4_m4m4(diff_mat, obparent_eval->obmat, gpl->inverse);
- add_v3_v3(diff_mat[3], ob_eval->obmat[3]);
- }
- return;
}
else {
- unit_m4(diff_mat); /* not defined type */
+ /* if bone not found use object (armature) */
+ mul_m4_m4m4(diff_mat, obparent_eval->obmat, gpl->inverse);
+ add_v3_v3(diff_mat[3], ob_eval->obmat[3]);
}
+ return;
}
+
+ unit_m4(diff_mat); /* not defined type */
}
/**
diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c
index 14eb6bb4f4c..672d65f1585 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.c
+++ b/source/blender/blenkernel/intern/gpencil_geom.c
@@ -245,24 +245,23 @@ static int stroke_march_next_point(const bGPDstroke *gps,
return 0;
}
- else {
- float ratio = remaining_march / remaining_till_next;
- interp_v3_v3v3(result, step_start, point, ratio);
- *pressure = interpf(
- gps->points[next_point_index].pressure, gps->points[next_point_index - 1].pressure, ratio);
- *strength = interpf(
- gps->points[next_point_index].strength, gps->points[next_point_index - 1].strength, ratio);
- interp_v4_v4v4(vert_color,
- gps->points[next_point_index - 1].vert_color,
- gps->points[next_point_index].vert_color,
- ratio);
-
- *index_from = next_point_index - 1;
- *index_to = next_point_index;
- *ratio_result = ratio;
- return next_point_index;
- }
+ float ratio = remaining_march / remaining_till_next;
+ interp_v3_v3v3(result, step_start, point, ratio);
+ *pressure = interpf(
+ gps->points[next_point_index].pressure, gps->points[next_point_index - 1].pressure, ratio);
+ *strength = interpf(
+ gps->points[next_point_index].strength, gps->points[next_point_index - 1].strength, ratio);
+ interp_v4_v4v4(vert_color,
+ gps->points[next_point_index - 1].vert_color,
+ gps->points[next_point_index].vert_color,
+ ratio);
+
+ *index_from = next_point_index - 1;
+ *index_to = next_point_index;
+ *ratio_result = ratio;
+
+ return next_point_index;
}
static int stroke_march_next_point_no_interp(const bGPDstroke *gps,
@@ -306,11 +305,10 @@ static int stroke_march_next_point_no_interp(const bGPDstroke *gps,
copy_v3_v3(result, &pt->x);
return 0;
}
- else {
- float ratio = remaining_march / remaining_till_next;
- interp_v3_v3v3(result, step_start, point, ratio);
- return next_point_index;
- }
+
+ float ratio = remaining_march / remaining_till_next;
+ interp_v3_v3v3(result, step_start, point, ratio);
+ return next_point_index;
}
static int stroke_march_count(const bGPDstroke *gps, const float dist)
@@ -1352,10 +1350,9 @@ bool BKE_gpencil_stroke_trim(bGPDstroke *gps)
if ((lambda <= 0.0f) || (lambda >= 1.0f)) {
continue;
}
- else {
- intersect = true;
- break;
- }
+
+ intersect = true;
+ break;
}
}
}
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index e92bf5a4502..c2e330e8f04 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -348,9 +348,8 @@ const GpencilModifierTypeInfo *BKE_gpencil_modifier_get_info(GpencilModifierType
modifier_gpencil_types[type]->name[0] != '\0') {
return modifier_gpencil_types[type];
}
- else {
- return NULL;
- }
+
+ return NULL;
}
/**
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 6da48195aab..bec0da750e1 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -765,9 +765,8 @@ bool BKE_icon_delete(const int icon_id)
icon_free(icon);
return true;
}
- else {
- return false;
- }
+
+ return false;
}
bool BKE_icon_delete_unmanaged(const int icon_id)
@@ -783,15 +782,13 @@ bool BKE_icon_delete_unmanaged(const int icon_id)
BLI_ghash_insert(gIcons, POINTER_FROM_INT(icon_id), icon);
return false;
}
- else {
- icon_free_data(icon_id, icon);
- icon_free(icon);
- return true;
- }
- }
- else {
- return false;
+
+ icon_free_data(icon_id, icon);
+ icon_free(icon);
+ return true;
}
+
+ return false;
}
/* -------------------------------------------------------------------- */
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index c3c67b9ed51..e394242001c 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -181,7 +181,7 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen)
prop->len = newlen;
return;
}
- else if (newlen >= prop->len) {
+ if (newlen >= prop->len) {
prop->len = newlen;
return;
}
@@ -836,17 +836,16 @@ IDProperty *IDP_GetProperties(ID *id, const bool create_if_needed)
if (id->properties) {
return id->properties;
}
- else {
- if (create_if_needed) {
- id->properties = MEM_callocN(sizeof(IDProperty), "IDProperty");
- id->properties->type = IDP_GROUP;
- /* don't overwrite the data's name and type
- * some functions might need this if they
- * don't have a real ID, should be named elsewhere - Campbell */
- /* strcpy(id->name, "top_level_group");*/
- }
- return id->properties;
+
+ if (create_if_needed) {
+ id->properties = MEM_callocN(sizeof(IDProperty), "IDProperty");
+ id->properties->type = IDP_GROUP;
+ /* don't overwrite the data's name and type
+ * some functions might need this if they
+ * don't have a real ID, should be named elsewhere - Campbell */
+ /* strcpy(id->name, "top_level_group");*/
}
+ return id->properties;
}
/**
@@ -856,10 +855,10 @@ bool IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const bool is
if (prop1 == NULL && prop2 == NULL) {
return true;
}
- else if (prop1 == NULL || prop2 == NULL) {
+ if (prop1 == NULL || prop2 == NULL) {
return is_strict ? false : true;
}
- else if (prop1->type != prop2->type) {
+ if (prop1->type != prop2->type) {
return false;
}
diff --git a/source/blender/blenkernel/intern/idtype.c b/source/blender/blenkernel/intern/idtype.c
index 1166ad9ad2f..4ab7d362e0e 100644
--- a/source/blender/blenkernel/intern/idtype.c
+++ b/source/blender/blenkernel/intern/idtype.c
@@ -135,9 +135,8 @@ const IDTypeInfo *BKE_idtype_get_info_from_idcode(const short id_code)
id_types[id_index]->name[0] != '\0') {
return id_types[id_index];
}
- else {
- return NULL;
- }
+
+ return NULL;
}
const IDTypeInfo *BKE_idtype_get_info_from_id(const ID *id)
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index e331e5ae1dd..4bd966cffc6 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -667,9 +667,8 @@ char BKE_image_alpha_mode_from_extension_ex(const char *filepath)
if (BLI_path_extension_check_n(filepath, ".exr", ".cin", ".dpx", ".hdr", NULL)) {
return IMA_ALPHA_PREMUL;
}
- else {
- return IMA_ALPHA_STRAIGHT;
- }
+
+ return IMA_ALPHA_STRAIGHT;
}
void BKE_image_alpha_mode_from_extension(Image *image)
@@ -1201,57 +1200,56 @@ int BKE_image_imtype_to_ftype(const char imtype, ImbFormatOptions *r_options)
if (imtype == R_IMF_IMTYPE_TARGA) {
return IMB_FTYPE_TGA;
}
- else if (imtype == R_IMF_IMTYPE_RAWTGA) {
+ if (imtype == R_IMF_IMTYPE_RAWTGA) {
r_options->flag = RAWTGA;
return IMB_FTYPE_TGA;
}
- else if (imtype == R_IMF_IMTYPE_IRIS) {
+ if (imtype == R_IMF_IMTYPE_IRIS) {
return IMB_FTYPE_IMAGIC;
}
#ifdef WITH_HDR
- else if (imtype == R_IMF_IMTYPE_RADHDR) {
+ if (imtype == R_IMF_IMTYPE_RADHDR) {
return IMB_FTYPE_RADHDR;
}
#endif
- else if (imtype == R_IMF_IMTYPE_PNG) {
+ if (imtype == R_IMF_IMTYPE_PNG) {
r_options->quality = 15;
return IMB_FTYPE_PNG;
}
#ifdef WITH_DDS
- else if (imtype == R_IMF_IMTYPE_DDS) {
+ if (imtype == R_IMF_IMTYPE_DDS) {
return IMB_FTYPE_DDS;
}
#endif
- else if (imtype == R_IMF_IMTYPE_BMP) {
+ if (imtype == R_IMF_IMTYPE_BMP) {
return IMB_FTYPE_BMP;
}
#ifdef WITH_TIFF
- else if (imtype == R_IMF_IMTYPE_TIFF) {
+ if (imtype == R_IMF_IMTYPE_TIFF) {
return IMB_FTYPE_TIF;
}
#endif
- else if (imtype == R_IMF_IMTYPE_OPENEXR || imtype == R_IMF_IMTYPE_MULTILAYER) {
+ if (imtype == R_IMF_IMTYPE_OPENEXR || imtype == R_IMF_IMTYPE_MULTILAYER) {
return IMB_FTYPE_OPENEXR;
}
#ifdef WITH_CINEON
- else if (imtype == R_IMF_IMTYPE_CINEON) {
+ if (imtype == R_IMF_IMTYPE_CINEON) {
return IMB_FTYPE_CINEON;
}
- else if (imtype == R_IMF_IMTYPE_DPX) {
+ if (imtype == R_IMF_IMTYPE_DPX) {
return IMB_FTYPE_DPX;
}
#endif
#ifdef WITH_OPENJPEG
- else if (imtype == R_IMF_IMTYPE_JP2) {
+ if (imtype == R_IMF_IMTYPE_JP2) {
r_options->flag |= JP2_JP2;
r_options->quality = 90;
return IMB_FTYPE_JP2;
}
#endif
- else {
- r_options->quality = 90;
- return IMB_FTYPE_JPG;
- }
+
+ r_options->quality = 90;
+ return IMB_FTYPE_JPG;
}
char BKE_image_ftype_to_imtype(const int ftype, const ImbFormatOptions *options)
@@ -1259,57 +1257,55 @@ char BKE_image_ftype_to_imtype(const int ftype, const ImbFormatOptions *options)
if (ftype == 0) {
return R_IMF_IMTYPE_TARGA;
}
- else if (ftype == IMB_FTYPE_IMAGIC) {
+ if (ftype == IMB_FTYPE_IMAGIC) {
return R_IMF_IMTYPE_IRIS;
}
#ifdef WITH_HDR
- else if (ftype == IMB_FTYPE_RADHDR) {
+ if (ftype == IMB_FTYPE_RADHDR) {
return R_IMF_IMTYPE_RADHDR;
}
#endif
- else if (ftype == IMB_FTYPE_PNG) {
+ if (ftype == IMB_FTYPE_PNG) {
return R_IMF_IMTYPE_PNG;
}
#ifdef WITH_DDS
- else if (ftype == IMB_FTYPE_DDS) {
+ if (ftype == IMB_FTYPE_DDS) {
return R_IMF_IMTYPE_DDS;
}
#endif
- else if (ftype == IMB_FTYPE_BMP) {
+ if (ftype == IMB_FTYPE_BMP) {
return R_IMF_IMTYPE_BMP;
}
#ifdef WITH_TIFF
- else if (ftype == IMB_FTYPE_TIF) {
+ if (ftype == IMB_FTYPE_TIF) {
return R_IMF_IMTYPE_TIFF;
}
#endif
- else if (ftype == IMB_FTYPE_OPENEXR) {
+ if (ftype == IMB_FTYPE_OPENEXR) {
return R_IMF_IMTYPE_OPENEXR;
}
#ifdef WITH_CINEON
- else if (ftype == IMB_FTYPE_CINEON) {
+ if (ftype == IMB_FTYPE_CINEON) {
return R_IMF_IMTYPE_CINEON;
}
- else if (ftype == IMB_FTYPE_DPX) {
+ if (ftype == IMB_FTYPE_DPX) {
return R_IMF_IMTYPE_DPX;
}
#endif
- else if (ftype == IMB_FTYPE_TGA) {
+ if (ftype == IMB_FTYPE_TGA) {
if (options && (options->flag & RAWTGA)) {
return R_IMF_IMTYPE_RAWTGA;
}
- else {
- return R_IMF_IMTYPE_TARGA;
- }
+
+ return R_IMF_IMTYPE_TARGA;
}
#ifdef WITH_OPENJPEG
- else if (ftype == IMB_FTYPE_JP2) {
+ if (ftype == IMB_FTYPE_JP2) {
return R_IMF_IMTYPE_JP2;
}
#endif
- else {
- return R_IMF_IMTYPE_JPEG90;
- }
+
+ return R_IMF_IMTYPE_JPEG90;
}
bool BKE_imtype_is_movie(const char imtype)
@@ -1443,78 +1439,77 @@ char BKE_imtype_from_arg(const char *imtype_arg)
if (STREQ(imtype_arg, "TGA")) {
return R_IMF_IMTYPE_TARGA;
}
- else if (STREQ(imtype_arg, "IRIS")) {
+ if (STREQ(imtype_arg, "IRIS")) {
return R_IMF_IMTYPE_IRIS;
}
#ifdef WITH_DDS
- else if (STREQ(imtype_arg, "DDS")) {
+ if (STREQ(imtype_arg, "DDS")) {
return R_IMF_IMTYPE_DDS;
}
#endif
- else if (STREQ(imtype_arg, "JPEG")) {
+ if (STREQ(imtype_arg, "JPEG")) {
return R_IMF_IMTYPE_JPEG90;
}
- else if (STREQ(imtype_arg, "IRIZ")) {
+ if (STREQ(imtype_arg, "IRIZ")) {
return R_IMF_IMTYPE_IRIZ;
}
- else if (STREQ(imtype_arg, "RAWTGA")) {
+ if (STREQ(imtype_arg, "RAWTGA")) {
return R_IMF_IMTYPE_RAWTGA;
}
- else if (STREQ(imtype_arg, "AVIRAW")) {
+ if (STREQ(imtype_arg, "AVIRAW")) {
return R_IMF_IMTYPE_AVIRAW;
}
- else if (STREQ(imtype_arg, "AVIJPEG")) {
+ if (STREQ(imtype_arg, "AVIJPEG")) {
return R_IMF_IMTYPE_AVIJPEG;
}
- else if (STREQ(imtype_arg, "PNG")) {
+ if (STREQ(imtype_arg, "PNG")) {
return R_IMF_IMTYPE_PNG;
}
- else if (STREQ(imtype_arg, "BMP")) {
+ if (STREQ(imtype_arg, "BMP")) {
return R_IMF_IMTYPE_BMP;
}
#ifdef WITH_HDR
- else if (STREQ(imtype_arg, "HDR")) {
+ if (STREQ(imtype_arg, "HDR")) {
return R_IMF_IMTYPE_RADHDR;
}
#endif
#ifdef WITH_TIFF
- else if (STREQ(imtype_arg, "TIFF")) {
+ if (STREQ(imtype_arg, "TIFF")) {
return R_IMF_IMTYPE_TIFF;
}
#endif
#ifdef WITH_OPENEXR
- else if (STREQ(imtype_arg, "OPEN_EXR")) {
+ if (STREQ(imtype_arg, "OPEN_EXR")) {
return R_IMF_IMTYPE_OPENEXR;
}
- else if (STREQ(imtype_arg, "OPEN_EXR_MULTILAYER")) {
+ if (STREQ(imtype_arg, "OPEN_EXR_MULTILAYER")) {
return R_IMF_IMTYPE_MULTILAYER;
}
- else if (STREQ(imtype_arg, "EXR")) {
+ if (STREQ(imtype_arg, "EXR")) {
return R_IMF_IMTYPE_OPENEXR;
}
- else if (STREQ(imtype_arg, "MULTILAYER")) {
+ if (STREQ(imtype_arg, "MULTILAYER")) {
return R_IMF_IMTYPE_MULTILAYER;
}
#endif
- else if (STREQ(imtype_arg, "FFMPEG")) {
+ if (STREQ(imtype_arg, "FFMPEG")) {
return R_IMF_IMTYPE_FFMPEG;
}
#ifdef WITH_CINEON
- else if (STREQ(imtype_arg, "CINEON")) {
+ if (STREQ(imtype_arg, "CINEON")) {
return R_IMF_IMTYPE_CINEON;
}
- else if (STREQ(imtype_arg, "DPX")) {
+ if (STREQ(imtype_arg, "DPX")) {
return R_IMF_IMTYPE_DPX;
}
#endif
#ifdef WITH_OPENJPEG
- else if (STREQ(imtype_arg, "JP2")) {
+ if (STREQ(imtype_arg, "JP2")) {
return R_IMF_IMTYPE_JP2;
}
#endif
- else {
- return R_IMF_IMTYPE_INVALID;
- }
+
+ return R_IMF_IMTYPE_INVALID;
}
static bool do_add_image_extension(char *string,
@@ -1638,13 +1633,11 @@ static bool do_add_image_extension(char *string,
if (BLI_path_extension_check_array(string, imb_ext_image)) {
return BLI_path_extension_replace(string, FILE_MAX, extension);
}
- else {
- return BLI_path_extension_ensure(string, FILE_MAX, extension);
- }
- }
- else {
- return false;
+
+ return BLI_path_extension_ensure(string, FILE_MAX, extension);
}
+
+ return false;
}
int BKE_image_path_ensure_ext_from_imformat(char *string, const ImageFormatData *im_format)
@@ -3548,9 +3541,8 @@ static RenderPass *image_render_pass_get(RenderLayer *rl,
/* no multiview or left eye */
break;
}
- else {
- rp_name = rpass->name;
- }
+
+ rp_name = rpass->name;
}
/* multiview */
else if (rp_name[0] && STREQ(rpass->name, rp_name) && (rpass->view_id == view)) {
@@ -3713,9 +3705,8 @@ RenderPass *BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser)
iuser->multi_index = index + rp_index;
break;
}
- else {
- index += BLI_listbase_count(&rl->passes);
- }
+
+ index += BLI_listbase_count(&rl->passes);
}
}
@@ -3986,13 +3977,12 @@ static int image_num_files(Image *ima)
if (!is_multiview) {
return 1;
}
- else if (ima->views_format == R_IMF_VIEWS_STEREO_3D) {
+ if (ima->views_format == R_IMF_VIEWS_STEREO_3D) {
return 1;
}
/* R_IMF_VIEWS_INDIVIDUAL */
- else {
- return BLI_listbase_count(&ima->views);
- }
+
+ return BLI_listbase_count(&ima->views);
}
static ImBuf *load_sequence_single(
@@ -4707,7 +4697,7 @@ static int image_get_multiview_index(Image *ima, ImageUser *iuser)
if (is_multilayer) {
return iuser ? iuser->multi_index : index;
}
- else if (is_backdrop) {
+ if (is_backdrop) {
if (BKE_image_is_stereo(ima)) {
/* backdrop hackaround (since there is no iuser */
return ima->eye;
@@ -4844,7 +4834,7 @@ BLI_INLINE bool image_quick_test(Image *ima, const ImageUser *iuser)
if (tile == NULL) {
return false;
}
- else if (tile->ok == 0) {
+ if (tile->ok == 0) {
return false;
}
@@ -5161,58 +5151,57 @@ int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, bool *r_is_in_ran
if (len == 0) {
return 0;
}
- else {
- int framenr;
- cfra = cfra - iuser->sfra + 1;
-
- /* cyclic */
- if (iuser->cycl) {
- cfra = ((cfra) % len);
- if (cfra < 0) {
- cfra += len;
- }
- if (cfra == 0) {
- cfra = len;
- }
- if (r_is_in_range) {
- *r_is_in_range = true;
- }
- }
+ int framenr;
+ cfra = cfra - iuser->sfra + 1;
+ /* cyclic */
+ if (iuser->cycl) {
+ cfra = ((cfra) % len);
if (cfra < 0) {
- cfra = 0;
+ cfra += len;
}
- else if (cfra > len) {
+ if (cfra == 0) {
cfra = len;
}
- else {
- if (r_is_in_range) {
- *r_is_in_range = true;
- }
- }
- /* transform to images space */
- framenr = cfra;
- if (framenr > iuser->frames) {
- framenr = iuser->frames;
+ if (r_is_in_range) {
+ *r_is_in_range = true;
}
+ }
- if (iuser->cycl) {
- framenr = ((framenr) % len);
- while (framenr < 0) {
- framenr += len;
- }
- if (framenr == 0) {
- framenr = len;
- }
+ if (cfra < 0) {
+ cfra = 0;
+ }
+ else if (cfra > len) {
+ cfra = len;
+ }
+ else {
+ if (r_is_in_range) {
+ *r_is_in_range = true;
}
+ }
- /* important to apply after else we cant loop on frames 100 - 110 for eg. */
- framenr += iuser->offset;
+ /* transform to images space */
+ framenr = cfra;
+ if (framenr > iuser->frames) {
+ framenr = iuser->frames;
+ }
- return framenr;
+ if (iuser->cycl) {
+ framenr = ((framenr) % len);
+ while (framenr < 0) {
+ framenr += len;
+ }
+ if (framenr == 0) {
+ framenr = len;
+ }
}
+
+ /* important to apply after else we cant loop on frames 100 - 110 for eg. */
+ framenr += iuser->offset;
+
+ return framenr;
}
void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra)
@@ -5378,9 +5367,8 @@ bool BKE_image_has_alpha(struct Image *image)
if (planes == 32) {
return true;
}
- else {
- return false;
- }
+
+ return false;
}
void BKE_image_get_size(Image *image, ImageUser *iuser, int *r_width, int *r_height)
@@ -5846,17 +5834,16 @@ bool BKE_image_clear_renderslot(Image *ima, ImageUser *iuser, int index)
RE_ClearResult(re);
return true;
}
- else {
- RenderSlot *slot = BLI_findlink(&ima->renderslots, index);
- if (!slot) {
- return false;
- }
- if (slot->render) {
- RE_FreeRenderResult(slot->render);
- slot->render = NULL;
- }
- return true;
+
+ RenderSlot *slot = BLI_findlink(&ima->renderslots, index);
+ if (!slot) {
+ return false;
}
+ if (slot->render) {
+ RE_FreeRenderResult(slot->render);
+ slot->render = NULL;
+ }
+ return true;
}
RenderSlot *BKE_image_get_renderslot(Image *ima, int index)
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 7bf9cb2d0a1..a7fdf93f656 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -517,9 +517,8 @@ static const char *mtex_adrcodes_to_paths(int adrcode, int *UNUSED(array_index))
BLI_snprintf(buf, 128, "%s.%s", base, prop);
return buf;
}
- else {
- return NULL;
- }
+
+ return NULL;
}
/* Texture types */
@@ -1074,10 +1073,9 @@ static char *get_rna_access(ID *id,
return NULL;
}
- else {
- if (array_index) {
- *array_index = dummy_index;
- }
+
+ if (array_index) {
+ *array_index = dummy_index;
}
/* 'buf' _must_ be initialized in this block */
@@ -1976,7 +1974,7 @@ void do_versions_ipos_to_animato(Main *bmain)
CLOG_WARN(&LOG, "Animation data too new to convert (Version %d)", bmain->versionfile);
return;
}
- else if (G.debug & G_DEBUG) {
+ if (G.debug & G_DEBUG) {
printf("INFO: Converting to Animato...\n");
}
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 4d523ffa2e0..4d073593da7 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -356,9 +356,8 @@ bool object_deform_mball(Object *ob, ListBase *dispbase)
return true;
}
- else {
- return false;
- }
+
+ return false;
}
static BPoint *latt_bp(Lattice *lt, int u, int v, int w)
@@ -575,9 +574,8 @@ struct BPoint *BKE_lattice_active_point_get(Lattice *lt)
if ((lt->actbp != LT_ACTBP_NONE) && (lt->actbp < lt->pntsu * lt->pntsv * lt->pntsw)) {
return &lt->def[lt->actbp];
}
- else {
- return NULL;
- }
+
+ return NULL;
}
void BKE_lattice_center_median(Lattice *lt, float cent[3])
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 83071fd5dd3..cf6139d9449 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -555,21 +555,19 @@ static bool layer_collection_hidden(ViewLayer *view_layer, LayerCollection *lc)
if (lc->flag & LAYER_COLLECTION_HIDE || lc->collection->flag & COLLECTION_RESTRICT_VIEWPORT) {
return true;
}
- else {
- /* Restriction flags stay set, so we need to check parents */
- CollectionParent *parent = lc->collection->parents.first;
- if (parent) {
- lc = BKE_layer_collection_first_from_scene_collection(view_layer, parent->collection);
+ /* Restriction flags stay set, so we need to check parents */
+ CollectionParent *parent = lc->collection->parents.first;
- return lc && layer_collection_hidden(view_layer, lc);
- }
- else {
- return false;
- }
+ if (parent) {
+ lc = BKE_layer_collection_first_from_scene_collection(view_layer, parent->collection);
+
+ return lc && layer_collection_hidden(view_layer, lc);
}
return false;
+
+ return false;
}
/**
@@ -1610,10 +1608,9 @@ void BKE_view_layer_selected_editable_objects_iterator_begin(BLI_Iterator *iter,
// First object is valid (selectable and not libdata) -> all good.
return;
}
- else {
- // Object is selectable but not editable -> search for another one.
- BKE_view_layer_selected_editable_objects_iterator_next(iter);
- }
+
+ // Object is selectable but not editable -> search for another one.
+ BKE_view_layer_selected_editable_objects_iterator_next(iter);
}
}
diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c
index a64e550579d..3b7aae98327 100644
--- a/source/blender/blenkernel/intern/lib_id.c
+++ b/source/blender/blenkernel/intern/lib_id.c
@@ -2203,13 +2203,12 @@ char *BKE_id_to_unique_string_key(const struct ID *id)
if (id->lib == NULL) {
return BLI_strdup(id->name);
}
- else {
- /* Prefix with an ascii character in the range of 32..96 (visible)
- * this ensures we can't have a library ID pair that collide.
- * Where 'LIfooOBbarOBbaz' could be ('LIfoo, OBbarOBbaz') or ('LIfooOBbar', 'OBbaz'). */
- const char ascii_len = strlen(id->lib->id.name + 2) + 32;
- return BLI_sprintfN("%c%s%s", ascii_len, id->lib->id.name, id->name);
- }
+
+ /* Prefix with an ascii character in the range of 32..96 (visible)
+ * this ensures we can't have a library ID pair that collide.
+ * Where 'LIfooOBbarOBbaz' could be ('LIfoo, OBbarOBbaz') or ('LIfooOBbar', 'OBbaz'). */
+ const char ascii_len = strlen(id->lib->id.name + 2) + 32;
+ return BLI_sprintfN("%c%s%s", ascii_len, id->lib->id.name, id->name);
}
void BKE_id_tag_set_atomic(ID *id, int tag)
@@ -2258,7 +2257,7 @@ static int id_order_compare(const void *a, const void *b)
if (*order_a < *order_b) {
return -1;
}
- else if (*order_a > *order_b) {
+ if (*order_a > *order_b) {
return 1;
}
}
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c
index 8b0517a77fb..12d7f0e9e8e 100644
--- a/source/blender/blenkernel/intern/lib_override.c
+++ b/source/blender/blenkernel/intern/lib_override.c
@@ -117,9 +117,8 @@ void BKE_lib_override_library_copy(ID *dst_id, const ID *src_id, const bool do_f
BKE_lib_override_library_free(&dst_id->override_library, true);
return;
}
- else {
- BKE_lib_override_library_clear(dst_id->override_library, true);
- }
+
+ BKE_lib_override_library_clear(dst_id->override_library, true);
}
else if (src_id->override_library == NULL) {
/* Virtual overrides of embedded data does not require any extra work. */
diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c
index 0f81d45c10f..e687e94073d 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -96,9 +96,8 @@ bool BKE_lib_query_foreachid_process(LibraryForeachIDData *data, ID **id_pp, int
}
return true;
}
- else {
- return false;
- }
+
+ return false;
}
int BKE_lib_query_foreachid_process_flags_get(LibraryForeachIDData *data)
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 7e859799a4e..faaaafc391d 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -124,13 +124,11 @@ static MaskSplinePoint *mask_spline_point_next(MaskSpline *spline,
if (spline->flag & MASK_SPLINE_CYCLIC) {
return &points_array[0];
}
- else {
- return NULL;
- }
- }
- else {
- return point + 1;
+
+ return NULL;
}
+
+ return point + 1;
}
static MaskSplinePoint *mask_spline_point_prev(MaskSpline *spline,
@@ -141,13 +139,11 @@ static MaskSplinePoint *mask_spline_point_prev(MaskSpline *spline,
if (spline->flag & MASK_SPLINE_CYCLIC) {
return &points_array[spline->tot_point - 1];
}
- else {
- return NULL;
- }
- }
- else {
- return point - 1;
+
+ return NULL;
}
+
+ return point - 1;
}
BezTriple *BKE_mask_spline_point_next_bezt(MaskSpline *spline,
@@ -158,13 +154,11 @@ BezTriple *BKE_mask_spline_point_next_bezt(MaskSpline *spline,
if (spline->flag & MASK_SPLINE_CYCLIC) {
return &(points_array[0].bezt);
}
- else {
- return NULL;
- }
- }
- else {
- return &((point + 1))->bezt;
+
+ return NULL;
}
+
+ return &((point + 1))->bezt;
}
MaskSplinePoint *BKE_mask_spline_point_array(MaskSpline *spline)
@@ -703,15 +697,14 @@ float BKE_mask_point_weight_scalar(MaskSpline *spline, MaskSplinePoint *point, c
if (!bezt_next) {
return bezt->weight;
}
- else if (u <= 0.0f) {
+ if (u <= 0.0f) {
return bezt->weight;
}
- else if (u >= 1.0f) {
+ if (u >= 1.0f) {
return bezt_next->weight;
}
- else {
- return mask_point_interp_weight(bezt, bezt_next, u);
- }
+
+ return mask_point_interp_weight(bezt, bezt_next, u);
}
float BKE_mask_point_weight(MaskSpline *spline, MaskSplinePoint *point, const float u)
@@ -724,53 +717,51 @@ float BKE_mask_point_weight(MaskSpline *spline, MaskSplinePoint *point, const fl
if (!bezt_next) {
return bezt->weight;
}
- else if (u <= 0.0f) {
+ if (u <= 0.0f) {
return bezt->weight;
}
- else if (u >= 1.0f) {
+ if (u >= 1.0f) {
return bezt_next->weight;
}
- else {
- float cur_u = 0.0f, cur_w = 0.0f, next_u = 0.0f, next_w = 0.0f, fac; /* Quite warnings */
- int i;
- for (i = 0; i <= point->tot_uw; i++) {
+ float cur_u = 0.0f, cur_w = 0.0f, next_u = 0.0f, next_w = 0.0f, fac; /* Quite warnings */
+ int i;
- if (i == 0) {
- cur_u = 0.0f;
- cur_w = 1.0f; /* mask_point_interp_weight will scale it */
- }
- else {
- cur_u = point->uw[i - 1].u;
- cur_w = point->uw[i - 1].w;
- }
+ for (i = 0; i <= point->tot_uw; i++) {
- if (i == point->tot_uw) {
- next_u = 1.0f;
- next_w = 1.0f; /* mask_point_interp_weight will scale it */
- }
- else {
- next_u = point->uw[i].u;
- next_w = point->uw[i].w;
- }
-
- if (u >= cur_u && u <= next_u) {
- break;
- }
+ if (i == 0) {
+ cur_u = 0.0f;
+ cur_w = 1.0f; /* mask_point_interp_weight will scale it */
+ }
+ else {
+ cur_u = point->uw[i - 1].u;
+ cur_w = point->uw[i - 1].w;
}
- fac = (u - cur_u) / (next_u - cur_u);
-
- cur_w *= mask_point_interp_weight(bezt, bezt_next, cur_u);
- next_w *= mask_point_interp_weight(bezt, bezt_next, next_u);
-
- if (spline->weight_interp == MASK_SPLINE_INTERP_EASE) {
- return cur_w + (next_w - cur_w) * (3.0f * fac * fac - 2.0f * fac * fac * fac);
+ if (i == point->tot_uw) {
+ next_u = 1.0f;
+ next_w = 1.0f; /* mask_point_interp_weight will scale it */
}
else {
- return (1.0f - fac) * cur_w + fac * next_w;
+ next_u = point->uw[i].u;
+ next_w = point->uw[i].w;
}
+
+ if (u >= cur_u && u <= next_u) {
+ break;
+ }
+ }
+
+ fac = (u - cur_u) / (next_u - cur_u);
+
+ cur_w *= mask_point_interp_weight(bezt, bezt_next, cur_u);
+ next_w *= mask_point_interp_weight(bezt, bezt_next, next_u);
+
+ if (spline->weight_interp == MASK_SPLINE_INTERP_EASE) {
+ return cur_w + (next_w - cur_w) * (3.0f * fac * fac - 2.0f * fac * fac * fac);
}
+
+ return (1.0f - fac) * cur_w + fac * next_w;
}
MaskSplinePointUW *BKE_mask_point_sort_uw(MaskSplinePoint *point, MaskSplinePointUW *uw)
@@ -1642,7 +1633,7 @@ MaskLayerShape *BKE_mask_layer_shape_find_frame(MaskLayer *masklay, const int fr
if (frame == masklay_shape->frame) {
return masklay_shape;
}
- else if (frame < masklay_shape->frame) {
+ if (frame < masklay_shape->frame) {
break;
}
}
@@ -1667,17 +1658,16 @@ int BKE_mask_layer_shape_find_frame_range(MaskLayer *masklay,
*r_masklay_shape_b = NULL;
return 1;
}
- else if (frame < masklay_shape->frame) {
+ if (frame < masklay_shape->frame) {
if (masklay_shape->prev) {
*r_masklay_shape_a = masklay_shape->prev;
*r_masklay_shape_b = masklay_shape;
return 2;
}
- else {
- *r_masklay_shape_a = masklay_shape;
- *r_masklay_shape_b = NULL;
- return 1;
- }
+
+ *r_masklay_shape_a = masklay_shape;
+ *r_masklay_shape_b = NULL;
+ return 1;
}
}
@@ -1686,12 +1676,11 @@ int BKE_mask_layer_shape_find_frame_range(MaskLayer *masklay,
*r_masklay_shape_b = NULL;
return 1;
}
- else {
- *r_masklay_shape_a = NULL;
- *r_masklay_shape_b = NULL;
- return 0;
- }
+ *r_masklay_shape_a = NULL;
+ *r_masklay_shape_b = NULL;
+
+ return 0;
}
MaskLayerShape *BKE_mask_layer_shape_verify_frame(MaskLayer *masklay, const int frame)
@@ -1738,12 +1727,11 @@ static int mask_layer_shape_sort_cb(const void *masklay_shape_a_ptr,
if (masklay_shape_a->frame < masklay_shape_b->frame) {
return -1;
}
- else if (masklay_shape_a->frame > masklay_shape_b->frame) {
+ if (masklay_shape_a->frame > masklay_shape_b->frame) {
return 1;
}
- else {
- return 0;
- }
+
+ return 0;
}
void BKE_mask_layer_shape_sort(MaskLayer *masklay)
diff --git a/source/blender/blenkernel/intern/mask_evaluate.c b/source/blender/blenkernel/intern/mask_evaluate.c
index 9b281103a0f..d0f80bf92b9 100644
--- a/source/blender/blenkernel/intern/mask_evaluate.c
+++ b/source/blender/blenkernel/intern/mask_evaluate.c
@@ -126,9 +126,8 @@ int BKE_mask_spline_differentiate_calc_total(const MaskSpline *spline, const uns
if (spline->flag & MASK_SPLINE_CYCLIC) {
return spline->tot_point * resol;
}
- else {
- return ((spline->tot_point - 1) * resol) + 1;
- }
+
+ return ((spline->tot_point - 1) * resol) + 1;
}
float (*BKE_mask_spline_differentiate_with_resolution(MaskSpline *spline,
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index 01d44d070b3..b28cd9c6c8e 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -354,43 +354,38 @@ static bool layer_bucket_isect_test(const MaskRasterLayer *layer,
if (isect_point_tri_v2(cent, v1, v2, v3)) {
return true;
}
- else {
- if ((dist_squared_to_line_segment_v2(cent, v1, v2) < bucket_max_rad_squared) ||
- (dist_squared_to_line_segment_v2(cent, v2, v3) < bucket_max_rad_squared) ||
- (dist_squared_to_line_segment_v2(cent, v3, v1) < bucket_max_rad_squared)) {
- return true;
- }
- else {
- // printf("skip tri\n");
- return false;
- }
- }
- }
- else {
- const float *v1 = cos[face[0]];
- const float *v2 = cos[face[1]];
- const float *v3 = cos[face[2]];
- const float *v4 = cos[face[3]];
- if (isect_point_tri_v2(cent, v1, v2, v3)) {
+ if ((dist_squared_to_line_segment_v2(cent, v1, v2) < bucket_max_rad_squared) ||
+ (dist_squared_to_line_segment_v2(cent, v2, v3) < bucket_max_rad_squared) ||
+ (dist_squared_to_line_segment_v2(cent, v3, v1) < bucket_max_rad_squared)) {
return true;
}
- else if (isect_point_tri_v2(cent, v1, v3, v4)) {
- return true;
- }
- else {
- if ((dist_squared_to_line_segment_v2(cent, v1, v2) < bucket_max_rad_squared) ||
- (dist_squared_to_line_segment_v2(cent, v2, v3) < bucket_max_rad_squared) ||
- (dist_squared_to_line_segment_v2(cent, v3, v4) < bucket_max_rad_squared) ||
- (dist_squared_to_line_segment_v2(cent, v4, v1) < bucket_max_rad_squared)) {
- return true;
- }
- else {
- // printf("skip quad\n");
- return false;
- }
- }
+
+ // printf("skip tri\n");
+ return false;
+ }
+
+ const float *v1 = cos[face[0]];
+ const float *v2 = cos[face[1]];
+ const float *v3 = cos[face[2]];
+ const float *v4 = cos[face[3]];
+
+ if (isect_point_tri_v2(cent, v1, v2, v3)) {
+ return true;
+ }
+ if (isect_point_tri_v2(cent, v1, v3, v4)) {
+ return true;
}
+
+ if ((dist_squared_to_line_segment_v2(cent, v1, v2) < bucket_max_rad_squared) ||
+ (dist_squared_to_line_segment_v2(cent, v2, v3) < bucket_max_rad_squared) ||
+ (dist_squared_to_line_segment_v2(cent, v3, v4) < bucket_max_rad_squared) ||
+ (dist_squared_to_line_segment_v2(cent, v4, v1) < bucket_max_rad_squared)) {
+ return true;
+ }
+
+ // printf("skip quad\n");
+ return false;
}
static void layer_bucket_init_dummy(MaskRasterLayer *layer)
@@ -1348,9 +1343,8 @@ static float layer_bucket_depth_from_xy(MaskRasterLayer *layer, const float xy[2
}
return best_dist;
}
- else {
- return 1.0f;
- }
+
+ return 1.0f;
}
float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float xy[2])
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index e878a894b27..0520ba3faae 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -268,27 +268,27 @@ Material ***BKE_object_material_array_p(Object *ob)
Mesh *me = ob->data;
return &(me->mat);
}
- else if (ELEM(ob->type, OB_CURVE, OB_FONT, OB_SURF)) {
+ if (ELEM(ob->type, OB_CURVE, OB_FONT, OB_SURF)) {
Curve *cu = ob->data;
return &(cu->mat);
}
- else if (ob->type == OB_MBALL) {
+ if (ob->type == OB_MBALL) {
MetaBall *mb = ob->data;
return &(mb->mat);
}
- else if (ob->type == OB_GPENCIL) {
+ if (ob->type == OB_GPENCIL) {
bGPdata *gpd = ob->data;
return &(gpd->mat);
}
- else if (ob->type == OB_HAIR) {
+ if (ob->type == OB_HAIR) {
Hair *hair = ob->data;
return &(hair->mat);
}
- else if (ob->type == OB_POINTCLOUD) {
+ if (ob->type == OB_POINTCLOUD) {
PointCloud *pointcloud = ob->data;
return &(pointcloud->mat);
}
- else if (ob->type == OB_VOLUME) {
+ if (ob->type == OB_VOLUME) {
Volume *volume = ob->data;
return &(volume->mat);
}
@@ -301,27 +301,27 @@ short *BKE_object_material_len_p(Object *ob)
Mesh *me = ob->data;
return &(me->totcol);
}
- else if (ELEM(ob->type, OB_CURVE, OB_FONT, OB_SURF)) {
+ if (ELEM(ob->type, OB_CURVE, OB_FONT, OB_SURF)) {
Curve *cu = ob->data;
return &(cu->totcol);
}
- else if (ob->type == OB_MBALL) {
+ if (ob->type == OB_MBALL) {
MetaBall *mb = ob->data;
return &(mb->totcol);
}
- else if (ob->type == OB_GPENCIL) {
+ if (ob->type == OB_GPENCIL) {
bGPdata *gpd = ob->data;
return &(gpd->totcol);
}
- else if (ob->type == OB_HAIR) {
+ if (ob->type == OB_HAIR) {
Hair *hair = ob->data;
return &(hair->totcol);
}
- else if (ob->type == OB_POINTCLOUD) {
+ if (ob->type == OB_POINTCLOUD) {
PointCloud *pointcloud = ob->data;
return &(pointcloud->totcol);
}
- else if (ob->type == OB_VOLUME) {
+ if (ob->type == OB_VOLUME) {
Volume *volume = ob->data;
return &(volume->totcol);
}
@@ -582,7 +582,7 @@ Material **BKE_object_material_get_p(Object *ob, short act)
if (act > ob->totcol) {
return NULL;
}
- else if (act <= 0) {
+ if (act <= 0) {
if (act < 0) {
CLOG_ERROR(&LOG, "Negative material index!");
}
@@ -627,9 +627,8 @@ Material *BKE_gpencil_material(Object *ob, short act)
if (ma != NULL) {
return ma;
}
- else {
- return BKE_material_default_gpencil();
- }
+
+ return BKE_material_default_gpencil();
}
MaterialGPencilStyle *BKE_gpencil_material_settings(Object *ob, short act)
@@ -642,9 +641,8 @@ MaterialGPencilStyle *BKE_gpencil_material_settings(Object *ob, short act)
return ma->gp_style;
}
- else {
- return BKE_material_default_gpencil()->gp_style;
- }
+
+ return BKE_material_default_gpencil()->gp_style;
}
void BKE_object_material_resize(Main *bmain, Object *ob, const short totcol, bool do_id_user)
@@ -1135,9 +1133,8 @@ static bNode *nodetree_uv_node_recursive(bNode *node)
if (inode->typeinfo->nclass == NODE_CLASS_INPUT && inode->typeinfo->type == SH_NODE_UVMAP) {
return inode;
}
- else {
- return nodetree_uv_node_recursive(inode);
- }
+
+ return nodetree_uv_node_recursive(inode);
}
}
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 94e5f435a43..3a514608c77 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -341,9 +341,8 @@ bool BKE_mball_is_basis_for(Object *ob1, Object *ob2)
if (STREQ(basis1name, basis2name)) {
return BKE_mball_is_basis(ob1);
}
- else {
- return false;
- }
+
+ return false;
}
bool BKE_mball_is_any_selected(const MetaBall *mb)
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 048af022adb..fccc4380fec 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -591,9 +591,8 @@ bool BKE_mesh_has_custom_loop_normals(Mesh *me)
if (me->edit_mesh) {
return CustomData_has_layer(&me->edit_mesh->bm->ldata, CD_CUSTOMLOOPNORMAL);
}
- else {
- return CustomData_has_layer(&me->ldata, CD_CUSTOMLOOPNORMAL);
- }
+
+ return CustomData_has_layer(&me->ldata, CD_CUSTOMLOOPNORMAL);
}
/** Free (or release) any data used by this mesh (does not free the mesh itself). */
@@ -1096,9 +1095,8 @@ Mesh *BKE_mesh_from_object(Object *ob)
if (ob->type == OB_MESH) {
return ob->data;
}
- else {
- return NULL;
- }
+
+ return NULL;
}
void BKE_mesh_assign_object(Main *bmain, Object *ob, Mesh *me)
@@ -1270,12 +1268,11 @@ int BKE_mesh_edge_other_vert(const MEdge *e, int v)
if (e->v1 == v) {
return e->v2;
}
- else if (e->v2 == v) {
+ if (e->v2 == v) {
return e->v1;
}
- else {
- return -1;
- }
+
+ return -1;
}
/**
@@ -1406,30 +1403,29 @@ void BKE_mesh_do_versions_cd_flag_init(Mesh *mesh)
if (UNLIKELY(mesh->cd_flag)) {
return;
}
- else {
- MVert *mv;
- MEdge *med;
- int i;
- for (mv = mesh->mvert, i = 0; i < mesh->totvert; mv++, i++) {
- if (mv->bweight != 0) {
- mesh->cd_flag |= ME_CDFLAG_VERT_BWEIGHT;
- break;
- }
+ MVert *mv;
+ MEdge *med;
+ int i;
+
+ for (mv = mesh->mvert, i = 0; i < mesh->totvert; mv++, i++) {
+ if (mv->bweight != 0) {
+ mesh->cd_flag |= ME_CDFLAG_VERT_BWEIGHT;
+ break;
}
+ }
- for (med = mesh->medge, i = 0; i < mesh->totedge; med++, i++) {
- if (med->bweight != 0) {
- mesh->cd_flag |= ME_CDFLAG_EDGE_BWEIGHT;
- if (mesh->cd_flag & ME_CDFLAG_EDGE_CREASE) {
- break;
- }
+ for (med = mesh->medge, i = 0; i < mesh->totedge; med++, i++) {
+ if (med->bweight != 0) {
+ mesh->cd_flag |= ME_CDFLAG_EDGE_BWEIGHT;
+ if (mesh->cd_flag & ME_CDFLAG_EDGE_CREASE) {
+ break;
}
- if (med->crease != 0) {
- mesh->cd_flag |= ME_CDFLAG_EDGE_CREASE;
- if (mesh->cd_flag & ME_CDFLAG_EDGE_BWEIGHT) {
- break;
- }
+ }
+ if (med->crease != 0) {
+ mesh->cd_flag |= ME_CDFLAG_EDGE_CREASE;
+ if (mesh->cd_flag & ME_CDFLAG_EDGE_BWEIGHT) {
+ break;
}
}
}
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c
index 49957b584ad..fe4b8a60796 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -1408,7 +1408,7 @@ static bool loop_split_generator_check_cyclic_smooth_fan(const MLoop *mloops,
return false;
}
/* Smooth loop/edge... */
- else if (BLI_BITMAP_TEST(skip_loops, mlfan_vert_index)) {
+ if (BLI_BITMAP_TEST(skip_loops, mlfan_vert_index)) {
if (mlfan_vert_index == ml_curr_index) {
/* We walked around a whole cyclic smooth fan without finding any already-processed loop,
* means we can use initial ml_curr/ml_prev edge as start for this smooth fan. */
@@ -1417,10 +1417,9 @@ static bool loop_split_generator_check_cyclic_smooth_fan(const MLoop *mloops,
/* ... already checked in some previous looping, we can abort. */
return false;
}
- else {
- /* ... we can skip it in future, and keep checking the smooth fan. */
- BLI_BITMAP_ENABLE(skip_loops, mlfan_vert_index);
- }
+
+ /* ... we can skip it in future, and keep checking the smooth fan. */
+ BLI_BITMAP_ENABLE(skip_loops, mlfan_vert_index);
}
}
@@ -2315,22 +2314,21 @@ float BKE_mesh_calc_poly_area(const MPoly *mpoly, const MLoop *loopstart, const
return area_tri_v3(
mvarray[loopstart[0].v].co, mvarray[loopstart[1].v].co, mvarray[loopstart[2].v].co);
}
- else {
- int i;
- const MLoop *l_iter = loopstart;
- float area;
- float(*vertexcos)[3] = BLI_array_alloca(vertexcos, (size_t)mpoly->totloop);
-
- /* pack vertex cos into an array for area_poly_v3 */
- for (i = 0; i < mpoly->totloop; i++, l_iter++) {
- copy_v3_v3(vertexcos[i], mvarray[l_iter->v].co);
- }
- /* finally calculate the area */
- area = area_poly_v3((const float(*)[3])vertexcos, (unsigned int)mpoly->totloop);
+ int i;
+ const MLoop *l_iter = loopstart;
+ float area;
+ float(*vertexcos)[3] = BLI_array_alloca(vertexcos, (size_t)mpoly->totloop);
- return area;
+ /* pack vertex cos into an array for area_poly_v3 */
+ for (i = 0; i < mpoly->totloop; i++, l_iter++) {
+ copy_v3_v3(vertexcos[i], mvarray[l_iter->v].co);
}
+
+ /* finally calculate the area */
+ area = area_poly_v3((const float(*)[3])vertexcos, (unsigned int)mpoly->totloop);
+
+ return area;
}
float BKE_mesh_calc_area(const Mesh *me)
diff --git a/source/blender/blenkernel/intern/mesh_mapping.c b/source/blender/blenkernel/intern/mesh_mapping.c
index 686f58a0ceb..3572939f78c 100644
--- a/source/blender/blenkernel/intern/mesh_mapping.c
+++ b/source/blender/blenkernel/intern/mesh_mapping.c
@@ -1047,10 +1047,9 @@ static bool mesh_check_island_boundary_uv(const MPoly *UNUSED(mp),
}
return false;
}
- else {
- /* Edge is UV boundary if tagged as seam. */
- return (me->flag & ME_SEAM) != 0;
- }
+
+ /* Edge is UV boundary if tagged as seam. */
+ return (me->flag & ME_SEAM) != 0;
}
static bool mesh_calc_islands_loop_poly_uv(MVert *UNUSED(verts),
diff --git a/source/blender/blenkernel/intern/mesh_merge.c b/source/blender/blenkernel/intern/mesh_merge.c
index 1b9b8ea6572..ef28e9958fc 100644
--- a/source/blender/blenkernel/intern/mesh_merge.c
+++ b/source/blender/blenkernel/intern/mesh_merge.c
@@ -115,11 +115,10 @@ static int cddm_poly_compare(MLoop *mloop_array,
same_loops = true;
break; /* Polys are identical */
}
- else {
- compare_completed = true;
- same_loops = false;
- break; /* Polys are different */
- }
+
+ compare_completed = true;
+ same_loops = false;
+ break; /* Polys are different */
}
mloop_source++;
@@ -201,9 +200,8 @@ static bool poly_gset_compare_fn(const void *k1, const void *k2)
/* Equality - note that this does not mean equality of polys */
return false;
}
- else {
- return true;
- }
+
+ return true;
}
/**
@@ -412,7 +410,7 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh,
/* In this mode, all vertices merged is enough to dump face */
continue;
}
- else if (merge_mode == MESH_MERGE_VERTS_DUMP_IF_EQUAL) {
+ if (merge_mode == MESH_MERGE_VERTS_DUMP_IF_EQUAL) {
/* Additional condition for face dump: target vertices must make up an identical face */
/* The test has 2 steps: (1) first step is fast ghash lookup, but not failproof */
/* (2) second step is thorough but more costly poly compare */
@@ -578,7 +576,7 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh,
BLI_assert(created_edges == 0);
continue;
}
- else if (UNLIKELY(c < 3)) {
+ if (UNLIKELY(c < 3)) {
STACK_DISCARD(oldl, c);
STACK_DISCARD(mloop, c);
if (created_edges > 0) {
diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c
index a4991675d2d..a8937f74dee 100644
--- a/source/blender/blenkernel/intern/mesh_remap.c
+++ b/source/blender/blenkernel/intern/mesh_remap.c
@@ -73,9 +73,8 @@ static bool mesh_remap_bvhtree_query_nearest(BVHTreeFromMesh *treedata,
*r_hit_dist = sqrtf(nearest->dist_sq);
return true;
}
- else {
- return false;
- }
+
+ return false;
}
static bool mesh_remap_bvhtree_query_raycast(BVHTreeFromMesh *treedata,
@@ -107,9 +106,8 @@ static bool mesh_remap_bvhtree_query_raycast(BVHTreeFromMesh *treedata,
*r_hit_dist = rayhit->dist;
return true;
}
- else {
- return false;
- }
+
+ return false;
}
/** \} */
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index 4d8c0568eb6..b9a7f2613a3 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -111,7 +111,7 @@ static int int64_cmp(const void *v1, const void *v2)
if (x1 > x2) {
return 1;
}
- else if (x1 < x2) {
+ if (x1 < x2) {
return -1;
}
@@ -125,28 +125,28 @@ static int search_face_cmp(const void *v1, const void *v2)
if (sfa->es[0].edval > sfb->es[0].edval) {
return 1;
}
- else if (sfa->es[0].edval < sfb->es[0].edval) {
+ if (sfa->es[0].edval < sfb->es[0].edval) {
return -1;
}
- else if (sfa->es[1].edval > sfb->es[1].edval) {
+ if (sfa->es[1].edval > sfb->es[1].edval) {
return 1;
}
- else if (sfa->es[1].edval < sfb->es[1].edval) {
+ if (sfa->es[1].edval < sfb->es[1].edval) {
return -1;
}
- else if (sfa->es[2].edval > sfb->es[2].edval) {
+ if (sfa->es[2].edval > sfb->es[2].edval) {
return 1;
}
- else if (sfa->es[2].edval < sfb->es[2].edval) {
+ if (sfa->es[2].edval < sfb->es[2].edval) {
return -1;
}
- else if (sfa->es[3].edval > sfb->es[3].edval) {
+ if (sfa->es[3].edval > sfb->es[3].edval) {
return 1;
}
- else if (sfa->es[3].edval < sfb->es[3].edval) {
+ if (sfa->es[3].edval < sfb->es[3].edval) {
return -1;
}
@@ -1082,9 +1082,8 @@ bool BKE_mesh_validate(Mesh *me, const bool do_verbose, const bool cddata_check_
DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY);
return true;
}
- else {
- return false;
- }
+
+ return false;
}
/**
@@ -1161,9 +1160,8 @@ bool BKE_mesh_validate_material_indices(Mesh *me)
DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY);
return true;
}
- else {
- return false;
- }
+
+ return false;
}
/** \} */
@@ -1341,13 +1339,13 @@ static int vergedgesort(const void *v1, const void *v2)
if (x1->v1 > x2->v1) {
return 1;
}
- else if (x1->v1 < x2->v1) {
+ if (x1->v1 < x2->v1) {
return -1;
}
- else if (x1->v2 > x2->v2) {
+ if (x1->v2 > x2->v2) {
return 1;
}
- else if (x1->v2 < x2->v2) {
+ if (x1->v2 < x2->v2) {
return -1;
}
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 327e8bfca7a..5789e0f0557 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -112,9 +112,8 @@ const ModifierTypeInfo *BKE_modifier_get_info(ModifierType type)
if (type < NUM_MODIFIER_TYPES && modifier_types[type] && modifier_types[type]->name[0] != '\0') {
return modifier_types[type];
}
- else {
- return NULL;
- }
+
+ return NULL;
}
/**
@@ -919,11 +918,10 @@ const char *BKE_modifier_path_relbase(Main *bmain, Object *ob)
if (G.relbase_valid || ID_IS_LINKED(ob)) {
return ID_BLEND_PATH(bmain, &ob->id);
}
- else {
- /* last resort, better then using "" which resolves to the current
- * working directory */
- return BKE_tempdir_session();
- }
+
+ /* last resort, better then using "" which resolves to the current
+ * working directory */
+ return BKE_tempdir_session();
}
const char *BKE_modifier_path_relbase_from_global(Object *ob)
@@ -931,11 +929,10 @@ const char *BKE_modifier_path_relbase_from_global(Object *ob)
if (G.relbase_valid || ID_IS_LINKED(ob)) {
return ID_BLEND_PATH_FROM_GLOBAL(&ob->id);
}
- else {
- /* last resort, better then using "" which resolves to the current
- * working directory */
- return BKE_tempdir_session();
- }
+
+ /* last resort, better then using "" which resolves to the current
+ * working directory */
+ return BKE_tempdir_session();
}
/* initializes the path with either */
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index a5bd2ecf68a..dcac7b01899 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -717,9 +717,8 @@ static bool put_imbuf_cache(
IMB_moviecache_put(clip->cache->moviecache, &key, ibuf);
return true;
}
- else {
- return IMB_moviecache_put_if_possible(clip->cache->moviecache, &key, ibuf);
- }
+
+ return IMB_moviecache_put_if_possible(clip->cache->moviecache, &key, ibuf);
}
static bool moviecache_check_free_proxy(ImBuf *UNUSED(ibuf), void *userkey, void *UNUSED(userdata))
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 6c10f6de855..392f95af917 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -407,15 +407,14 @@ int multires_get_level(const Scene *scene,
return (scene != NULL) ? get_render_subsurf_level(&scene->r, mmd->renderlvl, true) :
mmd->renderlvl;
}
- else if (ob->mode == OB_MODE_SCULPT) {
+ if (ob->mode == OB_MODE_SCULPT) {
return mmd->sculptlvl;
}
- else if (ignore_simplify) {
+ if (ignore_simplify) {
return mmd->lvl;
}
- else {
- return (scene != NULL) ? get_render_subsurf_level(&scene->r, mmd->lvl, false) : mmd->lvl;
- }
+
+ return (scene != NULL) ? get_render_subsurf_level(&scene->r, mmd->lvl, false) : mmd->lvl;
}
void multires_set_tot_level(Object *ob, MultiresModifierData *mmd, int lvl)
@@ -553,7 +552,7 @@ static int get_levels_from_disps(Object *ob)
if (md->totdisp == lvl_totdisp) {
break;
}
- else if (md->totdisp < lvl_totdisp) {
+ if (md->totdisp < lvl_totdisp) {
totlvl--;
}
else {
diff --git a/source/blender/blenkernel/intern/multires_unsubdivide.c b/source/blender/blenkernel/intern/multires_unsubdivide.c
index fa1a53f946e..c9bb9518230 100644
--- a/source/blender/blenkernel/intern/multires_unsubdivide.c
+++ b/source/blender/blenkernel/intern/multires_unsubdivide.c
@@ -111,7 +111,7 @@ static BMVert *unsubdivide_find_any_pole(BMesh *bm, int *elem_id, int elem)
if (is_vertex_in_id(v, elem_id, elem) && is_vertex_pole_three(v)) {
return v;
}
- else if (is_vertex_in_id(v, elem_id, elem) && is_vertex_pole(v)) {
+ if (is_vertex_in_id(v, elem_id, elem) && is_vertex_pole(v)) {
pole = v;
}
}
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 7012688686b..1ba82b352d1 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -480,46 +480,41 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short
if (mode == NLATIME_CONVERT_MAP) {
return strip->end - scale * (cframe - strip->actstart);
}
- else if (mode == NLATIME_CONVERT_UNMAP) {
+ if (mode == NLATIME_CONVERT_UNMAP) {
return (strip->end + (strip->actstart * scale - cframe)) / scale;
}
- else { /* if (mode == NLATIME_CONVERT_EVAL) */
- if (IS_EQF((float)cframe, strip->end) && IS_EQF(strip->repeat, floorf(strip->repeat))) {
- /* This case prevents the motion snapping back to the first frame at the end of the strip
- * by catching the case where repeats is a whole number, which means that the end of the
- * strip could also be interpreted as the end of the start of a repeat. */
- return strip->actstart;
- }
- else {
- /* - the 'fmod(..., actlength * scale)' is needed to get the repeats working
- * - the '/ scale' is needed to ensure that scaling influences the timing within the repeat
- */
- return strip->actend - fmodf(cframe - strip->start, actlength * scale) / scale;
- }
+ /* if (mode == NLATIME_CONVERT_EVAL) */
+ if (IS_EQF((float)cframe, strip->end) && IS_EQF(strip->repeat, floorf(strip->repeat))) {
+ /* This case prevents the motion snapping back to the first frame at the end of the strip
+ * by catching the case where repeats is a whole number, which means that the end of the
+ * strip could also be interpreted as the end of the start of a repeat. */
+ return strip->actstart;
}
+
+ /* - the 'fmod(..., actlength * scale)' is needed to get the repeats working
+ * - the '/ scale' is needed to ensure that scaling influences the timing within the repeat
+ */
+ return strip->actend - fmodf(cframe - strip->start, actlength * scale) / scale;
}
- else {
- if (mode == NLATIME_CONVERT_MAP) {
- return strip->start + scale * (cframe - strip->actstart);
- }
- else if (mode == NLATIME_CONVERT_UNMAP) {
- return strip->actstart + (cframe - strip->start) / scale;
- }
- else { /* if (mode == NLATIME_CONVERT_EVAL) */
- if (IS_EQF(cframe, strip->end) && IS_EQF(strip->repeat, floorf(strip->repeat))) {
- /* This case prevents the motion snapping back to the first frame at the end of the strip
- * by catching the case where repeats is a whole number, which means that the end of the
- * strip could also be interpreted as the end of the start of a repeat. */
- return strip->actend;
- }
- else {
- /* - the 'fmod(..., actlength * scale)' is needed to get the repeats working
- * - the '/ scale' is needed to ensure that scaling influences the timing within the repeat
- */
- return strip->actstart + fmodf(cframe - strip->start, actlength * scale) / scale;
- }
- }
+
+ if (mode == NLATIME_CONVERT_MAP) {
+ return strip->start + scale * (cframe - strip->actstart);
+ }
+ if (mode == NLATIME_CONVERT_UNMAP) {
+ return strip->actstart + (cframe - strip->start) / scale;
+ }
+ /* if (mode == NLATIME_CONVERT_EVAL) */
+ if (IS_EQF(cframe, strip->end) && IS_EQF(strip->repeat, floorf(strip->repeat))) {
+ /* This case prevents the motion snapping back to the first frame at the end of the strip
+ * by catching the case where repeats is a whole number, which means that the end of the
+ * strip could also be interpreted as the end of the start of a repeat. */
+ return strip->actend;
}
+
+ /* - the 'fmod(..., actlength * scale)' is needed to get the repeats working
+ * - the '/ scale' is needed to ensure that scaling influences the timing within the repeat
+ */
+ return strip->actstart + fmodf(cframe - strip->start, actlength * scale) / scale;
}
/* non clipped mapping for strip-time <-> global time (for Transitions)
@@ -537,18 +532,15 @@ static float nlastrip_get_frame_transition(NlaStrip *strip, float cframe, short
if (mode == NLATIME_CONVERT_MAP) {
return strip->end - (length * cframe);
}
- else {
- return (strip->end - cframe) / length;
- }
+
+ return (strip->end - cframe) / length;
}
- else {
- if (mode == NLATIME_CONVERT_MAP) {
- return (length * cframe) + strip->start;
- }
- else {
- return (cframe - strip->start) / length;
- }
+
+ if (mode == NLATIME_CONVERT_MAP) {
+ return (length * cframe) + strip->start;
}
+
+ return (cframe - strip->start) / length;
}
/* non clipped mapping for strip-time <-> global time
@@ -882,11 +874,10 @@ bool BKE_nlameta_add_strip(NlaStrip *mstrip, NlaStrip *strip)
return true;
}
- else { /* failed... no room before */
- return false;
- }
+ /* failed... no room before */
+ return false;
}
- else if (strip->end > mstrip->end) {
+ if (strip->end > mstrip->end) {
/* check if strip to the right (if it exists) starts before the
* end of the strip we're trying to add
*/
@@ -897,14 +888,12 @@ bool BKE_nlameta_add_strip(NlaStrip *mstrip, NlaStrip *strip)
return true;
}
- else { /* failed... no room after */
- return false;
- }
- }
- else {
- /* just try to add to the meta-strip (no dimension changes needed) */
- return BKE_nlastrips_add_strip(&mstrip->strips, strip);
+ /* failed... no room after */
+ return false;
}
+
+ /* just try to add to the meta-strip (no dimension changes needed) */
+ return BKE_nlastrips_add_strip(&mstrip->strips, strip);
}
/* Adjust the settings of NLA-Strips contained within a Meta-Strip (recursively),
@@ -1034,7 +1023,7 @@ NlaTrack *BKE_nlatrack_find_tweaked(AnimData *adt)
if (BLI_findindex(&nlt->strips, adt->actstrip) != -1) {
return nlt;
}
- else if (G.debug & G_DEBUG) {
+ if (G.debug & G_DEBUG) {
printf("%s: Active strip (%p, %s) not in NLA track found (%p, %s)\n",
__func__,
adt->actstrip,
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 91693abd1cf..174e1c12033 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1266,9 +1266,8 @@ bNode *nodeFindRootParent(bNode *node)
if (node->parent) {
return nodeFindRootParent(node->parent);
}
- else {
- return node->type == NODE_FRAME ? node : NULL;
- }
+
+ return node->type == NODE_FRAME ? node : NULL;
}
/**
@@ -1280,7 +1279,7 @@ bool nodeIsChildOf(const bNode *parent, const bNode *child)
if (parent == child) {
return true;
}
- else if (child->parent) {
+ if (child->parent) {
return nodeIsChildOf(parent, child->parent);
}
return false;
@@ -1339,9 +1338,8 @@ static void iter_backwards_ex(const bNodeTree *ntree,
if (link->fromnode->iter_flag & recursion_mask) {
continue;
}
- else {
- link->fromnode->iter_flag |= recursion_mask;
- }
+
+ link->fromnode->iter_flag |= recursion_mask;
if (!callback(link->fromnode, link->tonode, userdata)) {
return;
@@ -2582,9 +2580,8 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
return ltree;
}
- else {
- return NULL;
- }
+
+ return NULL;
}
/* sync local composite with real tree */
@@ -2989,9 +2986,8 @@ bNode *nodeGetActiveID(bNodeTree *ntree, short idtype)
return node_get_active_id_recursive(
ntree->active_viewer_key, NODE_INSTANCE_KEY_BASE, ntree, idtype);
}
- else {
- return NULL;
- }
+
+ return NULL;
}
bool nodeSetActiveID(bNodeTree *ntree, short idtype, ID *id)
@@ -3127,9 +3123,8 @@ int nodeSocketLinkLimit(struct bNodeSocket *sock)
int limit = (sock->in_out == SOCK_IN) ? stype->input_link_limit : stype->output_link_limit;
return limit;
}
- else {
- return sock->limit;
- }
+
+ return sock->limit;
}
/* ************** Node Clipboard *********** */
@@ -3419,9 +3414,8 @@ bool BKE_node_instance_hash_tag_key(bNodeInstanceHash *hash, bNodeInstanceKey ke
entry->tag = 1;
return true;
}
- else {
- return false;
- }
+
+ return false;
}
void BKE_node_instance_hash_remove_untagged(bNodeInstanceHash *hash,
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index fe559d2a44e..024e60ea989 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -666,14 +666,14 @@ bool BKE_object_support_modifier_type_check(const Object *ob, int modifier_type)
if (ob->type == OB_HAIR) {
return (mti->modifyHair != NULL) || (mti->flags & eModifierTypeFlag_AcceptsVertexCosOnly);
}
- else if (ob->type == OB_POINTCLOUD) {
+ if (ob->type == OB_POINTCLOUD) {
return (mti->modifyPointCloud != NULL) ||
(mti->flags & eModifierTypeFlag_AcceptsVertexCosOnly);
}
- else if (ob->type == OB_VOLUME) {
+ if (ob->type == OB_VOLUME) {
return (mti->modifyVolume != NULL);
}
- else if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
+ if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
if (ob->type == OB_LATTICE && (mti->flags & eModifierTypeFlag_AcceptsVertexCosOnly) == 0) {
return false;
}
@@ -1597,9 +1597,8 @@ bool BKE_object_pose_context_check(const Object *ob)
if ((ob) && (ob->type == OB_ARMATURE) && (ob->pose) && (ob->mode & OB_MODE_POSE)) {
return true;
}
- else {
- return false;
- }
+
+ return false;
}
Object *BKE_object_pose_armature_get(Object *ob)
@@ -3207,9 +3206,8 @@ bool BKE_object_empty_image_frame_is_visible_in_view3d(const Object *ob, const R
if (rv3d->is_persp) {
return (visibility_flag & OB_EMPTY_IMAGE_HIDE_PERSPECTIVE) == 0;
}
- else {
- return (visibility_flag & OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC) == 0;
- }
+
+ return (visibility_flag & OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC) == 0;
}
bool BKE_object_empty_image_data_is_visible_in_view3d(const Object *ob, const RegionView3D *rv3d)
@@ -3269,31 +3267,30 @@ bool BKE_object_minmax_dupli(Depsgraph *depsgraph,
if ((ob->transflag & OB_DUPLI) == 0) {
return ok;
}
- else {
- ListBase *lb;
- DupliObject *dob;
- lb = object_duplilist(depsgraph, scene, ob);
- for (dob = lb->first; dob; dob = dob->next) {
- if ((use_hidden == false) && (dob->no_draw != 0)) {
- /* pass */
- }
- else {
- BoundBox *bb = BKE_object_boundbox_get(dob->ob);
-
- if (bb) {
- int i;
- for (i = 0; i < 8; i++) {
- float vec[3];
- mul_v3_m4v3(vec, dob->mat, bb->vec[i]);
- minmax_v3v3_v3(r_min, r_max, vec);
- }
- ok = true;
+ ListBase *lb;
+ DupliObject *dob;
+ lb = object_duplilist(depsgraph, scene, ob);
+ for (dob = lb->first; dob; dob = dob->next) {
+ if ((use_hidden == false) && (dob->no_draw != 0)) {
+ /* pass */
+ }
+ else {
+ BoundBox *bb = BKE_object_boundbox_get(dob->ob);
+
+ if (bb) {
+ int i;
+ for (i = 0; i < 8; i++) {
+ float vec[3];
+ mul_v3_m4v3(vec, dob->mat, bb->vec[i]);
+ minmax_v3v3_v3(r_min, r_max, vec);
}
+
+ ok = true;
}
}
- free_object_duplilist(lb); /* does restore */
}
+ free_object_duplilist(lb); /* does restore */
return ok;
}
@@ -3636,9 +3633,8 @@ static int pc_cmp(const void *a, const void *b)
if (POINTER_AS_INT(ad->data) > POINTER_AS_INT(bd->data)) {
return 1;
}
- else {
- return 0;
- }
+
+ return 0;
}
int BKE_object_insert_ptcache(Object *ob)
@@ -3917,12 +3913,11 @@ bool BKE_object_flag_test_recursive(const Object *ob, short flag)
if (ob->flag & flag) {
return true;
}
- else if (ob->parent) {
+ if (ob->parent) {
return BKE_object_flag_test_recursive(ob->parent, flag);
}
- else {
- return false;
- }
+
+ return false;
}
bool BKE_object_is_child_recursive(const Object *ob_parent, const Object *ob_child)
@@ -4029,15 +4024,15 @@ static bool constructive_modifier_is_deform_modified(ModifierData *md)
(amd->curve_ob != NULL && object_moves_in_time(amd->curve_ob)) ||
(amd->offset_ob != NULL && object_moves_in_time(amd->offset_ob));
}
- else if (md->type == eModifierType_Mirror) {
+ if (md->type == eModifierType_Mirror) {
MirrorModifierData *mmd = (MirrorModifierData *)md;
return mmd->mirror_ob != NULL && object_moves_in_time(mmd->mirror_ob);
}
- else if (md->type == eModifierType_Screw) {
+ if (md->type == eModifierType_Screw) {
ScrewModifierData *smd = (ScrewModifierData *)md;
return smd->ob_axis != NULL && object_moves_in_time(smd->ob_axis);
}
- else if (md->type == eModifierType_MeshSequenceCache) {
+ if (md->type == eModifierType_MeshSequenceCache) {
/* NOTE: Not ideal because it's unknown whether topology changes or not.
* This will be detected later, so by assuming it's only deformation
* going on here we allow to bake deform-only mesh to Alembic and have
diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c
index 51ec89cf77d..04f7529c6cd 100644
--- a/source/blender/blenkernel/intern/object_deform.c
+++ b/source/blender/blenkernel/intern/object_deform.c
@@ -145,7 +145,7 @@ MDeformVert *BKE_object_defgroup_data_create(ID *id)
me->dvert = CustomData_add_layer(&me->vdata, CD_MDEFORMVERT, CD_CALLOC, NULL, me->totvert);
return me->dvert;
}
- else if (GS(id->name) == ID_LT) {
+ if (GS(id->name) == ID_LT) {
Lattice *lt = (Lattice *)id;
lt->dvert = MEM_callocN(sizeof(MDeformVert) * lt->pntsu * lt->pntsv * lt->pntsw,
"lattice deformVert");
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index e0aea3a2910..dac9b1f1cfe 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -1009,13 +1009,12 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
if (psys_get_particle_state(&sim, a, &state, 0) == 0) {
continue;
}
- else {
- float tquat[4];
- normalize_qt_qt(tquat, state.rot);
- quat_to_mat4(pamat, tquat);
- copy_v3_v3(pamat[3], state.co);
- pamat[3][3] = 1.0f;
- }
+
+ float tquat[4];
+ normalize_qt_qt(tquat, state.rot);
+ quat_to_mat4(pamat, tquat);
+ copy_v3_v3(pamat[3], state.co);
+ pamat[3][3] = 1.0f;
}
if (part->ren_as == PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) {
@@ -1152,14 +1151,14 @@ static const DupliGenerator *get_dupli_generator(const DupliContext *ctx)
if (transflag & OB_DUPLIPARTS) {
return &gen_dupli_particles;
}
- else if (transflag & OB_DUPLIVERTS) {
+ if (transflag & OB_DUPLIVERTS) {
if (ctx->object->type == OB_MESH) {
return &gen_dupli_verts;
}
- else if (ctx->object->type == OB_FONT) {
+ if (ctx->object->type == OB_FONT) {
return &gen_dupli_verts_font;
}
- else if (ctx->object->type == OB_POINTCLOUD) {
+ if (ctx->object->type == OB_POINTCLOUD) {
return &gen_dupli_verts_pointcloud;
}
}
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 198ff5a0540..ff7cbff06bf 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -760,9 +760,8 @@ bool BKE_ocean_ensure(struct OceanModifierData *omd, const int resolution)
if (omd->ocean->_M == resolution * resolution) {
return false;
}
- else {
- BKE_ocean_free(omd->ocean);
- }
+
+ BKE_ocean_free(omd->ocean);
}
omd->ocean = BKE_ocean_add();
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index 2cd5588ccb8..3f3eaae697b 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -415,11 +415,10 @@ enum ePF_FileCompare BKE_packedfile_compare_to_file(const char *ref_file_name,
ret_val = PF_CMP_DIFFERS;
break;
}
- else {
- if (memcmp(buf, ((char *)pf->data) + i, len)) {
- ret_val = PF_CMP_DIFFERS;
- break;
- }
+
+ if (memcmp(buf, ((char *)pf->data) + i, len)) {
+ ret_val = PF_CMP_DIFFERS;
+ break;
}
}
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index e7ff53f27b6..19d5c34ad73 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -426,7 +426,7 @@ Paint *BKE_paint_get_active_from_context(const bContext *C)
if (sima->mode == SI_MODE_PAINT) {
return &ts->imapaint.paint;
}
- else if (sima->mode == SI_MODE_UV) {
+ if (sima->mode == SI_MODE_UV) {
return &ts->uvsculpt->paint;
}
}
@@ -460,7 +460,7 @@ ePaintMode BKE_paintmode_get_active_from_context(const bContext *C)
if (sima->mode == SI_MODE_PAINT) {
return PAINT_MODE_TEXTURE_2D;
}
- else if (sima->mode == SI_MODE_UV) {
+ if (sima->mode == SI_MODE_UV) {
return PAINT_MODE_SCULPT_UV;
}
}
@@ -715,7 +715,7 @@ static int palettecolor_compare_hsv(const void *a1, const void *a2)
if (ps1->h > ps2->h) {
return 1;
}
- else if (ps1->h < ps2->h) {
+ if (ps1->h < ps2->h) {
return -1;
}
@@ -723,7 +723,7 @@ static int palettecolor_compare_hsv(const void *a1, const void *a2)
if (ps1->s > ps2->s) {
return 1;
}
- else if (ps1->s < ps2->s) {
+ if (ps1->s < ps2->s) {
return -1;
}
@@ -731,7 +731,7 @@ static int palettecolor_compare_hsv(const void *a1, const void *a2)
if (1.0f - ps1->v > 1.0f - ps2->v) {
return 1;
}
- else if (1.0f - ps1->v < 1.0f - ps2->v) {
+ if (1.0f - ps1->v < 1.0f - ps2->v) {
return -1;
}
@@ -747,7 +747,7 @@ static int palettecolor_compare_svh(const void *a1, const void *a2)
if (ps1->s > ps2->s) {
return 1;
}
- else if (ps1->s < ps2->s) {
+ if (ps1->s < ps2->s) {
return -1;
}
@@ -755,7 +755,7 @@ static int palettecolor_compare_svh(const void *a1, const void *a2)
if (1.0f - ps1->v > 1.0f - ps2->v) {
return 1;
}
- else if (1.0f - ps1->v < 1.0f - ps2->v) {
+ if (1.0f - ps1->v < 1.0f - ps2->v) {
return -1;
}
@@ -763,7 +763,7 @@ static int palettecolor_compare_svh(const void *a1, const void *a2)
if (ps1->h > ps2->h) {
return 1;
}
- else if (ps1->h < ps2->h) {
+ if (ps1->h < ps2->h) {
return -1;
}
@@ -778,7 +778,7 @@ static int palettecolor_compare_vhs(const void *a1, const void *a2)
if (1.0f - ps1->v > 1.0f - ps2->v) {
return 1;
}
- else if (1.0f - ps1->v < 1.0f - ps2->v) {
+ if (1.0f - ps1->v < 1.0f - ps2->v) {
return -1;
}
@@ -786,7 +786,7 @@ static int palettecolor_compare_vhs(const void *a1, const void *a2)
if (ps1->h > ps2->h) {
return 1;
}
- else if (ps1->h < ps2->h) {
+ if (ps1->h < ps2->h) {
return -1;
}
@@ -794,7 +794,7 @@ static int palettecolor_compare_vhs(const void *a1, const void *a2)
if (ps1->s > ps2->s) {
return 1;
}
- else if (ps1->s < ps2->s) {
+ if (ps1->s < ps2->s) {
return -1;
}
@@ -811,7 +811,7 @@ static int palettecolor_compare_luminance(const void *a1, const void *a2)
if (lumi1 > lumi2) {
return -1;
}
- else if (lumi1 < lumi2) {
+ if (lumi1 < lumi2) {
return 1;
}
@@ -1424,9 +1424,8 @@ MultiresModifierData *BKE_sculpt_multires_active(Scene *scene, Object *ob)
if (mmd->sculptlvl > 0) {
return mmd;
}
- else {
- return NULL;
- }
+
+ return NULL;
}
}
@@ -1468,7 +1467,7 @@ static bool sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob)
if (mti->type == eModifierTypeType_OnlyDeform) {
return true;
}
- else if ((sd->flags & SCULPT_ONLY_DEFORM) == 0) {
+ if ((sd->flags & SCULPT_ONLY_DEFORM) == 0) {
return true;
}
}
@@ -2030,8 +2029,7 @@ bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const View3D *v3d)
const bool full_shading = (v3d && (v3d->shading.type > OB_SOLID));
return !(ss->shapekey_active || ss->deform_modifiers_active || full_shading);
}
- else {
- /* Multires and dyntopo always draw directly from the PBVH. */
- return true;
- }
+
+ /* Multires and dyntopo always draw directly from the PBVH. */
+ return true;
}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 1df5cda0ce5..44c24f5a4d1 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -512,9 +512,8 @@ bool psys_check_edited(ParticleSystem *psys)
if (psys->part && psys->part->type == PART_HAIR) {
return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited));
}
- else {
- return (psys->pointcache->edit && psys->pointcache->edit->edited);
- }
+
+ return (psys->pointcache->edit && psys->pointcache->edit->edited);
}
void psys_find_group_weights(ParticleSettings *part)
@@ -1653,12 +1652,11 @@ int psys_particle_dm_face_lookup(Mesh *mesh_final,
// printf("\tNO CD_ORIGSPACE, assuming not needed\n");
return findex_orig;
}
- else {
- printf("\tNO CD_ORIGSPACE, error out of range\n");
- return DMCACHE_NOTFOUND;
- }
+
+ printf("\tNO CD_ORIGSPACE, error out of range\n");
+ return DMCACHE_NOTFOUND;
}
- else if (findex_orig >= mesh_original->totface) {
+ if (findex_orig >= mesh_original->totface) {
return DMCACHE_NOTFOUND; /* index not in the original mesh */
}
@@ -2555,9 +2553,8 @@ static void psys_thread_create_path(ParticleTask *task,
if (!needupdate) {
return;
}
- else {
- memset(child_keys, 0, sizeof(*child_keys) * (ctx->segments + 1));
- }
+
+ memset(child_keys, 0, sizeof(*child_keys) * (ctx->segments + 1));
}
/* get parent paths */
@@ -4666,10 +4663,9 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
psys_get_particle_on_path(sim, p, state, 1);
return 1;
}
- else {
- cpa = sim->psys->child + p - totpart;
- pa = sim->psys->particles + cpa->parent;
- }
+
+ cpa = sim->psys->child + p - totpart;
+ pa = sim->psys->particles + cpa->parent;
}
else {
pa = sim->psys->particles + p;
@@ -4691,106 +4687,105 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
psys_get_particle_on_path(sim, p, state, 1);
return 1;
}
- else {
- if (cpa) {
- float mat[4][4];
- ParticleKey *key1;
- float t = (cfra - pa->time) / pa->lifetime;
- float par_orco[3] = {0.0f, 0.0f, 0.0f};
- key1 = &pa->state;
- offset_child(cpa, key1, key1->rot, state, part->childflat, part->childrad);
+ if (cpa) {
+ float mat[4][4];
+ ParticleKey *key1;
+ float t = (cfra - pa->time) / pa->lifetime;
+ float par_orco[3] = {0.0f, 0.0f, 0.0f};
- CLAMP(t, 0.0f, 1.0f);
+ key1 = &pa->state;
+ offset_child(cpa, key1, key1->rot, state, part->childflat, part->childrad);
- unit_m4(mat);
- ParticleChildModifierContext modifier_ctx = {NULL};
- modifier_ctx.thread_ctx = NULL;
- modifier_ctx.sim = sim;
- modifier_ctx.ptex = NULL;
- modifier_ctx.cpa = cpa;
- modifier_ctx.orco = cpa->fuv;
- modifier_ctx.par_co = key1->co;
- modifier_ctx.par_vel = key1->vel;
- modifier_ctx.par_rot = key1->rot;
- modifier_ctx.par_orco = par_orco;
- modifier_ctx.parent_keys = psys->childcache ? psys->childcache[p - totpart] : NULL;
+ CLAMP(t, 0.0f, 1.0f);
- do_child_modifiers(&modifier_ctx, mat, state, t);
+ unit_m4(mat);
+ ParticleChildModifierContext modifier_ctx = {NULL};
+ modifier_ctx.thread_ctx = NULL;
+ modifier_ctx.sim = sim;
+ modifier_ctx.ptex = NULL;
+ modifier_ctx.cpa = cpa;
+ modifier_ctx.orco = cpa->fuv;
+ modifier_ctx.par_co = key1->co;
+ modifier_ctx.par_vel = key1->vel;
+ modifier_ctx.par_rot = key1->rot;
+ modifier_ctx.par_orco = par_orco;
+ modifier_ctx.parent_keys = psys->childcache ? psys->childcache[p - totpart] : NULL;
- if (psys->lattice_deform_data) {
- BKE_lattice_deform_data_eval_co(
- psys->lattice_deform_data, state->co, psys->lattice_strength);
- }
+ do_child_modifiers(&modifier_ctx, mat, state, t);
+
+ if (psys->lattice_deform_data) {
+ BKE_lattice_deform_data_eval_co(
+ psys->lattice_deform_data, state->co, psys->lattice_strength);
+ }
+ }
+ else {
+ if (pa->state.time == cfra || ELEM(part->phystype, PART_PHYS_NO, PART_PHYS_KEYED)) {
+ copy_particle_key(state, &pa->state, 1);
+ }
+ else if (pa->prev_state.time == cfra) {
+ copy_particle_key(state, &pa->prev_state, 1);
}
else {
- if (pa->state.time == cfra || ELEM(part->phystype, PART_PHYS_NO, PART_PHYS_KEYED)) {
- copy_particle_key(state, &pa->state, 1);
- }
- else if (pa->prev_state.time == cfra) {
- copy_particle_key(state, &pa->prev_state, 1);
- }
- else {
- float dfra, frs_sec = sim->scene->r.frs_sec;
- /* let's interpolate to try to be as accurate as possible */
- if (pa->state.time + 2.f >= state->time && pa->prev_state.time - 2.f <= state->time) {
- if (pa->prev_state.time >= pa->state.time || pa->prev_state.time < 0.f) {
- /* prev_state is wrong so let's not use it,
- * this can happen at frames 1, 0 or particle birth. */
- dfra = state->time - pa->state.time;
+ float dfra, frs_sec = sim->scene->r.frs_sec;
+ /* let's interpolate to try to be as accurate as possible */
+ if (pa->state.time + 2.f >= state->time && pa->prev_state.time - 2.f <= state->time) {
+ if (pa->prev_state.time >= pa->state.time || pa->prev_state.time < 0.f) {
+ /* prev_state is wrong so let's not use it,
+ * this can happen at frames 1, 0 or particle birth. */
+ dfra = state->time - pa->state.time;
- copy_particle_key(state, &pa->state, 1);
+ copy_particle_key(state, &pa->state, 1);
- madd_v3_v3v3fl(state->co, state->co, state->vel, dfra / frs_sec);
- }
- else {
- ParticleKey keys[4];
- float keytime;
+ madd_v3_v3v3fl(state->co, state->co, state->vel, dfra / frs_sec);
+ }
+ else {
+ ParticleKey keys[4];
+ float keytime;
- copy_particle_key(keys + 1, &pa->prev_state, 1);
- copy_particle_key(keys + 2, &pa->state, 1);
+ copy_particle_key(keys + 1, &pa->prev_state, 1);
+ copy_particle_key(keys + 2, &pa->state, 1);
- dfra = keys[2].time - keys[1].time;
+ dfra = keys[2].time - keys[1].time;
- keytime = (state->time - keys[1].time) / dfra;
+ keytime = (state->time - keys[1].time) / dfra;
- /* convert velocity to timestep size */
- mul_v3_fl(keys[1].vel, dfra * timestep);
- mul_v3_fl(keys[2].vel, dfra * timestep);
+ /* convert velocity to timestep size */
+ mul_v3_fl(keys[1].vel, dfra * timestep);
+ mul_v3_fl(keys[2].vel, dfra * timestep);
- psys_interpolate_particle(-1, keys, keytime, state, 1);
+ psys_interpolate_particle(-1, keys, keytime, state, 1);
- /* convert back to real velocity */
- mul_v3_fl(state->vel, 1.f / (dfra * timestep));
+ /* convert back to real velocity */
+ mul_v3_fl(state->vel, 1.f / (dfra * timestep));
- interp_v3_v3v3(state->ave, keys[1].ave, keys[2].ave, keytime);
- interp_qt_qtqt(state->rot, keys[1].rot, keys[2].rot, keytime);
- }
+ interp_v3_v3v3(state->ave, keys[1].ave, keys[2].ave, keytime);
+ interp_qt_qtqt(state->rot, keys[1].rot, keys[2].rot, keytime);
}
- else if (pa->state.time + 1.f >= state->time && pa->state.time - 1.f <= state->time) {
- /* linear interpolation using only pa->state */
+ }
+ else if (pa->state.time + 1.f >= state->time && pa->state.time - 1.f <= state->time) {
+ /* linear interpolation using only pa->state */
- dfra = state->time - pa->state.time;
+ dfra = state->time - pa->state.time;
- copy_particle_key(state, &pa->state, 1);
+ copy_particle_key(state, &pa->state, 1);
- madd_v3_v3v3fl(state->co, state->co, state->vel, dfra / frs_sec);
- }
- else {
- /* Extrapolating over big ranges is not accurate
- * so let's just give something close to reasonable back. */
- copy_particle_key(state, &pa->state, 0);
- }
+ madd_v3_v3v3fl(state->co, state->co, state->vel, dfra / frs_sec);
}
-
- if (sim->psys->lattice_deform_data) {
- BKE_lattice_deform_data_eval_co(
- sim->psys->lattice_deform_data, state->co, psys->lattice_strength);
+ else {
+ /* Extrapolating over big ranges is not accurate
+ * so let's just give something close to reasonable back. */
+ copy_particle_key(state, &pa->state, 0);
}
}
- return 1;
+ if (sim->psys->lattice_deform_data) {
+ BKE_lattice_deform_data_eval_co(
+ sim->psys->lattice_deform_data, state->co, psys->lattice_strength);
+ }
}
+
+ return 1;
}
void psys_get_dupli_texture(ParticleSystem *psys,
@@ -4844,9 +4839,8 @@ void psys_get_dupli_texture(ParticleSystem *psys,
orco);
return;
}
- else {
- pa = psys->particles + cpa->pa[0];
- }
+
+ pa = psys->particles + cpa->pa[0];
}
if ((part->from == PART_FROM_FACE) && (psmd->mesh_final != NULL) && !is_grid) {
diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c
index dcd2a0b8fae..29f6194d404 100644
--- a/source/blender/blenkernel/intern/particle_child.c
+++ b/source/blender/blenkernel/intern/particle_child.c
@@ -305,10 +305,9 @@ static bool check_path_length(int k,
/* something over the maximum step value */
return false;
}
- else {
- *cur_length += step_length;
- return true;
- }
+
+ *cur_length += step_length;
+ return true;
}
void psys_apply_child_modifiers(ParticleThreadContext *ctx,
diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c
index e0dccd4d14a..dc6d5e974ed 100644
--- a/source/blender/blenkernel/intern/particle_distribute.c
+++ b/source/blender/blenkernel/intern/particle_distribute.c
@@ -829,22 +829,20 @@ static int distribute_compare_orig_index(const void *p1, const void *p2, void *u
if (index1 < index2) {
return -1;
}
- else if (index1 == index2) {
+ if (index1 == index2) {
/* this pointer comparison appears to make qsort stable for glibc,
* and apparently on solaris too, makes the renders reproducible */
if (p1 < p2) {
return -1;
}
- else if (p1 == p2) {
+ if (p1 == p2) {
return 0;
}
- else {
- return 1;
- }
- }
- else {
+
return 1;
}
+
+ return 1;
}
static void distribute_invalid(ParticleSimulationData *sim, int from)
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 6bfbb4b9d00..e74c13680e2 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -106,9 +106,8 @@ static int particles_are_dynamic(ParticleSystem *psys)
if (psys->part->type == PART_HAIR) {
return psys->flag & PSYS_HAIR_DYNAMICS;
}
- else {
- return ELEM(psys->part->phystype, PART_PHYS_NEWTON, PART_PHYS_BOIDS, PART_PHYS_FLUID);
- }
+
+ return ELEM(psys->part->phystype, PART_PHYS_NEWTON, PART_PHYS_BOIDS, PART_PHYS_FLUID);
}
float psys_get_current_display_percentage(ParticleSystem *psys, const bool use_render_params)
@@ -131,12 +130,11 @@ static int tot_particles(ParticleSystem *psys, PTCacheID *pid)
if (pid && psys->pointcache->flag & PTCACHE_EXTERNAL) {
return pid->cache->totpoint;
}
- else if (psys->part->distr == PART_DISTR_GRID && psys->part->from != PART_FROM_VERT) {
+ if (psys->part->distr == PART_DISTR_GRID && psys->part->from != PART_FROM_VERT) {
return psys->part->grid_res * psys->part->grid_res * psys->part->grid_res - psys->totunexist;
}
- else {
- return psys->part->totpart - psys->totunexist;
- }
+
+ return psys->part->totpart - psys->totunexist;
}
void psys_reset(ParticleSystem *psys, int mode)
@@ -1709,13 +1707,12 @@ static void sph_evaluate_func(BVHTree *tree,
BLI_bvhtree_range_query(tree, co, interaction_radius, callback, pfr);
break;
}
- else {
- BLI_rw_mutex_lock(&psys_bvhtree_rwlock, THREAD_LOCK_READ);
- BLI_bvhtree_range_query(psys[i]->bvhtree, co, interaction_radius, callback, pfr);
+ BLI_rw_mutex_lock(&psys_bvhtree_rwlock, THREAD_LOCK_READ);
- BLI_rw_mutex_unlock(&psys_bvhtree_rwlock);
- }
+ BLI_bvhtree_range_query(psys[i]->bvhtree, co, interaction_radius, callback, pfr);
+
+ BLI_rw_mutex_unlock(&psys_bvhtree_rwlock);
}
}
static void sph_density_accum_cb(void *userdata, int index, const float co[3], float squared_dist)
@@ -2612,9 +2609,8 @@ static float collision_newton_rhapson(ParticleCollision *col,
d1 = 0.f;
continue;
}
- else {
- return -1.f;
- }
+
+ return -1.f;
}
dd = (t1 - t0) / (d1 - d0);
@@ -2634,7 +2630,7 @@ static float collision_newton_rhapson(ParticleCollision *col,
d1 = 0.f;
continue;
}
- else if (iter == 1 && (t1 < -COLLISION_ZERO || t1 > 1.f)) {
+ if (iter == 1 && (t1 < -COLLISION_ZERO || t1 > 1.f)) {
return -1.f;
}
@@ -2648,9 +2644,8 @@ static float collision_newton_rhapson(ParticleCollision *col,
return t1;
}
- else {
- return -1.f;
- }
+
+ return -1.f;
}
}
return -1.0;
@@ -2927,164 +2922,163 @@ static int collision_response(ParticleSimulationData *sim,
return 0;
}
/* figure out velocity and other data after collision */
- else {
- /* velocity directly before collision to be modified into velocity directly after collision */
- float v0[3];
- /* normal component of v0 */
- float v0_nor[3];
- /* tangential component of v0 */
- float v0_tan[3];
- /* tangential component of collision surface velocity */
- float vc_tan[3];
- float v0_dot, vc_dot;
- float damp = pd->pdef_damp + pd->pdef_rdamp * 2 * (BLI_rng_get_float(rng) - 0.5f);
- float frict = pd->pdef_frict + pd->pdef_rfrict * 2 * (BLI_rng_get_float(rng) - 0.5f);
- float distance, nor[3], dot;
-
- CLAMP(damp, 0.0f, 1.0f);
- CLAMP(frict, 0.0f, 1.0f);
-
- /* get exact velocity right before collision */
- madd_v3_v3v3fl(v0, col->ve1, col->acc, dt1);
-
- /* Convert collider velocity from `1/frame_step` to `1/s` TODO:
- * here we assume 1 frame step for collision modifier. */
- mul_v3_fl(pce->vel, col->inv_timestep);
-
- /* calculate tangential particle velocity */
- v0_dot = dot_v3v3(pce->nor, v0);
- madd_v3_v3v3fl(v0_tan, v0, pce->nor, -v0_dot);
-
- /* calculate tangential collider velocity */
- vc_dot = dot_v3v3(pce->nor, pce->vel);
- madd_v3_v3v3fl(vc_tan, pce->vel, pce->nor, -vc_dot);
-
- /* handle friction effects (tangential and angular velocity) */
- if (frict > 0.0f) {
- /* angular <-> linear velocity */
- if (dynamic_rotation) {
- float vr_tan[3], v1_tan[3], ave[3];
-
- /* linear velocity of particle surface */
- cross_v3_v3v3(vr_tan, pce->nor, pa->state.ave);
- mul_v3_fl(vr_tan, pa->size);
-
- /* change to coordinates that move with the collision plane */
- sub_v3_v3v3(v1_tan, v0_tan, vc_tan);
-
- /* The resulting velocity is a weighted average of particle cm & surface
- * velocity. This weight (related to particle's moment of inertia) could
- * be made a parameter for angular <-> linear conversion.
- */
- madd_v3_v3fl(v1_tan, vr_tan, -0.4);
- mul_v3_fl(v1_tan, 1.0f / 1.4f); /* 1/(1+0.4) */
- /* rolling friction is around 0.01 of sliding friction
- * (could be made a parameter) */
- mul_v3_fl(v1_tan, 1.0f - 0.01f * frict);
-
- /* surface_velocity is opposite to cm velocity */
- negate_v3_v3(vr_tan, v1_tan);
-
- /* get back to global coordinates */
- add_v3_v3(v1_tan, vc_tan);
-
- /* convert to angular velocity*/
- cross_v3_v3v3(ave, vr_tan, pce->nor);
- mul_v3_fl(ave, 1.0f / MAX2(pa->size, 0.001f));
-
- /* only friction will cause change in linear & angular velocity */
- interp_v3_v3v3(pa->state.ave, pa->state.ave, ave, frict);
- interp_v3_v3v3(v0_tan, v0_tan, v1_tan, frict);
- }
- else {
- /* just basic friction (unphysical due to the friction model used in Blender) */
- interp_v3_v3v3(v0_tan, v0_tan, vc_tan, frict);
- }
+ /* velocity directly before collision to be modified into velocity directly after collision */
+ float v0[3];
+ /* normal component of v0 */
+ float v0_nor[3];
+ /* tangential component of v0 */
+ float v0_tan[3];
+ /* tangential component of collision surface velocity */
+ float vc_tan[3];
+ float v0_dot, vc_dot;
+ float damp = pd->pdef_damp + pd->pdef_rdamp * 2 * (BLI_rng_get_float(rng) - 0.5f);
+ float frict = pd->pdef_frict + pd->pdef_rfrict * 2 * (BLI_rng_get_float(rng) - 0.5f);
+ float distance, nor[3], dot;
+
+ CLAMP(damp, 0.0f, 1.0f);
+ CLAMP(frict, 0.0f, 1.0f);
+
+ /* get exact velocity right before collision */
+ madd_v3_v3v3fl(v0, col->ve1, col->acc, dt1);
+
+ /* Convert collider velocity from `1/frame_step` to `1/s` TODO:
+ * here we assume 1 frame step for collision modifier. */
+ mul_v3_fl(pce->vel, col->inv_timestep);
+
+ /* calculate tangential particle velocity */
+ v0_dot = dot_v3v3(pce->nor, v0);
+ madd_v3_v3v3fl(v0_tan, v0, pce->nor, -v0_dot);
+
+ /* calculate tangential collider velocity */
+ vc_dot = dot_v3v3(pce->nor, pce->vel);
+ madd_v3_v3v3fl(vc_tan, pce->vel, pce->nor, -vc_dot);
+
+ /* handle friction effects (tangential and angular velocity) */
+ if (frict > 0.0f) {
+ /* angular <-> linear velocity */
+ if (dynamic_rotation) {
+ float vr_tan[3], v1_tan[3], ave[3];
+
+ /* linear velocity of particle surface */
+ cross_v3_v3v3(vr_tan, pce->nor, pa->state.ave);
+ mul_v3_fl(vr_tan, pa->size);
+
+ /* change to coordinates that move with the collision plane */
+ sub_v3_v3v3(v1_tan, v0_tan, vc_tan);
+
+ /* The resulting velocity is a weighted average of particle cm & surface
+ * velocity. This weight (related to particle's moment of inertia) could
+ * be made a parameter for angular <-> linear conversion.
+ */
+ madd_v3_v3fl(v1_tan, vr_tan, -0.4);
+ mul_v3_fl(v1_tan, 1.0f / 1.4f); /* 1/(1+0.4) */
+
+ /* rolling friction is around 0.01 of sliding friction
+ * (could be made a parameter) */
+ mul_v3_fl(v1_tan, 1.0f - 0.01f * frict);
+
+ /* surface_velocity is opposite to cm velocity */
+ negate_v3_v3(vr_tan, v1_tan);
+
+ /* get back to global coordinates */
+ add_v3_v3(v1_tan, vc_tan);
+
+ /* convert to angular velocity*/
+ cross_v3_v3v3(ave, vr_tan, pce->nor);
+ mul_v3_fl(ave, 1.0f / MAX2(pa->size, 0.001f));
+
+ /* only friction will cause change in linear & angular velocity */
+ interp_v3_v3v3(pa->state.ave, pa->state.ave, ave, frict);
+ interp_v3_v3v3(v0_tan, v0_tan, v1_tan, frict);
}
+ else {
+ /* just basic friction (unphysical due to the friction model used in Blender) */
+ interp_v3_v3v3(v0_tan, v0_tan, vc_tan, frict);
+ }
+ }
- /* Stickiness was possibly added before,
- * so cancel that before calculating new normal velocity.
- * Otherwise particles go flying out of the surface
- * because of high reversed sticky velocity. */
- if (v0_dot < 0.0f) {
- v0_dot += pd->pdef_stickness;
- if (v0_dot > 0.0f) {
- v0_dot = 0.0f;
- }
+ /* Stickiness was possibly added before,
+ * so cancel that before calculating new normal velocity.
+ * Otherwise particles go flying out of the surface
+ * because of high reversed sticky velocity. */
+ if (v0_dot < 0.0f) {
+ v0_dot += pd->pdef_stickness;
+ if (v0_dot > 0.0f) {
+ v0_dot = 0.0f;
}
+ }
- /* damping and flipping of velocity around normal */
- v0_dot *= 1.0f - damp;
- vc_dot *= through ? damp : 1.0f;
+ /* damping and flipping of velocity around normal */
+ v0_dot *= 1.0f - damp;
+ vc_dot *= through ? damp : 1.0f;
- /* calculate normal particle velocity */
- /* special case for object hitting the particle from behind */
- if (through == 0 && ((vc_dot > 0.0f && v0_dot > 0.0f && vc_dot > v0_dot) ||
- (vc_dot < 0.0f && v0_dot < 0.0f && vc_dot < v0_dot))) {
- mul_v3_v3fl(v0_nor, pce->nor, vc_dot);
- }
- else if (v0_dot > 0.f) {
- mul_v3_v3fl(v0_nor, pce->nor, vc_dot + v0_dot);
- }
- else {
- mul_v3_v3fl(v0_nor, pce->nor, vc_dot + (through ? 1.0f : -1.0f) * v0_dot);
- }
+ /* calculate normal particle velocity */
+ /* special case for object hitting the particle from behind */
+ if (through == 0 && ((vc_dot > 0.0f && v0_dot > 0.0f && vc_dot > v0_dot) ||
+ (vc_dot < 0.0f && v0_dot < 0.0f && vc_dot < v0_dot))) {
+ mul_v3_v3fl(v0_nor, pce->nor, vc_dot);
+ }
+ else if (v0_dot > 0.f) {
+ mul_v3_v3fl(v0_nor, pce->nor, vc_dot + v0_dot);
+ }
+ else {
+ mul_v3_v3fl(v0_nor, pce->nor, vc_dot + (through ? 1.0f : -1.0f) * v0_dot);
+ }
- /* combine components together again */
- add_v3_v3v3(v0, v0_nor, v0_tan);
+ /* combine components together again */
+ add_v3_v3v3(v0, v0_nor, v0_tan);
- if (col->boid) {
- /* keep boids above ground */
- BoidParticle *bpa = pa->boid;
- if (bpa->data.mode == eBoidMode_OnLand || co[2] <= col->boid_z) {
- co[2] = col->boid_z;
- v0[2] = 0.0f;
- }
+ if (col->boid) {
+ /* keep boids above ground */
+ BoidParticle *bpa = pa->boid;
+ if (bpa->data.mode == eBoidMode_OnLand || co[2] <= col->boid_z) {
+ co[2] = col->boid_z;
+ v0[2] = 0.0f;
}
+ }
- /* re-apply acceleration to final location and velocity */
- madd_v3_v3v3fl(pa->state.co, co, v0, dt2);
- madd_v3_v3fl(pa->state.co, col->acc, 0.5f * dt2 * dt2);
- madd_v3_v3v3fl(pa->state.vel, v0, col->acc, dt2);
+ /* re-apply acceleration to final location and velocity */
+ madd_v3_v3v3fl(pa->state.co, co, v0, dt2);
+ madd_v3_v3fl(pa->state.co, col->acc, 0.5f * dt2 * dt2);
+ madd_v3_v3v3fl(pa->state.vel, v0, col->acc, dt2);
- /* make sure particle stays on the right side of the surface */
- if (!through) {
- distance = collision_point_distance_with_normal(co, pce, -1.f, col, nor);
+ /* make sure particle stays on the right side of the surface */
+ if (!through) {
+ distance = collision_point_distance_with_normal(co, pce, -1.f, col, nor);
- if (distance < col->radius + COLLISION_MIN_DISTANCE) {
- madd_v3_v3fl(co, nor, col->radius + COLLISION_MIN_DISTANCE - distance);
- }
+ if (distance < col->radius + COLLISION_MIN_DISTANCE) {
+ madd_v3_v3fl(co, nor, col->radius + COLLISION_MIN_DISTANCE - distance);
+ }
- dot = dot_v3v3(nor, v0);
- if (dot < 0.f) {
- madd_v3_v3fl(v0, nor, -dot);
- }
+ dot = dot_v3v3(nor, v0);
+ if (dot < 0.f) {
+ madd_v3_v3fl(v0, nor, -dot);
+ }
- distance = collision_point_distance_with_normal(pa->state.co, pce, 1.f, col, nor);
+ distance = collision_point_distance_with_normal(pa->state.co, pce, 1.f, col, nor);
- if (distance < col->radius + COLLISION_MIN_DISTANCE) {
- madd_v3_v3fl(pa->state.co, nor, col->radius + COLLISION_MIN_DISTANCE - distance);
- }
+ if (distance < col->radius + COLLISION_MIN_DISTANCE) {
+ madd_v3_v3fl(pa->state.co, nor, col->radius + COLLISION_MIN_DISTANCE - distance);
+ }
- dot = dot_v3v3(nor, pa->state.vel);
- if (dot < 0.f) {
- madd_v3_v3fl(pa->state.vel, nor, -dot);
- }
+ dot = dot_v3v3(nor, pa->state.vel);
+ if (dot < 0.f) {
+ madd_v3_v3fl(pa->state.vel, nor, -dot);
}
+ }
- /* add stickiness to surface */
- madd_v3_v3fl(pa->state.vel, pce->nor, -pd->pdef_stickness);
+ /* add stickiness to surface */
+ madd_v3_v3fl(pa->state.vel, pce->nor, -pd->pdef_stickness);
- /* set coordinates for next iteration */
- copy_v3_v3(col->co1, co);
- copy_v3_v3(col->co2, pa->state.co);
+ /* set coordinates for next iteration */
+ copy_v3_v3(col->co1, co);
+ copy_v3_v3(col->co2, pa->state.co);
- copy_v3_v3(col->ve1, v0);
- copy_v3_v3(col->ve2, pa->state.vel);
+ copy_v3_v3(col->ve1, v0);
+ copy_v3_v3(col->ve2, pa->state.vel);
- col->f = f;
- }
+ col->f = f;
/* if permeability random roll succeeded, disable collider for this sim step */
if (through) {
@@ -3676,12 +3670,11 @@ static float sync_timestep(ParticleSystem *psys, float t_frac)
if (t_frac == 1.0f) {
return psys->dt_frac;
}
- else if (t_frac + (psys->dt_frac * TIMESTEP_EXPANSION_TOLERANCE) >= 1.0f) {
+ if (t_frac + (psys->dt_frac * TIMESTEP_EXPANSION_TOLERANCE) >= 1.0f) {
return 1.0f - t_frac;
}
- else {
- return psys->dt_frac;
- }
+
+ return psys->dt_frac;
}
/************************************************/
@@ -4537,11 +4530,11 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_
return;
}
/* Cache is supposed to be baked, but no data was found so bail out */
- else if (cache->flag & PTCACHE_BAKED) {
+ if (cache->flag & PTCACHE_BAKED) {
psys_reset(psys, PSYS_RESET_CACHE_MISS);
return;
}
- else if (cache_result == PTCACHE_READ_OLD) {
+ if (cache_result == PTCACHE_READ_OLD) {
psys->cfra = (float)cache->simframe;
cached_step(sim, psys->cfra, use_render_params);
}
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 92a47f24240..fade3dad136 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -109,18 +109,15 @@ int BB_widest_axis(const BB *bb)
if (dim[0] > dim[2]) {
return 0;
}
- else {
- return 2;
- }
+
+ return 2;
}
- else {
- if (dim[1] > dim[2]) {
- return 1;
- }
- else {
- return 2;
- }
+
+ if (dim[1] > dim[2]) {
+ return 1;
}
+
+ return 2;
}
void BBC_update_centroid(BBC *bbc)
@@ -275,9 +272,8 @@ static int map_insert_vert(
*value_p = POINTER_FROM_INT(value_i);
return value_i;
}
- else {
- return POINTER_AS_INT(*value_p);
- }
+
+ return POINTER_AS_INT(*value_p);
}
/* Find vertices used by the faces in this node and update the draw buffers */
@@ -804,14 +800,13 @@ static PBVHNode *pbvh_iter_next(PBVHIter *iter)
/* immediately hit leaf node */
return node;
}
- else {
- /* come back later when children are done */
- pbvh_stack_push(iter, node, true);
- /* push two child nodes on the stack */
- pbvh_stack_push(iter, iter->pbvh->nodes + node->children_offset + 1, false);
- pbvh_stack_push(iter, iter->pbvh->nodes + node->children_offset, false);
- }
+ /* come back later when children are done */
+ pbvh_stack_push(iter, node, true);
+
+ /* push two child nodes on the stack */
+ pbvh_stack_push(iter, iter->pbvh->nodes + node->children_offset + 1, false);
+ pbvh_stack_push(iter, iter->pbvh->nodes + node->children_offset, false);
}
return NULL;
@@ -838,10 +833,9 @@ static PBVHNode *pbvh_iter_next_occluded(PBVHIter *iter)
/* immediately hit leaf node */
return node;
}
- else {
- pbvh_stack_push(iter, iter->pbvh->nodes + node->children_offset + 1, false);
- pbvh_stack_push(iter, iter->pbvh->nodes + node->children_offset, false);
- }
+
+ pbvh_stack_push(iter, iter->pbvh->nodes + node->children_offset + 1, false);
+ pbvh_stack_push(iter, iter->pbvh->nodes + node->children_offset, false);
}
return NULL;
@@ -1391,16 +1385,15 @@ static int pbvh_flush_bb(PBVH *pbvh, PBVHNode *node, int flag)
return update;
}
- else {
- update |= pbvh_flush_bb(pbvh, pbvh->nodes + node->children_offset, flag);
- update |= pbvh_flush_bb(pbvh, pbvh->nodes + node->children_offset + 1, flag);
- if (update & PBVH_UpdateBB) {
- update_node_vb(pbvh, node);
- }
- if (update & PBVH_UpdateOriginalBB) {
- node->orig_vb = node->vb;
- }
+ update |= pbvh_flush_bb(pbvh, pbvh->nodes + node->children_offset, flag);
+ update |= pbvh_flush_bb(pbvh, pbvh->nodes + node->children_offset + 1, flag);
+
+ if (update & PBVH_UpdateBB) {
+ update_node_vb(pbvh, node);
+ }
+ if (update & PBVH_UpdateOriginalBB) {
+ node->orig_vb = node->vb;
}
return update;
@@ -1667,9 +1660,8 @@ bool BKE_pbvh_has_faces(const PBVH *pbvh)
if (pbvh->type == PBVH_BMESH) {
return (pbvh->bm->totface != 0);
}
- else {
- return (pbvh->totprim != 0);
- }
+
+ return (pbvh->totprim != 0);
}
void BKE_pbvh_bounding_box(const PBVH *pbvh, float min[3], float max[3])
@@ -2029,9 +2021,8 @@ bool ray_face_intersection_quad(const float ray_start[3],
*depth = depth_test;
return true;
}
- else {
- return false;
- }
+
+ return false;
}
bool ray_face_intersection_tri(const float ray_start[3],
@@ -2047,9 +2038,8 @@ bool ray_face_intersection_tri(const float ray_start[3],
*depth = depth_test;
return true;
}
- else {
- return false;
- }
+
+ return false;
}
/* Take advantage of the fact we know this wont be an intersection.
@@ -2100,9 +2090,8 @@ bool ray_face_nearest_quad(const float ray_start[3],
}
return true;
}
- else {
- return false;
- }
+
+ return false;
}
bool ray_face_nearest_tri(const float ray_start[3],
@@ -2122,9 +2111,8 @@ bool ray_face_nearest_tri(const float ray_start[3],
*depth = depth_test;
return true;
}
- else {
- return false;
- }
+
+ return false;
}
static bool pbvh_faces_node_raycast(PBVH *pbvh,
@@ -2617,7 +2605,7 @@ static PlaneAABBIsect test_frustum_aabb(const float bb_min[3],
if (dot_v3v3(planes[i], vmin) + planes[i][3] < 0) {
return ISECT_OUTSIDE;
}
- else if (dot_v3v3(planes[i], vmax) + planes[i][3] <= 0) {
+ if (dot_v3v3(planes[i], vmax) + planes[i][3] <= 0) {
ret = ISECT_INTERSECT;
}
}
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index e87c7c8d46d..a04fa1506d0 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -184,14 +184,13 @@ static BMVert *bm_vert_hash_lookup_chain(GHash *deleted_verts, BMVert *v)
/* not remapped*/
return v;
}
- else if (*v_next_p == NULL) {
+ if (*v_next_p == NULL) {
/* removed and not remapped */
return NULL;
}
- else {
- /* remapped */
- v = *v_next_p;
- }
+
+ /* remapped */
+ v = *v_next_p;
}
}
@@ -1738,9 +1737,8 @@ static void pbvh_bmesh_node_limit_ensure_fast(
candidate = i_iter;
break;
}
- else {
- num_child2++;
- }
+
+ num_child2++;
}
if (candidate != -1) {
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index c2c5b42dbb0..ae18f3289e4 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1404,9 +1404,8 @@ static int ptcache_dynamicpaint_totpoint(void *sd, int UNUSED(cfra))
if (!surface->data) {
return 0;
}
- else {
- return surface->data->total_points;
- }
+
+ return surface->data->total_points;
}
static void ptcache_dynamicpaint_error(void *UNUSED(sd), const char *UNUSED(message))
@@ -2128,7 +2127,7 @@ static int ptcache_path(PTCacheID *pid, char *filename)
return BLI_path_slash_ensure(filename); /* new strlen() */
}
- else if (G.relbase_valid || lib) {
+ if (G.relbase_valid || lib) {
char file[MAX_PTCACHE_PATH]; /* we don't want the dir, only the file */
BLI_split_file_part(blendfilename, file, sizeof(file));
@@ -2521,9 +2520,8 @@ int BKE_ptcache_mem_index_find(PTCacheMem *pm, unsigned int index)
return -1;
}
- else {
- return (index < pm->totpoint ? index : -1);
- }
+
+ return (index < pm->totpoint ? index : -1);
}
void BKE_ptcache_mem_pointers_init(PTCacheMem *pm)
@@ -2627,10 +2625,10 @@ static int ptcache_old_elemsize(PTCacheID *pid)
if (pid->type == PTCACHE_TYPE_SOFTBODY) {
return 6 * sizeof(float);
}
- else if (pid->type == PTCACHE_TYPE_PARTICLES) {
+ if (pid->type == PTCACHE_TYPE_PARTICLES) {
return sizeof(ParticleKey);
}
- else if (pid->type == PTCACHE_TYPE_CLOTH) {
+ if (pid->type == PTCACHE_TYPE_CLOTH) {
return 9 * sizeof(float);
}
@@ -3585,16 +3583,15 @@ int BKE_ptcache_id_exist(PTCacheID *pid, int cfra)
return BLI_exists(filename);
}
- else {
- PTCacheMem *pm = pid->cache->mem_cache.first;
- for (; pm; pm = pm->next) {
- if (pm->frame == cfra) {
- return 1;
- }
+ PTCacheMem *pm = pid->cache->mem_cache.first;
+
+ for (; pm; pm = pm->next) {
+ if (pm->frame == cfra) {
+ return 1;
}
- return 0;
}
+ return 0;
}
void BKE_ptcache_id_time(
PTCacheID *pid, Scene *scene, float cfra, int *startframe, int *endframe, float *timescale)
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 7c335a8e98c..ece7d0f9136 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -2075,7 +2075,7 @@ void BKE_rigidbody_do_simulation(Depsgraph *depsgraph, Scene *scene, float ctime
return;
}
/* make sure we don't go out of cache frame range */
- else if (ctime > endframe) {
+ if (ctime > endframe) {
ctime = endframe;
}
@@ -2083,7 +2083,7 @@ void BKE_rigidbody_do_simulation(Depsgraph *depsgraph, Scene *scene, float ctime
if (rbw->shared->physics_world == NULL && !(cache->flag & PTCACHE_BAKED)) {
return;
}
- else if (rbw->objects == NULL) {
+ if (rbw->objects == NULL) {
rigidbody_update_ob_array(rbw);
}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index fdec29dd43e..bdda03bab12 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -839,83 +839,78 @@ Scene *BKE_scene_duplicate(Main *bmain, Scene *sce, eSceneCopyMethod type)
return sce_copy;
}
- else {
- eDupli_ID_Flags duplicate_flags = U.dupflag | USER_DUP_OBJECT;
- BKE_id_copy(bmain, (ID *)sce, (ID **)&sce_copy);
- id_us_min(&sce_copy->id);
- id_us_ensure_real(&sce_copy->id);
+ eDupli_ID_Flags duplicate_flags = U.dupflag | USER_DUP_OBJECT;
- BKE_animdata_duplicate_id_action(bmain, &sce_copy->id, duplicate_flags);
+ BKE_id_copy(bmain, (ID *)sce, (ID **)&sce_copy);
+ id_us_min(&sce_copy->id);
+ id_us_ensure_real(&sce_copy->id);
- /* Extra actions, most notably SCE_FULL_COPY also duplicates several 'children' datablocks. */
+ BKE_animdata_duplicate_id_action(bmain, &sce_copy->id, duplicate_flags);
- if (type == SCE_COPY_FULL) {
- /* Scene duplication is always root of duplication currently. */
- const bool is_subprocess = false;
+ /* Extra actions, most notably SCE_FULL_COPY also duplicates several 'children' datablocks. */
- if (!is_subprocess) {
- BKE_main_id_tag_all(bmain, LIB_TAG_NEW, false);
- BKE_main_id_clear_newpoins(bmain);
- /* In case root duplicated ID is linked, assume we want to get a local copy of it and
- * duplicate all expected linked data. */
- if (ID_IS_LINKED(sce)) {
- duplicate_flags |= USER_DUP_LINKED_ID;
- }
+ if (type == SCE_COPY_FULL) {
+ /* Scene duplication is always root of duplication currently. */
+ const bool is_subprocess = false;
+
+ if (!is_subprocess) {
+ BKE_main_id_tag_all(bmain, LIB_TAG_NEW, false);
+ BKE_main_id_clear_newpoins(bmain);
+ /* In case root duplicated ID is linked, assume we want to get a local copy of it and
+ * duplicate all expected linked data. */
+ if (ID_IS_LINKED(sce)) {
+ duplicate_flags |= USER_DUP_LINKED_ID;
}
+ }
- /* Copy Freestyle LineStyle datablocks. */
- LISTBASE_FOREACH (ViewLayer *, view_layer_dst, &sce_copy->view_layers) {
- LISTBASE_FOREACH (
- FreestyleLineSet *, lineset, &view_layer_dst->freestyle_config.linesets) {
- BKE_id_copy_for_duplicate(bmain, (ID *)lineset->linestyle, duplicate_flags);
- }
+ /* Copy Freestyle LineStyle datablocks. */
+ LISTBASE_FOREACH (ViewLayer *, view_layer_dst, &sce_copy->view_layers) {
+ LISTBASE_FOREACH (FreestyleLineSet *, lineset, &view_layer_dst->freestyle_config.linesets) {
+ BKE_id_copy_for_duplicate(bmain, (ID *)lineset->linestyle, duplicate_flags);
}
+ }
- /* Full copy of world (included animations) */
- BKE_id_copy_for_duplicate(bmain, (ID *)sce->world, duplicate_flags);
+ /* Full copy of world (included animations) */
+ BKE_id_copy_for_duplicate(bmain, (ID *)sce->world, duplicate_flags);
- /* Full copy of GreasePencil. */
- BKE_id_copy_for_duplicate(bmain, (ID *)sce->gpd, duplicate_flags);
+ /* Full copy of GreasePencil. */
+ BKE_id_copy_for_duplicate(bmain, (ID *)sce->gpd, duplicate_flags);
- /* Deep-duplicate collections and objects (using preferences' settings for which sub-data to
- * duplicate along the object itself). */
- BKE_collection_duplicate(bmain,
- NULL,
- sce_copy->master_collection,
- duplicate_flags,
- LIB_ID_DUPLICATE_IS_SUBPROCESS);
+ /* Deep-duplicate collections and objects (using preferences' settings for which sub-data to
+ * duplicate along the object itself). */
+ BKE_collection_duplicate(
+ bmain, NULL, sce_copy->master_collection, duplicate_flags, LIB_ID_DUPLICATE_IS_SUBPROCESS);
- if (!is_subprocess) {
- /* This code will follow into all ID links using an ID tagged with LIB_TAG_NEW.*/
- BKE_libblock_relink_to_newid(&sce_copy->id);
+ if (!is_subprocess) {
+ /* This code will follow into all ID links using an ID tagged with LIB_TAG_NEW.*/
+ BKE_libblock_relink_to_newid(&sce_copy->id);
#ifndef NDEBUG
- /* Call to `BKE_libblock_relink_to_newid` above is supposed to have cleared all those
- * flags. */
- ID *id_iter;
- FOREACH_MAIN_ID_BEGIN (bmain, id_iter) {
- BLI_assert((id_iter->tag & LIB_TAG_NEW) == 0);
- }
- FOREACH_MAIN_ID_END;
+ /* Call to `BKE_libblock_relink_to_newid` above is supposed to have cleared all those
+ * flags. */
+ ID *id_iter;
+ FOREACH_MAIN_ID_BEGIN (bmain, id_iter) {
+ BLI_assert((id_iter->tag & LIB_TAG_NEW) == 0);
+ }
+ FOREACH_MAIN_ID_END;
#endif
- /* Cleanup. */
- BKE_main_id_tag_all(bmain, LIB_TAG_NEW, false);
- BKE_main_id_clear_newpoins(bmain);
+ /* Cleanup. */
+ BKE_main_id_tag_all(bmain, LIB_TAG_NEW, false);
+ BKE_main_id_clear_newpoins(bmain);
- BKE_main_collection_sync(bmain);
- }
+ BKE_main_collection_sync(bmain);
}
- else {
- /* Remove sequencer if not full copy */
- /* XXX Why in Hell? :/ */
- remove_sequencer_fcurves(sce_copy);
- BKE_sequencer_editing_free(sce_copy, true);
- }
-
- return sce_copy;
}
+ else {
+ /* Remove sequencer if not full copy */
+ /* XXX Why in Hell? :/ */
+ remove_sequencer_fcurves(sce_copy);
+ BKE_sequencer_editing_free(sce_copy, true);
+ }
+
+ return sce_copy;
}
void BKE_scene_groups_relink(Scene *sce)
@@ -1642,7 +1637,7 @@ bool BKE_scene_remove_render_view(Scene *scene, SceneRenderView *srv)
if (act == -1) {
return false;
}
- else if (scene->r.views.first == scene->r.views.last) {
+ if (scene->r.views.first == scene->r.views.last) {
/* ensure 1 view is kept */
return false;
}
@@ -1663,13 +1658,11 @@ int get_render_subsurf_level(const RenderData *r, int lvl, bool for_render)
if (for_render) {
return min_ii(r->simplify_subsurf_render, lvl);
}
- else {
- return min_ii(r->simplify_subsurf, lvl);
- }
- }
- else {
- return lvl;
+
+ return min_ii(r->simplify_subsurf, lvl);
}
+
+ return lvl;
}
int get_render_child_particle_number(const RenderData *r, int num, bool for_render)
@@ -1678,13 +1671,11 @@ int get_render_child_particle_number(const RenderData *r, int num, bool for_rend
if (for_render) {
return (int)(r->simplify_particles_render * num);
}
- else {
- return (int)(r->simplify_particles * num);
- }
- }
- else {
- return num;
+
+ return (int)(r->simplify_particles * num);
}
+
+ return num;
}
/**
@@ -1699,7 +1690,7 @@ Base *_setlooper_base_step(Scene **sce_iter, ViewLayer *view_layer, Base *base)
/* Common case, step to the next. */
return base->next;
}
- else if ((base == NULL) && (view_layer != NULL)) {
+ if ((base == NULL) && (view_layer != NULL)) {
/* First time looping, return the scenes first base. */
/* For the first loop we should get the layer from workspace when available. */
if (view_layer->object_bases.first) {
@@ -2018,9 +2009,8 @@ const char *BKE_scene_multiview_render_view_name_get(const RenderData *rd, const
if (srv) {
return srv->name;
}
- else {
- return "";
- }
+
+ return "";
}
int BKE_scene_multiview_view_id_get(const RenderData *rd, const char *viewname)
@@ -2041,9 +2031,8 @@ int BKE_scene_multiview_view_id_get(const RenderData *rd, const char *viewname)
if (STREQ(viewname, srv->name)) {
return nr;
}
- else {
- nr += 1;
- }
+
+ nr += 1;
}
}
@@ -2094,9 +2083,8 @@ const char *BKE_scene_multiview_view_suffix_get(const RenderData *rd, const char
if (srv) {
return srv->suffix;
}
- else {
- return viewname;
- }
+
+ return viewname;
}
const char *BKE_scene_multiview_view_id_suffix_get(const RenderData *rd, const int view_id)
@@ -2104,10 +2092,9 @@ const char *BKE_scene_multiview_view_id_suffix_get(const RenderData *rd, const i
if ((rd->scemode & R_MULTIVIEW) == 0) {
return "";
}
- else {
- const char *viewname = BKE_scene_multiview_render_view_name_get(rd, view_id);
- return BKE_scene_multiview_view_suffix_get(rd, viewname);
- }
+
+ const char *viewname = BKE_scene_multiview_render_view_name_get(rd, view_id);
+ return BKE_scene_multiview_view_suffix_get(rd, viewname);
}
void BKE_scene_multiview_view_prefix_get(Scene *scene,
@@ -2175,10 +2162,9 @@ int BKE_scene_multiview_num_videos_get(const RenderData *rd)
if (rd->im_format.views_format == R_IMF_VIEWS_STEREO_3D) {
return 1;
}
- else {
- /* R_IMF_VIEWS_INDIVIDUAL */
- return BKE_scene_multiview_num_views_get(rd);
- }
+
+ /* R_IMF_VIEWS_INDIVIDUAL */
+ return BKE_scene_multiview_num_views_get(rd);
}
/* Manipulation of depsgraph storage. */
diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c
index 5c2d5b0087f..be35c7b161b 100644
--- a/source/blender/blenkernel/intern/seqcache.c
+++ b/source/blender/blenkernel/intern/seqcache.c
@@ -483,10 +483,9 @@ static size_t deflate_imbuf_to_file(ImBuf *ibuf,
return BLI_gzip_mem_to_file_at_pos(
ibuf->rect, header_entry->size_raw, file, header_entry->offset, level);
}
- else {
- return BLI_gzip_mem_to_file_at_pos(
- ibuf->rect_float, header_entry->size_raw, file, header_entry->offset, level);
- }
+
+ return BLI_gzip_mem_to_file_at_pos(
+ ibuf->rect_float, header_entry->size_raw, file, header_entry->offset, level);
}
static size_t inflate_file_to_imbuf(ImBuf *ibuf, FILE *file, DiskCacheHeaderEntry *header_entry)
@@ -495,10 +494,9 @@ static size_t inflate_file_to_imbuf(ImBuf *ibuf, FILE *file, DiskCacheHeaderEntr
return BLI_ungzip_file_to_mem_at_pos(
ibuf->rect, header_entry->size_raw, file, header_entry->offset);
}
- else {
- return BLI_ungzip_file_to_mem_at_pos(
- ibuf->rect_float, header_entry->size_raw, file, header_entry->offset);
- }
+
+ return BLI_ungzip_file_to_mem_at_pos(
+ ibuf->rect_float, header_entry->size_raw, file, header_entry->offset);
}
static void seq_disk_cache_read_header(FILE *file, DiskCacheHeader *header)
@@ -1304,11 +1302,10 @@ bool BKE_sequencer_cache_put_if_possible(const SeqRenderData *context,
BKE_sequencer_cache_put(context, seq, cfra, type, ibuf, cost, skip_disk_cache);
return true;
}
- else {
- seq_cache_set_temp_cache_linked(scene, scene->ed->cache->last_key);
- scene->ed->cache->last_key = NULL;
- return false;
- }
+
+ seq_cache_set_temp_cache_linked(scene, scene->ed->cache->last_key);
+ scene->ed->cache->last_key = NULL;
+ return false;
}
void BKE_sequencer_cache_put(const SeqRenderData *context,
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 4a2ad88bb28..55de375ce1e 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -3269,9 +3269,8 @@ float BKE_sequencer_speed_effect_target_frame_get(const SeqRenderData *context,
if (input == 0) { /* Current frame. */
return floor(seq->start + s->frameMap[nr]);
}
- else { /* Next frame. */
- return ceil(seq->start + s->frameMap[nr]);
- }
+ /* Next frame. */
+ return ceil(seq->start + s->frameMap[nr]);
}
static float speed_effect_interpolation_ratio_get(SpeedControlVars *s, Sequence *seq, float cfra)
@@ -4024,7 +4023,7 @@ static int early_out_fade(Sequence *UNUSED(seq), float facf0, float facf1)
if (facf0 == 0.0f && facf1 == 0.0f) {
return EARLY_USE_INPUT_1;
}
- else if (facf0 == 1.0f && facf1 == 1.0f) {
+ if (facf0 == 1.0f && facf1 == 1.0f) {
return EARLY_USE_INPUT_2;
}
return EARLY_DO_EFFECT;
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index b0a8f709399..a02e4b2052c 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1356,9 +1356,8 @@ const char *BKE_sequence_give_name(Sequence *seq)
if (!(seq->type & SEQ_TYPE_EFFECT)) {
return seq->strip->dir;
}
- else {
- return "Effect";
- }
+
+ return "Effect";
}
return name;
}
@@ -1662,13 +1661,12 @@ static int seq_num_files(Scene *scene, char views_format, const bool is_multivie
if (!is_multiview) {
return 1;
}
- else if (views_format == R_IMF_VIEWS_STEREO_3D) {
+ if (views_format == R_IMF_VIEWS_STEREO_3D) {
return 1;
}
/* R_IMF_VIEWS_INDIVIDUAL */
- else {
- return BKE_scene_multiview_num_views_get(&scene->r);
- }
+
+ return BKE_scene_multiview_num_views_get(&scene->r);
}
static void seq_proxy_index_dir_set(struct anim *anim, const char *base_dir)
@@ -1959,9 +1957,8 @@ static ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int c
return ibuf;
}
- else {
- return NULL;
- }
+
+ return NULL;
}
static void seq_proxy_build_frame(const SeqRenderData *context,
@@ -2056,9 +2053,8 @@ static bool seq_proxy_multiview_context_invalid(Sequence *seq, Scene *scene, con
if (BLI_access(str, R_OK) == 0) {
return false;
}
- else {
- return view_id != 0;
- }
+
+ return view_id != 0;
}
return false;
}
@@ -3351,35 +3347,34 @@ static ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr
if (!mask) {
return NULL;
}
- else {
- AnimData *adt;
- Mask *mask_temp;
- MaskRasterHandle *mr_handle;
- mask_temp = BKE_mask_copy_nolib(mask);
+ AnimData *adt;
+ Mask *mask_temp;
+ MaskRasterHandle *mr_handle;
- BKE_mask_evaluate(mask_temp, mask->sfra + nr, true);
+ mask_temp = BKE_mask_copy_nolib(mask);
- /* anim-data */
- adt = BKE_animdata_from_id(&mask->id);
- const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct(
- context->depsgraph, mask->sfra + nr);
- BKE_animsys_evaluate_animdata(&mask_temp->id, adt, &anim_eval_context, ADT_RECALC_ANIM, false);
+ BKE_mask_evaluate(mask_temp, mask->sfra + nr, true);
- maskbuf = MEM_mallocN(sizeof(float) * context->rectx * context->recty, __func__);
+ /* anim-data */
+ adt = BKE_animdata_from_id(&mask->id);
+ const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct(
+ context->depsgraph, mask->sfra + nr);
+ BKE_animsys_evaluate_animdata(&mask_temp->id, adt, &anim_eval_context, ADT_RECALC_ANIM, false);
- mr_handle = BKE_maskrasterize_handle_new();
+ maskbuf = MEM_mallocN(sizeof(float) * context->rectx * context->recty, __func__);
- BKE_maskrasterize_handle_init(
- mr_handle, mask_temp, context->rectx, context->recty, true, true, true);
+ mr_handle = BKE_maskrasterize_handle_new();
- BKE_mask_free(mask_temp);
- MEM_freeN(mask_temp);
+ BKE_maskrasterize_handle_init(
+ mr_handle, mask_temp, context->rectx, context->recty, true, true, true);
- BKE_maskrasterize_buffer(mr_handle, context->rectx, context->recty, maskbuf);
+ BKE_mask_free(mask_temp);
+ MEM_freeN(mask_temp);
- BKE_maskrasterize_handle_free(mr_handle);
- }
+ BKE_maskrasterize_buffer(mr_handle, context->rectx, context->recty, maskbuf);
+
+ BKE_maskrasterize_handle_free(mr_handle);
if (make_float) {
/* pixels */
@@ -3823,9 +3818,8 @@ static float seq_estimate_render_cost_end(Scene *scene, clock_t begin)
if (time_max != 0) {
return time_spent / time_max;
}
- else {
- return 1;
- }
+
+ return 1;
}
static ImBuf *seq_render_preprocess_ibuf(const SeqRenderData *context,
@@ -3926,7 +3920,7 @@ static int seq_get_early_out_for_blend_mode(Sequence *seq)
if (early_out == EARLY_USE_INPUT_2) {
return EARLY_USE_INPUT_1;
}
- else if (early_out == EARLY_USE_INPUT_1) {
+ if (early_out == EARLY_USE_INPUT_1) {
return EARLY_USE_INPUT_2;
}
}
@@ -4429,9 +4423,8 @@ int BKE_sequence_tx_get_final_left(Sequence *seq, bool metaclip)
return max_ii(BKE_sequence_tx_get_final_left(seq, false),
BKE_sequence_tx_get_final_left((Sequence *)seq->tmp, true));
}
- else {
- return (seq->start - seq->startstill) + seq->startofs;
- }
+
+ return (seq->start - seq->startstill) + seq->startofs;
}
int BKE_sequence_tx_get_final_right(Sequence *seq, bool metaclip)
{
@@ -4440,9 +4433,8 @@ int BKE_sequence_tx_get_final_right(Sequence *seq, bool metaclip)
return min_ii(BKE_sequence_tx_get_final_right(seq, false),
BKE_sequence_tx_get_final_right((Sequence *)seq->tmp, true));
}
- else {
- return ((seq->start + seq->len) + seq->endstill) - seq->endofs;
- }
+
+ return ((seq->start + seq->len) + seq->endstill) - seq->endofs;
}
void BKE_sequence_tx_set_final_left(Sequence *seq, int val)
@@ -4734,9 +4726,8 @@ bool BKE_sequence_base_shuffle_ex(ListBase *seqbasep,
BKE_sequence_calc(evil_scene, test);
return false;
}
- else {
- return true;
- }
+
+ return true;
}
bool BKE_sequence_base_shuffle(ListBase *seqbasep, Sequence *test, Scene *evil_scene)
@@ -4981,7 +4972,7 @@ ListBase *BKE_sequence_seqbase(ListBase *seqbase, Sequence *seq)
if (seq == iseq) {
return seqbase;
}
- else if (iseq->seqbase.first && (lb = BKE_sequence_seqbase(&iseq->seqbase, seq))) {
+ if (iseq->seqbase.first && (lb = BKE_sequence_seqbase(&iseq->seqbase, seq))) {
return lb;
}
}
@@ -4999,7 +4990,7 @@ Sequence *BKE_sequence_metastrip(ListBase *seqbase, Sequence *meta, Sequence *se
if (seq == iseq) {
return meta;
}
- else if (iseq->seqbase.first && (rval = BKE_sequence_metastrip(&iseq->seqbase, iseq, seq))) {
+ if (iseq->seqbase.first && (rval = BKE_sequence_metastrip(&iseq->seqbase, iseq, seq))) {
return rval;
}
}
@@ -5184,8 +5175,8 @@ Sequence *BKE_sequence_get_by_name(ListBase *seqbase, const char *name, bool rec
if (STREQ(name, iseq->name + 2)) {
return iseq;
}
- else if (recursive && (iseq->seqbase.first) &&
- (rseq = BKE_sequence_get_by_name(&iseq->seqbase, name, 1))) {
+ if (recursive && (iseq->seqbase.first) &&
+ (rseq = BKE_sequence_get_by_name(&iseq->seqbase, name, 1))) {
return rseq;
}
}
@@ -5207,7 +5198,7 @@ Sequence *BKE_sequencer_from_elem(ListBase *seqbase, StripElem *se)
(ARRAY_HAS_ITEM(se, iseq->strip->stripdata, iseq->len))) {
break;
}
- else if ((seq_found = BKE_sequencer_from_elem(&iseq->seqbase, se))) {
+ if ((seq_found = BKE_sequencer_from_elem(&iseq->seqbase, se))) {
iseq = seq_found;
break;
}
@@ -5247,24 +5238,22 @@ int BKE_sequencer_active_get_pair(Scene *scene, Sequence **seq_act, Sequence **s
if (*seq_act == NULL) {
return 0;
}
- else {
- Sequence *seq;
- *seq_other = NULL;
+ Sequence *seq;
- for (seq = ed->seqbasep->first; seq; seq = seq->next) {
- if (seq->flag & SELECT && (seq != (*seq_act))) {
- if (*seq_other) {
- return 0;
- }
- else {
- *seq_other = seq;
- }
+ *seq_other = NULL;
+
+ for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+ if (seq->flag & SELECT && (seq != (*seq_act))) {
+ if (*seq_other) {
+ return 0;
}
- }
- return (*seq_other != NULL);
+ *seq_other = seq;
+ }
}
+
+ return (*seq_other != NULL);
}
Mask *BKE_sequencer_mask_get(Scene *scene)
@@ -5274,9 +5263,8 @@ Mask *BKE_sequencer_mask_get(Scene *scene)
if (seq_act && seq_act->type == SEQ_TYPE_MASK) {
return seq_act->mask;
}
- else {
- return NULL;
- }
+
+ return NULL;
}
/* api like funcs for adding */
diff --git a/source/blender/blenkernel/intern/shader_fx.c b/source/blender/blenkernel/intern/shader_fx.c
index 2923298c5d5..b3d350f5ccd 100644
--- a/source/blender/blenkernel/intern/shader_fx.c
+++ b/source/blender/blenkernel/intern/shader_fx.c
@@ -160,9 +160,8 @@ const ShaderFxTypeInfo *BKE_shaderfx_get_info(ShaderFxType type)
if (type < NUM_SHADER_FX_TYPES && type > 0 && shader_fx_types[type]->name[0] != '\0') {
return shader_fx_types[type];
}
- else {
- return NULL;
- }
+
+ return NULL;
}
/**
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index 29f4c7dc6c1..25859e55d27 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -136,30 +136,29 @@ bool BKE_shrinkwrap_init_tree(
return data->bvh != NULL;
}
- else {
- if (mesh->totpoly <= 0) {
- return false;
- }
- data->bvh = BKE_bvhtree_from_mesh_get(&data->treeData, mesh, BVHTREE_FROM_LOOPTRI, 4);
+ if (mesh->totpoly <= 0) {
+ return false;
+ }
- if (data->bvh == NULL) {
- return false;
- }
+ data->bvh = BKE_bvhtree_from_mesh_get(&data->treeData, mesh, BVHTREE_FROM_LOOPTRI, 4);
- if (force_normals || BKE_shrinkwrap_needs_normals(shrinkType, shrinkMode)) {
- data->pnors = CustomData_get_layer(&mesh->pdata, CD_NORMAL);
- if ((mesh->flag & ME_AUTOSMOOTH) != 0) {
- data->clnors = CustomData_get_layer(&mesh->ldata, CD_NORMAL);
- }
- }
+ if (data->bvh == NULL) {
+ return false;
+ }
- if (shrinkType == MOD_SHRINKWRAP_TARGET_PROJECT) {
- data->boundary = mesh->runtime.shrinkwrap_data;
+ if (force_normals || BKE_shrinkwrap_needs_normals(shrinkType, shrinkMode)) {
+ data->pnors = CustomData_get_layer(&mesh->pdata, CD_NORMAL);
+ if ((mesh->flag & ME_AUTOSMOOTH) != 0) {
+ data->clnors = CustomData_get_layer(&mesh->ldata, CD_NORMAL);
}
+ }
- return true;
+ if (shrinkType == MOD_SHRINKWRAP_TARGET_PROJECT) {
+ data->boundary = mesh->runtime.shrinkwrap_data;
}
+
+ return true;
}
/* Frees the tree data if necessary. */
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index b7b325644ca..a66cba1f01a 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -3211,12 +3211,11 @@ static int object_has_edges(Object *ob)
if (ob->type == OB_MESH) {
return ((Mesh *)ob->data)->totedge;
}
- else if (ob->type == OB_LATTICE) {
+ if (ob->type == OB_LATTICE) {
return 1;
}
- else {
- return 0;
- }
+
+ return 0;
}
/* SB global visible functions */
@@ -3563,7 +3562,7 @@ void sbObjectStep(struct Depsgraph *depsgraph,
BKE_ptcache_invalidate(cache);
return;
}
- else if (framenr > endframe) {
+ if (framenr > endframe) {
framenr = endframe;
}
@@ -3631,7 +3630,7 @@ void sbObjectStep(struct Depsgraph *depsgraph,
return;
}
- else if (cache_result == PTCACHE_READ_OLD) {
+ if (cache_result == PTCACHE_READ_OLD) {
/* pass */
}
else if (/*ob->id.lib || */
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 1fcfc9b060f..060174c94a5 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -898,9 +898,8 @@ double BKE_sound_sync_scene(Scene *scene)
if (scene->audio.flag & AUDIO_SYNC) {
return AUD_getSynchronizerPosition(scene->playback_handle);
}
- else {
- return AUD_Handle_getPosition(scene->playback_handle);
- }
+
+ return AUD_Handle_getPosition(scene->playback_handle);
}
return NAN_FLT;
}
@@ -922,9 +921,8 @@ int BKE_sound_scene_playing(Scene *scene)
if (scene->audio.flag & AUDIO_SYNC) {
return AUD_isSynchronizerPlaying();
}
- else {
- return -1;
- }
+
+ return -1;
}
void BKE_sound_free_waveform(bSound *sound)
diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c
index 46341652544..ade5befeebf 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -366,23 +366,22 @@ static float *studiolight_multilayer_convert_pass(ImBuf *ibuf,
if (channels == 4) {
return rect;
}
- else {
- float *new_rect = MEM_callocN(sizeof(float[4]) * ibuf->x * ibuf->y, __func__);
-
- IMB_buffer_float_from_float(new_rect,
- rect,
- channels,
- IB_PROFILE_LINEAR_RGB,
- IB_PROFILE_LINEAR_RGB,
- false,
- ibuf->x,
- ibuf->y,
- ibuf->x,
- ibuf->x);
- MEM_freeN(rect);
- return new_rect;
- }
+ float *new_rect = MEM_callocN(sizeof(float[4]) * ibuf->x * ibuf->y, __func__);
+
+ IMB_buffer_float_from_float(new_rect,
+ rect,
+ channels,
+ IB_PROFILE_LINEAR_RGB,
+ IB_PROFILE_LINEAR_RGB,
+ false,
+ ibuf->x,
+ ibuf->y,
+ ibuf->x,
+ ibuf->x);
+
+ MEM_freeN(rect);
+ return new_rect;
}
static void studiolight_multilayer_addpass(void *base,
@@ -1229,12 +1228,11 @@ static int studiolight_cmp(const void *a, const void *b)
if (flagorder1 < flagorder2) {
return -1;
}
- else if (flagorder1 > flagorder2) {
+ if (flagorder1 > flagorder2) {
return 1;
}
- else {
- return BLI_strcasecmp(sl1->name, sl2->name);
- }
+
+ return BLI_strcasecmp(sl1->name, sl2->name);
}
/* icons */
@@ -1496,10 +1494,9 @@ struct StudioLight *BKE_studiolight_find(const char *name, int flag)
if ((sl->flag & flag)) {
return sl;
}
- else {
- /* flags do not match, so use default */
- return BKE_studiolight_find_default(flag);
- }
+
+ /* flags do not match, so use default */
+ return BKE_studiolight_find_default(flag);
}
}
/* When not found, use the default studio light */
diff --git a/source/blender/blenkernel/intern/subdiv_displacement_multires.c b/source/blender/blenkernel/intern/subdiv_displacement_multires.c
index 617f37834f9..a63c2994687 100644
--- a/source/blender/blenkernel/intern/subdiv_displacement_multires.c
+++ b/source/blender/blenkernel/intern/subdiv_displacement_multires.c
@@ -128,10 +128,10 @@ BLI_INLINE eAverageWith read_displacement_grid(const MDisps *displacement_grid,
if (x == 0 && y == 0) {
return AVERAGE_WITH_ALL;
}
- else if (x == 0) {
+ if (x == 0) {
return AVERAGE_WITH_PREV;
}
- else if (y == 0) {
+ if (y == 0) {
return AVERAGE_WITH_NEXT;
}
return AVERAGE_WITH_NONE;
@@ -321,9 +321,8 @@ static int displacement_get_face_corner(MultiresDisplacementData *data,
float dummy_corner_u, dummy_corner_v;
return BKE_subdiv_rotate_quad_to_corner(u, v, &dummy_corner_u, &dummy_corner_v);
}
- else {
- return poly_corner->corner;
- }
+
+ return poly_corner->corner;
}
static void initialize(SubdivDisplacement *displacement)
diff --git a/source/blender/blenkernel/intern/subdiv_eval.c b/source/blender/blenkernel/intern/subdiv_eval.c
index 1c10a9a1935..baee8a80f5a 100644
--- a/source/blender/blenkernel/intern/subdiv_eval.c
+++ b/source/blender/blenkernel/intern/subdiv_eval.c
@@ -46,7 +46,7 @@ bool BKE_subdiv_eval_begin(Subdiv *subdiv)
* or when OpenSubdiv is disabled */
return false;
}
- else if (subdiv->evaluator == NULL) {
+ if (subdiv->evaluator == NULL) {
BKE_subdiv_stats_begin(&subdiv->stats, SUBDIV_STATS_EVALUATOR_CREATE);
subdiv->evaluator = openSubdiv_createEvaluatorFromTopologyRefiner(subdiv->topology_refiner);
BKE_subdiv_stats_end(&subdiv->stats, SUBDIV_STATS_EVALUATOR_CREATE);
diff --git a/source/blender/blenkernel/intern/subdiv_foreach.c b/source/blender/blenkernel/intern/subdiv_foreach.c
index ff7f6fad5f0..9202635210c 100644
--- a/source/blender/blenkernel/intern/subdiv_foreach.c
+++ b/source/blender/blenkernel/intern/subdiv_foreach.c
@@ -1123,10 +1123,10 @@ static int subdiv_foreach_loops_corner_index(const float u,
if (u + du <= 0.5f && v + dv <= 0.5f) {
return 0;
}
- else if (u >= 0.5f && v + dv <= 0.5f) {
+ if (u >= 0.5f && v + dv <= 0.5f) {
return 1;
}
- else if (u >= 0.5f && v >= 0.5f) {
+ if (u >= 0.5f && v >= 0.5f) {
return 2;
}
return 3;
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 7a0a5645b80..98386a3356a 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -203,12 +203,11 @@ static int getEdgeIndex(CCGSubSurf *ss, CCGEdge *e, int x, int edgeSize)
if (x == 0) {
return v0idx;
}
- else if (x == edgeSize - 1) {
+ if (x == edgeSize - 1) {
return v1idx;
}
- else {
- return edgeBase + x - 1;
- }
+
+ return edgeBase + x - 1;
}
static int getFaceIndex(
@@ -221,42 +220,39 @@ static int getFaceIndex(
CCGVert *v = ccgSubSurf_getFaceVert(f, S);
return *((int *)ccgSubSurf_getVertUserData(ss, v));
}
- else if (x == gridSize - 1) {
+ if (x == gridSize - 1) {
CCGVert *v = ccgSubSurf_getFaceVert(f, S);
CCGEdge *e = ccgSubSurf_getFaceEdge(f, S);
int edgeBase = *((int *)ccgSubSurf_getEdgeUserData(ss, e));
if (v == ccgSubSurf_getEdgeVert0(e)) {
return edgeBase + (gridSize - 1 - y) - 1;
}
- else {
- return edgeBase + (edgeSize - 2 - 1) - ((gridSize - 1 - y) - 1);
- }
+
+ return edgeBase + (edgeSize - 2 - 1) - ((gridSize - 1 - y) - 1);
}
- else if (y == gridSize - 1) {
+ if (y == gridSize - 1) {
CCGVert *v = ccgSubSurf_getFaceVert(f, S);
CCGEdge *e = ccgSubSurf_getFaceEdge(f, (S + numVerts - 1) % numVerts);
int edgeBase = *((int *)ccgSubSurf_getEdgeUserData(ss, e));
if (v == ccgSubSurf_getEdgeVert0(e)) {
return edgeBase + (gridSize - 1 - x) - 1;
}
- else {
- return edgeBase + (edgeSize - 2 - 1) - ((gridSize - 1 - x) - 1);
- }
+
+ return edgeBase + (edgeSize - 2 - 1) - ((gridSize - 1 - x) - 1);
}
- else if (x == 0 && y == 0) {
+ if (x == 0 && y == 0) {
return faceBase;
}
- else if (x == 0) {
+ if (x == 0) {
S = (S + numVerts - 1) % numVerts;
return faceBase + 1 + (gridSize - 2) * S + (y - 1);
}
- else if (y == 0) {
+ if (y == 0) {
return faceBase + 1 + (gridSize - 2) * S + (x - 1);
}
- else {
- return faceBase + 1 + (gridSize - 2) * numVerts + S * (gridSize - 2) * (gridSize - 2) +
- (y - 1) * (gridSize - 2) + (x - 1);
- }
+
+ return faceBase + 1 + (gridSize - 2) * numVerts + S * (gridSize - 2) * (gridSize - 2) +
+ (y - 1) * (gridSize - 2) + (x - 1);
}
static void get_face_uv_map_vert(
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 5f85e1a1664..8a055423d6f 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -812,9 +812,8 @@ int txt_calc_tab_right(TextLine *tl, int ch)
return i - ch;
}
- else {
- return 0;
- }
+
+ return 0;
}
void txt_move_left(Text *text, const bool sel)
@@ -1664,9 +1663,8 @@ int txt_find_string(Text *text, const char *findstr, int wrap, int match_case)
txt_move_to(text, newl, newc + strlen(findstr), 1);
return 1;
}
- else {
- return 0;
- }
+
+ return 0;
}
/** \} */
@@ -1797,7 +1795,7 @@ void txt_delete_char(Text *text)
txt_make_dirty(text);
return;
}
- else if (text->curc == text->curl->len) { /* Appending two lines */
+ if (text->curc == text->curl->len) { /* Appending two lines */
if (text->curl->next) {
txt_combine_lines(text, text->curl, text->curl->next);
txt_pop_sel(text);
@@ -1844,7 +1842,7 @@ void txt_backspace_char(Text *text)
txt_make_dirty(text);
return;
}
- else if (text->curc == 0) { /* Appending two lines */
+ if (text->curc == 0) { /* Appending two lines */
if (!text->curl->prev) {
return;
}
@@ -2052,10 +2050,9 @@ static void txt_select_prefix(Text *text, const char *add, bool skip_blank_lines
}
break;
}
- else {
- text->curl = text->curl->next;
- num++;
- }
+
+ text->curl = text->curl->next;
+ num++;
}
while (num > 0) {
@@ -2140,10 +2137,9 @@ static bool txt_select_unprefix(Text *text, const char *remove, const bool requi
}
break;
}
- else {
- text->curl = text->curl->next;
- num++;
- }
+
+ text->curl = text->curl->next;
+ num++;
}
if (unindented_first) {
@@ -2253,9 +2249,8 @@ int txt_setcurr_tab_spaces(Text *text, int space)
if (i == text->curc) {
return i;
}
- else {
- i++;
- }
+
+ i++;
}
if (strstr(text->curl->line, word)) {
/* if we find a ':' on this line, then add a tab but not if it is:
@@ -2270,7 +2265,7 @@ int txt_setcurr_tab_spaces(Text *text, int space)
if (ch == '#') {
break;
}
- else if (ch == ':') {
+ if (ch == ':') {
is_indent = 1;
}
else if (ch != ' ' && ch != '\t') {
@@ -2309,7 +2304,7 @@ int text_check_bracket(const char ch)
if (ch == opens[a]) {
return a + 1;
}
- else if (ch == close[a]) {
+ if (ch == close[a]) {
return -(a + 1);
}
}
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index e2c3c20e36e..8d5a0497e28 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -664,11 +664,11 @@ bool BKE_texture_dependsOnTime(const struct Tex *texture)
if (texture->ima && BKE_image_is_animated(texture->ima)) {
return true;
}
- else if (texture->adt) {
+ if (texture->adt) {
/* assume anything in adt means the texture is animated */
return true;
}
- else if (texture->type == TEX_NOISE) {
+ if (texture->type == TEX_NOISE) {
/* noise always varies with time */
return true;
}
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index f17467e4a26..8a1ebaf722b 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -1188,38 +1188,36 @@ MovieTrackingMarker *BKE_tracking_marker_insert(MovieTrackingTrack *track,
return old_marker;
}
- else {
- int a = track->markersnr;
- /* find position in array where to add new marker */
- while (a--) {
- if (track->markers[a].framenr < marker->framenr) {
- break;
- }
+ int a = track->markersnr;
+
+ /* find position in array where to add new marker */
+ while (a--) {
+ if (track->markers[a].framenr < marker->framenr) {
+ break;
}
+ }
- track->markersnr++;
+ track->markersnr++;
- if (track->markers) {
- track->markers = MEM_reallocN(track->markers,
- sizeof(MovieTrackingMarker) * track->markersnr);
- }
- else {
- track->markers = MEM_callocN(sizeof(MovieTrackingMarker), "MovieTracking markers");
- }
+ if (track->markers) {
+ track->markers = MEM_reallocN(track->markers, sizeof(MovieTrackingMarker) * track->markersnr);
+ }
+ else {
+ track->markers = MEM_callocN(sizeof(MovieTrackingMarker), "MovieTracking markers");
+ }
- /* shift array to "free" space for new marker */
- memmove(track->markers + a + 2,
- track->markers + a + 1,
- (track->markersnr - a - 2) * sizeof(MovieTrackingMarker));
+ /* shift array to "free" space for new marker */
+ memmove(track->markers + a + 2,
+ track->markers + a + 1,
+ (track->markersnr - a - 2) * sizeof(MovieTrackingMarker));
- /* put new marker */
- track->markers[a + 1] = *marker;
+ /* put new marker */
+ track->markers[a + 1] = *marker;
- track->last_marker = a + 1;
+ track->last_marker = a + 1;
- return &track->markers[a + 1];
- }
+ return &track->markers[a + 1];
}
void BKE_tracking_marker_delete(MovieTrackingTrack *track, int framenr)
@@ -1337,21 +1335,20 @@ MovieTrackingMarker *BKE_tracking_marker_get(MovieTrackingTrack *track, int fram
/* if there's no marker for exact position, use nearest marker from left side */
return &track->markers[a - 1];
}
- else {
- while (a >= 0 && track->markers[a].framenr >= framenr) {
- if (track->markers[a].framenr == framenr) {
- track->last_marker = a;
- return &track->markers[a];
- }
+ while (a >= 0 && track->markers[a].framenr >= framenr) {
+ if (track->markers[a].framenr == framenr) {
+ track->last_marker = a;
- a--;
+ return &track->markers[a];
}
- /* if there's no marker for exact position, use nearest marker from left side */
- return &track->markers[a];
+ a--;
}
+ /* if there's no marker for exact position, use nearest marker from left side */
+ return &track->markers[a];
+
return NULL;
}
@@ -1655,32 +1652,31 @@ MovieTrackingPlaneMarker *BKE_tracking_plane_marker_insert(MovieTrackingPlaneTra
return old_plane_marker;
}
- else {
- int a = plane_track->markersnr;
- /* Find position in array where to add new marker. */
- /* TODO(sergey): we could use bisect to speed things up. */
- while (a--) {
- if (plane_track->markers[a].framenr < plane_marker->framenr) {
- break;
- }
+ int a = plane_track->markersnr;
+
+ /* Find position in array where to add new marker. */
+ /* TODO(sergey): we could use bisect to speed things up. */
+ while (a--) {
+ if (plane_track->markers[a].framenr < plane_marker->framenr) {
+ break;
}
+ }
- plane_track->markersnr++;
- plane_track->markers = MEM_reallocN(plane_track->markers,
- sizeof(MovieTrackingPlaneMarker) * plane_track->markersnr);
+ plane_track->markersnr++;
+ plane_track->markers = MEM_reallocN(plane_track->markers,
+ sizeof(MovieTrackingPlaneMarker) * plane_track->markersnr);
- /* Shift array to "free" space for new marker. */
- memmove(plane_track->markers + a + 2,
- plane_track->markers + a + 1,
- (plane_track->markersnr - a - 2) * sizeof(MovieTrackingPlaneMarker));
+ /* Shift array to "free" space for new marker. */
+ memmove(plane_track->markers + a + 2,
+ plane_track->markers + a + 1,
+ (plane_track->markersnr - a - 2) * sizeof(MovieTrackingPlaneMarker));
- /* Put new marker to an array. */
- plane_track->markers[a + 1] = *plane_marker;
- plane_track->last_marker = a + 1;
+ /* Put new marker to an array. */
+ plane_track->markers[a + 1] = *plane_marker;
+ plane_track->last_marker = a + 1;
- return &plane_track->markers[a + 1];
- }
+ return &plane_track->markers[a + 1];
}
void BKE_tracking_plane_marker_delete(MovieTrackingPlaneTrack *plane_track, int framenr)
@@ -1748,21 +1744,20 @@ MovieTrackingPlaneMarker *BKE_tracking_plane_marker_get(MovieTrackingPlaneTrack
/* If there's no marker for exact position, use nearest marker from left side. */
return &plane_track->markers[a - 1];
}
- else {
- while (a >= 0 && plane_track->markers[a].framenr >= framenr) {
- if (plane_track->markers[a].framenr == framenr) {
- plane_track->last_marker = a;
- return &plane_track->markers[a];
- }
+ while (a >= 0 && plane_track->markers[a].framenr >= framenr) {
+ if (plane_track->markers[a].framenr == framenr) {
+ plane_track->last_marker = a;
- a--;
+ return &plane_track->markers[a];
}
- /* If there's no marker for exact position, use nearest marker from left side. */
- return &plane_track->markers[a];
+ a--;
}
+ /* If there's no marker for exact position, use nearest marker from left side. */
+ return &plane_track->markers[a];
+
return NULL;
}
@@ -1988,18 +1983,16 @@ static int reconstructed_camera_index_get(MovieTrackingReconstruction *reconstru
if (nearest) {
return 0;
}
- else {
- return -1;
- }
+
+ return -1;
}
if (framenr > cameras[reconstruction->camnr - 1].framenr) {
if (nearest) {
return reconstruction->camnr - 1;
}
- else {
- return -1;
- }
+
+ return -1;
}
if (reconstruction->last_camera < reconstruction->camnr) {
@@ -2020,9 +2013,8 @@ static int reconstructed_camera_index_get(MovieTrackingReconstruction *reconstru
if (nearest) {
return a - 1;
}
- else {
- break;
- }
+
+ break;
}
if (d < 0 && cfra < framenr) {
@@ -2030,9 +2022,8 @@ static int reconstructed_camera_index_get(MovieTrackingReconstruction *reconstru
if (nearest) {
return a;
}
- else {
- break;
- }
+
+ break;
}
if (cfra == framenr) {
@@ -2705,9 +2696,8 @@ static int channels_alpha_sort(const void *a, const void *b)
if (BLI_strcasecmp(channel_a->track->name, channel_b->track->name) > 0) {
return 1;
}
- else {
- return 0;
- }
+
+ return 0;
}
static int channels_total_track_sort(const void *a, const void *b)
@@ -2718,9 +2708,8 @@ static int channels_total_track_sort(const void *a, const void *b)
if (channel_a->total_frames > channel_b->total_frames) {
return 1;
}
- else {
- return 0;
- }
+
+ return 0;
}
static int channels_longest_segment_sort(const void *a, const void *b)
@@ -2731,9 +2720,8 @@ static int channels_longest_segment_sort(const void *a, const void *b)
if (channel_a->max_segment > channel_b->max_segment) {
return 1;
}
- else {
- return 0;
- }
+
+ return 0;
}
static int channels_average_error_sort(const void *a, const void *b)
@@ -2744,9 +2732,8 @@ static int channels_average_error_sort(const void *a, const void *b)
if (channel_a->track->error > channel_b->track->error) {
return 1;
}
- else {
- return 0;
- }
+
+ return 0;
}
static int channels_alpha_inverse_sort(const void *a, const void *b)
@@ -2754,9 +2741,8 @@ static int channels_alpha_inverse_sort(const void *a, const void *b)
if (channels_alpha_sort(a, b)) {
return 0;
}
- else {
- return 1;
- }
+
+ return 1;
}
static int channels_total_track_inverse_sort(const void *a, const void *b)
@@ -2764,9 +2750,8 @@ static int channels_total_track_inverse_sort(const void *a, const void *b)
if (channels_total_track_sort(a, b)) {
return 0;
}
- else {
- return 1;
- }
+
+ return 1;
}
static int channels_longest_segment_inverse_sort(const void *a, const void *b)
@@ -2774,9 +2759,8 @@ static int channels_longest_segment_inverse_sort(const void *a, const void *b)
if (channels_longest_segment_sort(a, b)) {
return 0;
}
- else {
- return 1;
- }
+
+ return 1;
}
static int channels_average_error_inverse_sort(const void *a, const void *b)
@@ -2787,9 +2771,8 @@ static int channels_average_error_inverse_sort(const void *a, const void *b)
if (channel_a->track->error < channel_b->track->error) {
return 1;
}
- else {
- return 0;
- }
+
+ return 0;
}
/* Calculate frames segments at which track is tracked continuously. */
@@ -2965,7 +2948,7 @@ static int coverage_from_count(int count)
if (count < 8) {
return TRACKING_COVERAGE_BAD;
}
- else if (count < 16) {
+ if (count < 16) {
return TRACKING_COVERAGE_ACCEPTABLE;
}
return TRACKING_COVERAGE_OK;
diff --git a/source/blender/blenkernel/intern/tracking_solver.c b/source/blender/blenkernel/intern/tracking_solver.c
index 46870a03e62..7df8bf62b16 100644
--- a/source/blender/blenkernel/intern/tracking_solver.c
+++ b/source/blender/blenkernel/intern/tracking_solver.c
@@ -335,7 +335,7 @@ bool BKE_tracking_reconstruction_check(MovieTracking *tracking,
/* TODO: check for number of tracks? */
return true;
}
- else if ((tracking->settings.reconstruction_flag & TRACKING_USE_KEYFRAME_SELECTION) == 0) {
+ if ((tracking->settings.reconstruction_flag & TRACKING_USE_KEYFRAME_SELECTION) == 0) {
/* automatic keyframe selection does not require any pre-process checks */
if (reconstruct_count_tracks_on_both_keyframes(tracking, object) < 8) {
BLI_strncpy(error_msg,
diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c b/source/blender/blenkernel/intern/tracking_stabilize.c
index b9c6bb83157..65eb3d89420 100644
--- a/source/blender/blenkernel/intern/tracking_stabilize.c
+++ b/source/blender/blenkernel/intern/tracking_stabilize.c
@@ -357,9 +357,8 @@ static MovieTrackingMarker *get_closest_marker(StabContext *ctx,
if ((next_higher - ref_frame) < (ref_frame - next_lower)) {
return BKE_tracking_marker_get_exact(track, next_higher);
}
- else {
- return BKE_tracking_marker_get_exact(track, next_lower);
- }
+
+ return BKE_tracking_marker_get_exact(track, next_lower);
}
/* Retrieve tracking data, if available and applicable for this frame.
@@ -377,11 +376,10 @@ static MovieTrackingMarker *get_tracking_data_point(StabContext *ctx,
*r_weight = get_animated_weight(ctx, track, framenr);
return marker;
}
- else {
- /* No marker at this frame (=gap) or marker disabled. */
- *r_weight = 0.0f;
- return NULL;
- }
+
+ /* No marker at this frame (=gap) or marker disabled. */
+ *r_weight = 0.0f;
+ return NULL;
}
/* Define the reference point for rotation/scale measurement and compensation.
diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index 0809e8dda6d..0a0f81f7829 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -476,9 +476,8 @@ UndoStep *BKE_undosys_step_push_init_with_type(UndoStack *ustack,
undosys_stack_validate(ustack, false);
return us;
}
- else {
- return NULL;
- }
+
+ return NULL;
}
UndoStep *BKE_undosys_step_push_init(UndoStack *ustack, bContext *C, const char *name)
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index efe10b02940..b8d86f0dc5b 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -970,9 +970,8 @@ double bUnit_PreferredInputUnitScalar(const struct UnitSettings *settings, int t
if (unit) {
return unit->scalar;
}
- else {
- return bUnit_BaseScalar(units.system, type);
- }
+
+ return bUnit_BaseScalar(units.system, type);
}
/* make a copy of the string that replaces the units with numbers
@@ -1155,9 +1154,8 @@ double bUnit_BaseScalar(int system, int type)
if (usys) {
return unit_default(usys)->scalar;
}
- else {
- return 1.0;
- }
+
+ return 1.0;
}
/* external access */
diff --git a/source/blender/blenkernel/intern/volume.cc b/source/blender/blenkernel/intern/volume.cc
index 633ad250a67..54fb0f612d1 100644
--- a/source/blender/blenkernel/intern/volume.cc
+++ b/source/blender/blenkernel/intern/volume.cc
@@ -367,9 +367,8 @@ struct VolumeGrid {
if (is_loaded && entry && !entry->error_msg.empty()) {
return entry->error_msg.c_str();
}
- else {
- return NULL;
- }
+
+ return NULL;
}
const bool grid_is_loaded() const
@@ -1087,34 +1086,34 @@ VolumeGridType BKE_volume_grid_type(const VolumeGrid *volume_grid)
if (grid->isType<openvdb::FloatGrid>()) {
return VOLUME_GRID_FLOAT;
}
- else if (grid->isType<openvdb::Vec3fGrid>()) {
+ if (grid->isType<openvdb::Vec3fGrid>()) {
return VOLUME_GRID_VECTOR_FLOAT;
}
- else if (grid->isType<openvdb::BoolGrid>()) {
+ if (grid->isType<openvdb::BoolGrid>()) {
return VOLUME_GRID_BOOLEAN;
}
- else if (grid->isType<openvdb::DoubleGrid>()) {
+ if (grid->isType<openvdb::DoubleGrid>()) {
return VOLUME_GRID_DOUBLE;
}
- else if (grid->isType<openvdb::Int32Grid>()) {
+ if (grid->isType<openvdb::Int32Grid>()) {
return VOLUME_GRID_INT;
}
- else if (grid->isType<openvdb::Int64Grid>()) {
+ if (grid->isType<openvdb::Int64Grid>()) {
return VOLUME_GRID_INT64;
}
- else if (grid->isType<openvdb::Vec3IGrid>()) {
+ if (grid->isType<openvdb::Vec3IGrid>()) {
return VOLUME_GRID_VECTOR_INT;
}
- else if (grid->isType<openvdb::Vec3dGrid>()) {
+ if (grid->isType<openvdb::Vec3dGrid>()) {
return VOLUME_GRID_VECTOR_DOUBLE;
}
- else if (grid->isType<openvdb::StringGrid>()) {
+ if (grid->isType<openvdb::StringGrid>()) {
return VOLUME_GRID_STRING;
}
- else if (grid->isType<openvdb::MaskGrid>()) {
+ if (grid->isType<openvdb::MaskGrid>()) {
return VOLUME_GRID_MASK;
}
- else if (grid->isType<openvdb::points::PointDataGrid>()) {
+ if (grid->isType<openvdb::points::PointDataGrid>()) {
return VOLUME_GRID_POINTS;
}
#else
diff --git a/source/blender/blenkernel/intern/volume_render.cc b/source/blender/blenkernel/intern/volume_render.cc
index 135c6f78fef..98d3617c822 100644
--- a/source/blender/blenkernel/intern/volume_render.cc
+++ b/source/blender/blenkernel/intern/volume_render.cc
@@ -363,7 +363,6 @@ float BKE_volume_density_scale(const Volume *volume, const float matrix[4][4])
mul_mat3_m4_v3(matrix, unit);
return 1.0f / len_v3(unit);
}
- else {
- return 1.0f;
- }
+
+ return 1.0f;
}
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index 4625fd76293..f653a190704 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -157,9 +157,8 @@ static void *workspace_relation_get_data_matching_parent(const ListBase *relatio
if (relation != NULL) {
return relation->value;
}
- else {
- return NULL;
- }
+
+ return NULL;
}
/**
@@ -397,10 +396,9 @@ bool BKE_workspace_owner_id_check(const WorkSpace *workspace, const char *owner_
if ((*owner_id == '\0') || ((workspace->flags & WORKSPACE_USE_FILTER_BY_ORIGIN) == 0)) {
return true;
}
- else {
- /* We could use hash lookup, for now this list is highly likely under < ~16 items. */
- return BLI_findstring(&workspace->owner_ids, owner_id, offsetof(wmOwnerID, name)) != NULL;
- }
+
+ /* We could use hash lookup, for now this list is highly likely under < ~16 items. */
+ return BLI_findstring(&workspace->owner_ids, owner_id, offsetof(wmOwnerID, name)) != NULL;
}
void BKE_workspace_id_tag_all_visible(Main *bmain, int tag)