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-07-03 18:30:31 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-07-03 18:42:46 +0300
commit33a74941c5fd4efb6eefcaace3315d3e2b65681f (patch)
tree2d3da68b73e4419750c7f767bbb78bf1a303ad18
parent367034f210137754ab4f07a0e7793066d2b69e59 (diff)
Cleanup: Editors, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/editors` module. No functional changes.
-rw-r--r--source/blender/editors/curve/editcurve.c36
-rw-r--r--source/blender/editors/curve/editcurve_query.c6
-rw-r--r--source/blender/editors/curve/editcurve_select.c25
-rw-r--r--source/blender/editors/curve/editfont.c32
-rw-r--r--source/blender/editors/gizmo_library/gizmo_library_utils.c30
-rw-r--r--source/blender/editors/io/io_collada.c20
-rw-r--r--source/blender/editors/lattice/editlattice_select.c11
-rw-r--r--source/blender/editors/mask/mask_add.c8
-rw-r--r--source/blender/editors/mask/mask_ops.c12
-rw-r--r--source/blender/editors/mask/mask_select.c67
-rw-r--r--source/blender/editors/mask/mask_shapekey.c16
-rw-r--r--source/blender/editors/physics/particle_edit.c18
-rw-r--r--source/blender/editors/physics/rigidbody_constraint.c12
-rw-r--r--source/blender/editors/physics/rigidbody_object.c35
-rw-r--r--source/blender/editors/render/render_internal.c10
-rw-r--r--source/blender/editors/render/render_opengl.c20
-rw-r--r--source/blender/editors/render/render_shading.c6
-rw-r--r--source/blender/editors/render/render_view.c4
-rw-r--r--source/blender/editors/scene/scene_edit.c4
-rw-r--r--source/blender/editors/space_action/action_data.c81
-rw-r--r--source/blender/editors/space_action/action_edit.c5
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c168
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c67
-rw-r--r--source/blender/editors/space_console/console_ops.c46
-rw-r--r--source/blender/editors/space_file/file_ops.c2
-rw-r--r--source/blender/editors/space_file/filelist.c159
-rw-r--r--source/blender/editors/space_file/filesel.c13
-rw-r--r--source/blender/editors/space_file/fsmenu.c19
-rw-r--r--source/blender/editors/space_graph/graph_draw.c4
-rw-r--r--source/blender/editors/space_graph/graph_edit.c66
-rw-r--r--source/blender/editors/space_graph/graph_select.c9
-rw-r--r--source/blender/editors/space_image/image_buttons.c10
-rw-r--r--source/blender/editors/space_image/image_ops.c107
-rw-r--r--source/blender/editors/space_info/info_draw.c25
-rw-r--r--source/blender/editors/space_info/textview.c2
-rw-r--r--source/blender/editors/space_nla/nla_channels.c35
-rw-r--r--source/blender/editors/space_nla/nla_edit.c46
-rw-r--r--source/blender/editors/undo/ed_undo.c2
-rw-r--r--source/blender/editors/util/ed_util.c4
-rw-r--r--source/blender/editors/util/numinput.c31
40 files changed, 562 insertions, 711 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index a39c8261b32..38ab917ba72 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -2436,12 +2436,12 @@ static void adduplicateflagNurb(
/* actvert in cyclicu selection */
break;
}
- else if (calc_duplicate_actvert(editnurb,
- newnurb,
- cu,
- starta,
- starta + newu,
- cu->actvert - starta + b * newnu->pntsu)) {
+ if (calc_duplicate_actvert(editnurb,
+ newnurb,
+ cu,
+ starta,
+ starta + newu,
+ cu->actvert - starta + b * newnu->pntsu)) {
/* actvert in 'current' iteration selection */
break;
}
@@ -4544,15 +4544,13 @@ static int make_segment_exec(bContext *C, wmOperator *op)
if (nu_select_num > 1) {
break;
}
- else {
- /* only 1 selected, not first or last, a little complex, but intuitive */
- if (nu->pntsv == 1) {
- if ((nu->bp->f1 & SELECT) || (nu->bp[nu->pntsu - 1].f1 & SELECT)) {
- /* pass */
- }
- else {
- break;
- }
+ /* only 1 selected, not first or last, a little complex, but intuitive */
+ if (nu->pntsv == 1) {
+ if ((nu->bp->f1 & SELECT) || (nu->bp[nu->pntsu - 1].f1 & SELECT)) {
+ /* pass */
+ }
+ else {
+ break;
}
}
}
@@ -5593,9 +5591,7 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -6517,9 +6513,7 @@ static int curve_delete_exec(bContext *C, wmOperator *op)
if (changed_multi) {
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
static const EnumPropertyItem curve_delete_type_items[] = {
diff --git a/source/blender/editors/curve/editcurve_query.c b/source/blender/editors/curve/editcurve_query.c
index 132f7e58e71..774065b06ff 100644
--- a/source/blender/editors/curve/editcurve_query.c
+++ b/source/blender/editors/curve/editcurve_query.c
@@ -191,7 +191,8 @@ void ED_curve_nurb_vert_selected_find(
*r_bezt = NULL;
return;
}
- else if (*r_bezt || *r_bp) {
+
+ if (*r_bezt || *r_bp) {
*r_bp = NULL;
*r_bezt = NULL;
}
@@ -214,7 +215,8 @@ void ED_curve_nurb_vert_selected_find(
*r_nu = NULL;
return;
}
- else if (*r_bezt || *r_bp) {
+
+ if (*r_bezt || *r_bp) {
*r_bp = NULL;
*r_bezt = NULL;
}
diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c
index 73f970876b1..b60eb258916 100644
--- a/source/blender/editors/curve/editcurve_select.c
+++ b/source/blender/editors/curve/editcurve_select.c
@@ -66,12 +66,11 @@ bool select_beztriple(BezTriple *bezt, bool selstatus, short flag, eVisible_Type
bezt->f3 |= flag;
return true;
}
- else { /* deselects */
- bezt->f1 &= ~flag;
- bezt->f2 &= ~flag;
- bezt->f3 &= ~flag;
- return true;
- }
+ /* deselects */
+ bezt->f1 &= ~flag;
+ bezt->f2 &= ~flag;
+ bezt->f3 &= ~flag;
+ return true;
}
return false;
@@ -85,10 +84,8 @@ bool select_bpoint(BPoint *bp, bool selstatus, short flag, bool hidden)
bp->f1 |= flag;
return true;
}
- else {
- bp->f1 &= ~flag;
- return true;
- }
+ bp->f1 &= ~flag;
+ return true;
}
return false;
@@ -99,9 +96,7 @@ static bool swap_selection_beztriple(BezTriple *bezt)
if (bezt->f2 & SELECT) {
return select_beztriple(bezt, DESELECT, SELECT, VISIBLE);
}
- else {
- return select_beztriple(bezt, SELECT, SELECT, VISIBLE);
- }
+ return select_beztriple(bezt, SELECT, SELECT, VISIBLE);
}
static bool swap_selection_bpoint(BPoint *bp)
@@ -109,9 +104,7 @@ static bool swap_selection_bpoint(BPoint *bp)
if (bp->f1 & SELECT) {
return select_bpoint(bp, DESELECT, SELECT, VISIBLE);
}
- else {
- return select_bpoint(bp, SELECT, SELECT, VISIBLE);
- }
+ return select_bpoint(bp, SELECT, SELECT, VISIBLE);
}
bool ED_curve_nurb_select_check(View3D *v3d, Nurb *nu)
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 1bbd4b4a5bc..b759277572c 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -373,9 +373,7 @@ static wchar_t findaccent(wchar_t char1, uint code)
if (new) {
return new;
}
- else {
- return char1;
- }
+ return char1;
}
static int insert_into_textbuf(Object *obedit, uintptr_t c)
@@ -403,9 +401,7 @@ static int insert_into_textbuf(Object *obedit, uintptr_t c)
return 1;
}
- else {
- return 0;
- }
+ return 0;
}
static void text_update_edited(bContext *C, Object *obedit, int mode)
@@ -887,9 +883,7 @@ static int font_select_all_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void FONT_OT_select_all(wmOperatorType *ot)
@@ -1015,10 +1009,9 @@ static bool paste_selection(Object *obedit, ReportList *reports)
if (font_paste_wchar(obedit, text_buf, len, info_buf)) {
return true;
}
- else {
- BKE_report(reports, RPT_WARNING, "Text too long");
- return false;
- }
+
+ BKE_report(reports, RPT_WARNING, "Text too long");
+ return false;
}
static int paste_text_exec(bContext *C, wmOperator *op)
@@ -1347,9 +1340,7 @@ static int change_spacing_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void FONT_OT_change_spacing(wmOperatorType *ot)
@@ -1688,9 +1679,8 @@ static int insert_text_invoke(bContext *C, wmOperator *op, const wmEvent *event)
if ((alt || ctrl || shift) == 0) {
return OPERATOR_PASS_THROUGH;
}
- else {
- ascii = 9;
- }
+
+ ascii = 9;
}
if (event_type == EVT_BACKSPACEKEY) {
@@ -2290,9 +2280,7 @@ bool ED_curve_editfont_select_pick(
}
return true;
}
- else {
- return false;
- }
+ return false;
}
/** \} */
diff --git a/source/blender/editors/gizmo_library/gizmo_library_utils.c b/source/blender/editors/gizmo_library/gizmo_library_utils.c
index 3902c112796..847f3e3916c 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_utils.c
+++ b/source/blender/editors/gizmo_library/gizmo_library_utils.c
@@ -211,14 +211,13 @@ bool gizmo_window_project_2d(bContext *C,
}
return false;
}
- else {
- float co[3] = {mval[0], mval[1], 0.0f};
- float imat[4][4];
- invert_m4_m4(imat, mat);
- mul_m4_v3(imat, co);
- copy_v2_v2(r_co, co);
- return true;
- }
+
+ float co[3] = {mval[0], mval[1], 0.0f};
+ float imat[4][4];
+ invert_m4_m4(imat, mat);
+ mul_m4_v3(imat, co);
+ copy_v2_v2(r_co, co);
+ return true;
}
bool gizmo_window_project_3d(
@@ -245,12 +244,11 @@ bool gizmo_window_project_3d(
mul_m4_v3(mat, r_co);
return true;
}
- else {
- float co[3] = {mval[0], mval[1], 0.0f};
- float imat[4][4];
- invert_m4_m4(imat, mat);
- mul_m4_v3(imat, co);
- copy_v2_v2(r_co, co);
- return true;
- }
+
+ float co[3] = {mval[0], mval[1], 0.0f};
+ float imat[4][4];
+ invert_m4_m4(imat, mat);
+ mul_m4_v3(imat, co);
+ copy_v2_v2(r_co, co);
+ return true;
}
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index c1a4492994a..94636848d91 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -253,16 +253,15 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "No objects selected -- Created empty export file");
return OPERATOR_CANCELLED;
}
- else if (export_count < 0) {
+ if (export_count < 0) {
BKE_report(op->reports, RPT_WARNING, "Error during export (see Console)");
return OPERATOR_CANCELLED;
}
- else {
- char buff[100];
- sprintf(buff, "Exported %d Objects", export_count);
- BKE_report(op->reports, RPT_INFO, buff);
- return OPERATOR_FINISHED;
- }
+
+ char buff[100];
+ sprintf(buff, "Exported %d Objects", export_count);
+ BKE_report(op->reports, RPT_INFO, buff);
+ return OPERATOR_FINISHED;
}
static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
@@ -803,10 +802,9 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
DEG_id_tag_update(&CTX_data_scene(C)->id, ID_RECALC_BASE_FLAGS);
return OPERATOR_FINISHED;
}
- else {
- BKE_report(op->reports, RPT_ERROR, "Parsing errors in Document (see Blender Console)");
- return OPERATOR_CANCELLED;
- }
+
+ BKE_report(op->reports, RPT_ERROR, "Parsing errors in Document (see Blender Console)");
+ return OPERATOR_CANCELLED;
}
static void uiCollada_importSettings(uiLayout *layout, PointerRNA *imfptr)
diff --git a/source/blender/editors/lattice/editlattice_select.c b/source/blender/editors/lattice/editlattice_select.c
index 8751a289b9c..0b62934d190 100644
--- a/source/blender/editors/lattice/editlattice_select.c
+++ b/source/blender/editors/lattice/editlattice_select.c
@@ -273,13 +273,12 @@ static bool lattice_test_bitmap_uvw(
if ((u < 0 || u >= lt->pntsu) || (v < 0 || v >= lt->pntsv) || (w < 0 || w >= lt->pntsw)) {
return false;
}
- else {
- int i = BKE_lattice_index_from_uvw(lt, u, v, w);
- if (lt->def[i].hide == 0) {
- return (BLI_BITMAP_TEST(selpoints, i) != 0) == selected;
- }
- return false;
+
+ int i = BKE_lattice_index_from_uvw(lt, u, v, w);
+ if (lt->def[i].hide == 0) {
+ return (BLI_BITMAP_TEST(selpoints, i) != 0) == selected;
}
+ return false;
}
static int lattice_select_more_less(bContext *C, const bool select)
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c
index 767976b5ae6..b7fd661d8e6 100644
--- a/source/blender/editors/mask/mask_add.c
+++ b/source/blender/editors/mask/mask_add.c
@@ -210,7 +210,7 @@ static void finSelectedSplinePoint(MaskLayer *mask_layer,
*point = NULL;
return;
}
- else if (*point) {
+ if (*point) {
*point = NULL;
}
else {
@@ -319,9 +319,7 @@ static bool add_vertex_extrude(const bContext *C,
if (!mask_layer) {
return false;
}
- else {
- finSelectedSplinePoint(mask_layer, &spline, &point, true);
- }
+ finSelectedSplinePoint(mask_layer, &spline, &point, true);
ED_mask_select_toggle_all(mask, SEL_DESELECT);
@@ -502,7 +500,7 @@ static int add_vertex_handle_cyclic(
if (is_last_point_active) {
return add_vertex_handle_cyclic_at_point(C, mask, spline, active_point, first_point, co);
}
- else if (is_first_point_active) {
+ if (is_first_point_active) {
return add_vertex_handle_cyclic_at_point(C, mask, spline, active_point, last_point, co);
}
return OPERATOR_PASS_THROUGH;
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index 68dfe0d151f..d953a8f9d42 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -1710,9 +1710,7 @@ static int mask_hide_view_clear_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void MASK_OT_hide_view_clear(wmOperatorType *ot)
@@ -1773,9 +1771,7 @@ static int mask_hide_view_set_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void MASK_OT_hide_view_set(wmOperatorType *ot)
@@ -1827,9 +1823,7 @@ static int mask_feather_weight_clear_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void MASK_OT_feather_weight_clear(wmOperatorType *ot)
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c
index c8cddced99c..82d8a1dc85f 100644
--- a/source/blender/editors/mask/mask_select.c
+++ b/source/blender/editors/mask/mask_select.c
@@ -331,53 +331,52 @@ static int select_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
- else {
- MaskSplinePointUW *uw;
- if (ED_mask_feather_find_nearest(
- C, mask, co, threshold, &mask_layer, &spline, &point, &uw, NULL)) {
+ MaskSplinePointUW *uw;
- if (extend) {
- mask_layer->act_spline = spline;
- mask_layer->act_point = point;
+ if (ED_mask_feather_find_nearest(
+ C, mask, co, threshold, &mask_layer, &spline, &point, &uw, NULL)) {
- if (uw) {
- uw->flag |= SELECT;
- }
+ if (extend) {
+ mask_layer->act_spline = spline;
+ mask_layer->act_point = point;
+
+ if (uw) {
+ uw->flag |= SELECT;
}
- else if (deselect) {
- if (uw) {
- uw->flag &= ~SELECT;
- }
+ }
+ else if (deselect) {
+ if (uw) {
+ uw->flag &= ~SELECT;
}
- else {
- mask_layer->act_spline = spline;
- mask_layer->act_point = point;
+ }
+ else {
+ mask_layer->act_spline = spline;
+ mask_layer->act_point = point;
- if (uw) {
- if (!(uw->flag & SELECT)) {
- uw->flag |= SELECT;
- }
- else if (toggle) {
- uw->flag &= ~SELECT;
- }
+ if (uw) {
+ if (!(uw->flag & SELECT)) {
+ uw->flag |= SELECT;
+ }
+ else if (toggle) {
+ uw->flag &= ~SELECT;
}
}
+ }
- ED_mask_select_flush_all(mask);
+ ED_mask_select_flush_all(mask);
- DEG_id_tag_update(&mask->id, ID_RECALC_SELECT);
- WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
+ DEG_id_tag_update(&mask->id, ID_RECALC_SELECT);
+ WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
+ return OPERATOR_FINISHED;
+ }
+ if (deselect_all) {
+ /* For clip editor tracks, leave deselect all to clip editor. */
+ if (!ED_clip_can_select(C)) {
+ ED_mask_deselect_all(C);
return OPERATOR_FINISHED;
}
- else if (deselect_all) {
- /* For clip editor tracks, leave deselect all to clip editor. */
- if (!ED_clip_can_select(C)) {
- ED_mask_deselect_all(C);
- return OPERATOR_FINISHED;
- }
- }
}
return OPERATOR_PASS_THROUGH;
diff --git a/source/blender/editors/mask/mask_shapekey.c b/source/blender/editors/mask/mask_shapekey.c
index f264e67d35c..74348f2c8cf 100644
--- a/source/blender/editors/mask/mask_shapekey.c
+++ b/source/blender/editors/mask/mask_shapekey.c
@@ -71,9 +71,7 @@ static int mask_shape_key_insert_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void MASK_OT_shape_key_insert(wmOperatorType *ot)
@@ -119,9 +117,7 @@ static int mask_shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void MASK_OT_shape_key_clear(wmOperatorType *ot)
@@ -205,9 +201,7 @@ static int mask_shape_key_feather_reset_exec(bContext *C, wmOperator *UNUSED(op)
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void MASK_OT_shape_key_feather_reset(wmOperatorType *ot)
@@ -365,9 +359,7 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void MASK_OT_shape_key_rekey(wmOperatorType *ot)
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 457c8ba30e6..749c6cd640e 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -216,11 +216,9 @@ PTCacheEdit *PE_get_current_from_psys(ParticleSystem *psys)
if ((psys->flag & PSYS_HAIR_DYNAMICS) != 0 && (psys->pointcache->flag & PTCACHE_BAKED) != 0) {
return psys->pointcache->edit;
}
- else {
- return psys->edit;
- }
+ return psys->edit;
}
- else if (psys->pointcache->flag & PTCACHE_BAKED) {
+ if (psys->pointcache->flag & PTCACHE_BAKED) {
return psys->pointcache->edit;
}
return NULL;
@@ -561,9 +559,7 @@ static bool key_test_depth(const PEData *data, const float co[3], const int scre
if (win[2] - 0.00001f > depth) {
return 0;
}
- else {
- return 1;
- }
+ return 1;
}
static bool key_inside_circle(const PEData *data, float rad, const float co[3], float *distance)
@@ -618,9 +614,7 @@ static bool key_inside_test(PEData *data, const float co[3])
if (data->mval) {
return key_inside_circle(data, data->rad, co, NULL);
}
- else {
- return key_inside_rect(data, co);
- }
+ return key_inside_rect(data, co);
}
static bool point_is_selected(PTCacheEditPoint *point)
@@ -3372,9 +3366,7 @@ static void PE_mirror_x(Depsgraph *depsgraph, Scene *scene, Object *ob, int tagg
PE_mirror_particle(ob, psmd_eval->mesh_final, psys, pa, NULL);
continue;
}
- else {
- point->flag |= PEP_TAG;
- }
+ point->flag |= PEP_TAG;
}
}
diff --git a/source/blender/editors/physics/rigidbody_constraint.c b/source/blender/editors/physics/rigidbody_constraint.c
index a59b031298c..4939bf0086b 100644
--- a/source/blender/editors/physics/rigidbody_constraint.c
+++ b/source/blender/editors/physics/rigidbody_constraint.c
@@ -68,9 +68,7 @@ static bool ED_operator_rigidbody_con_active_poll(bContext *C)
Object *ob = ED_object_active_context(C);
return (ob && ob->rigidbody_constraint);
}
- else {
- return false;
- }
+ return false;
}
static bool ED_operator_rigidbody_con_add_poll(bContext *C)
@@ -151,9 +149,7 @@ static int rigidbody_con_add_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void RIGIDBODY_OT_constraint_add(wmOperatorType *ot)
@@ -193,9 +189,7 @@ static int rigidbody_con_remove_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Object has no Rigid Body Constraint to remove");
return OPERATOR_CANCELLED;
}
- else {
- ED_rigidbody_constraint_remove(bmain, scene, ob);
- }
+ ED_rigidbody_constraint_remove(bmain, scene, ob);
/* send updates */
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c
index 78369345b9a..b91385c502c 100644
--- a/source/blender/editors/physics/rigidbody_object.c
+++ b/source/blender/editors/physics/rigidbody_object.c
@@ -73,9 +73,7 @@ static bool ED_operator_rigidbody_active_poll(bContext *C)
Object *ob = ED_object_active_context(C);
return (ob && ob->rigidbody_object);
}
- else {
- return 0;
- }
+ return 0;
}
static bool ED_operator_rigidbody_add_poll(bContext *C)
@@ -91,9 +89,7 @@ static bool ED_operator_rigidbody_add_poll(bContext *C)
Object *ob = ED_object_active_context(C);
return (ob && ob->type == OB_MESH);
}
- else {
- return false;
- }
+ return false;
}
/* ----------------- */
@@ -135,9 +131,7 @@ static int rigidbody_object_add_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void RIGIDBODY_OT_object_add(wmOperatorType *ot)
@@ -186,10 +180,9 @@ static int rigidbody_object_remove_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
- else {
- BKE_report(op->reports, RPT_ERROR, "Object has no Rigid Body settings to remove");
- return OPERATOR_CANCELLED;
- }
+
+ BKE_report(op->reports, RPT_ERROR, "Object has no Rigid Body settings to remove");
+ return OPERATOR_CANCELLED;
}
void RIGIDBODY_OT_object_remove(wmOperatorType *ot)
@@ -233,9 +226,7 @@ static int rigidbody_objects_add_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void RIGIDBODY_OT_objects_add(wmOperatorType *ot)
@@ -286,9 +277,7 @@ static int rigidbody_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
/* done */
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void RIGIDBODY_OT_objects_remove(wmOperatorType *ot)
@@ -340,9 +329,7 @@ static int rigidbody_objects_shape_change_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void RIGIDBODY_OT_shape_change(wmOperatorType *ot)
@@ -531,9 +518,7 @@ static int rigidbody_objects_calc_mass_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void RIGIDBODY_OT_mass_calculate(wmOperatorType *ot)
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 1db7bf5a766..25b4ddc15fd 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -220,12 +220,10 @@ static void image_buffer_rect_update(RenderJob *rj,
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
return;
}
- else {
- if (rr->renlay == NULL) {
- return;
- }
- rectf = RE_RenderLayerGetPass(rr->renlay, RE_PASSNAME_COMBINED, viewname);
+ if (rr->renlay == NULL) {
+ return;
}
+ rectf = RE_RenderLayerGetPass(rr->renlay, RE_PASSNAME_COMBINED, viewname);
}
if (rectf == NULL) {
return;
@@ -579,7 +577,7 @@ static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrec
rj->image_outdated = true;
return;
}
- else if (rj->image_outdated) {
+ if (rj->image_outdated) {
/* update entire render */
rj->image_outdated = false;
BKE_image_signal(rj->main, ima, NULL, IMA_SIGNAL_COLORMANAGE);
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index e2444d4e3b5..673df69bf9b 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -1236,9 +1236,8 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, const wmEvent
screen_opengl_render_end(C, op->customdata);
return OPERATOR_FINISHED;
}
- else {
- ret = screen_opengl_render_anim_step(C, op);
- }
+
+ ret = screen_opengl_render_anim_step(C, op);
/* stop at the end or on error */
if (ret == false) {
@@ -1291,16 +1290,15 @@ static int screen_opengl_render_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
- else {
- bool ret = true;
- if (!screen_opengl_render_anim_initialize(C, op)) {
- return OPERATOR_CANCELLED;
- }
+ bool ret = true;
- while (ret) {
- ret = screen_opengl_render_anim_step(C, op);
- }
+ if (!screen_opengl_render_anim_initialize(C, op)) {
+ return OPERATOR_CANCELLED;
+ }
+
+ while (ret) {
+ ret = screen_opengl_render_anim_step(C, op);
}
/* no redraw needed, we leave state as we entered it */
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 0e15db17e14..754f8226684 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -1666,13 +1666,13 @@ static int freestyle_get_modifier_type(PointerRNA *ptr)
if (RNA_struct_is_a(ptr->type, &RNA_LineStyleColorModifier)) {
return LS_MODIFIER_TYPE_COLOR;
}
- else if (RNA_struct_is_a(ptr->type, &RNA_LineStyleAlphaModifier)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_LineStyleAlphaModifier)) {
return LS_MODIFIER_TYPE_ALPHA;
}
- else if (RNA_struct_is_a(ptr->type, &RNA_LineStyleThicknessModifier)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_LineStyleThicknessModifier)) {
return LS_MODIFIER_TYPE_THICKNESS;
}
- else if (RNA_struct_is_a(ptr->type, &RNA_LineStyleGeometryModifier)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_LineStyleGeometryModifier)) {
return LS_MODIFIER_TYPE_GEOMETRY;
}
return -1;
diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c
index a9c855b14b0..fd5963b217b 100644
--- a/source/blender/editors/render/render_view.c
+++ b/source/blender/editors/render/render_view.c
@@ -283,12 +283,12 @@ static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
- else if (sima->flag & SI_FULLWINDOW) {
+ if (sima->flag & SI_FULLWINDOW) {
sima->flag &= ~SI_FULLWINDOW;
ED_screen_state_toggle(C, win, area, SCREENMAXIMIZED);
return OPERATOR_FINISHED;
}
- else if (WM_window_is_temp_screen(win)) {
+ if (WM_window_is_temp_screen(win)) {
wm_window_close(C, CTX_wm_manager(C), win);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/scene/scene_edit.c b/source/blender/editors/scene/scene_edit.c
index a1fa5e2d655..fa63a890de7 100644
--- a/source/blender/editors/scene/scene_edit.c
+++ b/source/blender/editors/scene/scene_edit.c
@@ -133,8 +133,8 @@ static bool view_layer_remove_poll(const Scene *scene, const ViewLayer *layer)
if (act == -1) {
return false;
}
- else if ((scene->view_layers.first == scene->view_layers.last) &&
- (scene->view_layers.first == layer)) {
+ if ((scene->view_layers.first == scene->view_layers.last) &&
+ (scene->view_layers.first == layer)) {
/* ensure 1 layer is kept */
return false;
}
diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c
index b5a0c4a9e22..bffd6cc421d 100644
--- a/source/blender/editors/space_action/action_data.c
+++ b/source/blender/editors/space_action/action_data.c
@@ -337,10 +337,9 @@ static int action_pushdown_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
return OPERATOR_CANCELLED;
}
- else {
- /* action can be safely added */
- BKE_nla_action_pushdown(adt);
- }
+
+ /* action can be safely added */
+ BKE_nla_action_pushdown(adt);
/* Stop displaying this action in this editor
* NOTE: The editor itself doesn't set a user...
@@ -383,24 +382,23 @@ static int action_stash_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
return OPERATOR_CANCELLED;
}
- else {
- /* stash the action */
- if (BKE_nla_action_stash(adt)) {
- /* The stash operation will remove the user already,
- * so the flushing step later shouldn't double up
- * the user-count fixes. Hence, we must unset this ref
- * first before setting the new action.
- */
- saction->action = NULL;
- }
- else {
- /* action has already been added - simply warn about this, and clear */
- BKE_report(op->reports, RPT_ERROR, "Action has already been stashed");
- }
- /* clear action refs from editor, and then also the backing data (not necessary) */
- actedit_change_action(C, NULL);
+ /* stash the action */
+ if (BKE_nla_action_stash(adt)) {
+ /* The stash operation will remove the user already,
+ * so the flushing step later shouldn't double up
+ * the user-count fixes. Hence, we must unset this ref
+ * first before setting the new action.
+ */
+ saction->action = NULL;
+ }
+ else {
+ /* action has already been added - simply warn about this, and clear */
+ BKE_report(op->reports, RPT_ERROR, "Action has already been stashed");
}
+
+ /* clear action refs from editor, and then also the backing data (not necessary) */
+ actedit_change_action(C, NULL);
}
/* Send notifiers that stuff has changed */
@@ -486,28 +484,27 @@ static int action_stash_create_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
return OPERATOR_CANCELLED;
}
- else {
- /* stash the action */
- if (BKE_nla_action_stash(adt)) {
- bAction *new_action = NULL;
- /* Create new action not based on the old one
- * (since the "new" operator already does that). */
- new_action = action_create_new(C, NULL);
+ /* stash the action */
+ if (BKE_nla_action_stash(adt)) {
+ bAction *new_action = NULL;
- /* The stash operation will remove the user already,
- * so the flushing step later shouldn't double up
- * the user-count fixes. Hence, we must unset this ref
- * first before setting the new action.
- */
- saction->action = NULL;
- actedit_change_action(C, new_action);
- }
- else {
- /* action has already been added - simply warn about this, and clear */
- BKE_report(op->reports, RPT_ERROR, "Action has already been stashed");
- actedit_change_action(C, NULL);
- }
+ /* Create new action not based on the old one
+ * (since the "new" operator already does that). */
+ new_action = action_create_new(C, NULL);
+
+ /* The stash operation will remove the user already,
+ * so the flushing step later shouldn't double up
+ * the user-count fixes. Hence, we must unset this ref
+ * first before setting the new action.
+ */
+ saction->action = NULL;
+ actedit_change_action(C, new_action);
+ }
+ else {
+ /* action has already been added - simply warn about this, and clear */
+ BKE_report(op->reports, RPT_ERROR, "Action has already been stashed");
+ actedit_change_action(C, NULL);
}
}
@@ -709,11 +706,11 @@ static NlaStrip *action_layer_get_nlastrip(ListBase *strips, float ctime)
/* in range - use this one */
return strip;
}
- else if ((ctime < strip->start) && (strip->prev == NULL)) {
+ if ((ctime < strip->start) && (strip->prev == NULL)) {
/* before first - use this one */
return strip;
}
- else if ((ctime > strip->end) && (strip->next == NULL)) {
+ if ((ctime > strip->end) && (strip->next == NULL)) {
/* after last - use this one */
return strip;
}
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index aa784800be0..185066b49ce 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -272,9 +272,8 @@ static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
if (ac.scene == NULL) {
return OPERATOR_CANCELLED;
}
- else {
- scene = ac.scene;
- }
+
+ scene = ac.scene;
/* set the range directly */
get_keyframe_extents(&ac, &min, &max, false);
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index f4141fd31f8..f2f377c142f 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -146,7 +146,7 @@ static int buttons_context_path_world(ButsContextPath *path)
return 1;
}
/* if we have a scene, use the scene's world */
- else if (buttons_context_path_scene(path)) {
+ if (buttons_context_path_scene(path)) {
scene = path->ptr[path->len - 1].data;
world = scene->world;
@@ -155,9 +155,8 @@ static int buttons_context_path_world(ButsContextPath *path)
path->len++;
return 1;
}
- else {
- return 1;
- }
+
+ return 1;
}
/* no path to a world possible */
@@ -174,7 +173,7 @@ static int buttons_context_path_linestyle(ButsContextPath *path, wmWindow *windo
return 1;
}
/* if we have a view layer, use the lineset's linestyle */
- else if (buttons_context_path_view_layer(path, window)) {
+ if (buttons_context_path_view_layer(path, window)) {
ViewLayer *view_layer = path->ptr[path->len - 1].data;
linestyle = BKE_linestyle_active_from_view_layer(view_layer);
if (linestyle) {
@@ -223,45 +222,45 @@ static int buttons_context_path_data(ButsContextPath *path, int type)
if (RNA_struct_is_a(ptr->type, &RNA_Mesh) && (type == -1 || type == OB_MESH)) {
return 1;
}
- else if (RNA_struct_is_a(ptr->type, &RNA_Curve) &&
- (type == -1 || ELEM(type, OB_CURVE, OB_SURF, OB_FONT))) {
+ if (RNA_struct_is_a(ptr->type, &RNA_Curve) &&
+ (type == -1 || ELEM(type, OB_CURVE, OB_SURF, OB_FONT))) {
return 1;
}
- else if (RNA_struct_is_a(ptr->type, &RNA_Armature) && (type == -1 || type == OB_ARMATURE)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_Armature) && (type == -1 || type == OB_ARMATURE)) {
return 1;
}
- else if (RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (type == -1 || type == OB_MBALL)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (type == -1 || type == OB_MBALL)) {
return 1;
}
- else if (RNA_struct_is_a(ptr->type, &RNA_Lattice) && (type == -1 || type == OB_LATTICE)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_Lattice) && (type == -1 || type == OB_LATTICE)) {
return 1;
}
- else if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) {
return 1;
}
- else if (RNA_struct_is_a(ptr->type, &RNA_Light) && (type == -1 || type == OB_LAMP)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_Light) && (type == -1 || type == OB_LAMP)) {
return 1;
}
- else if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) {
return 1;
}
- else if (RNA_struct_is_a(ptr->type, &RNA_LightProbe) && (type == -1 || type == OB_LIGHTPROBE)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_LightProbe) && (type == -1 || type == OB_LIGHTPROBE)) {
return 1;
}
- else if (RNA_struct_is_a(ptr->type, &RNA_GreasePencil) && (type == -1 || type == OB_GPENCIL)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_GreasePencil) && (type == -1 || type == OB_GPENCIL)) {
return 1;
}
- else if (RNA_struct_is_a(ptr->type, &RNA_Hair) && (type == -1 || type == OB_HAIR)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_Hair) && (type == -1 || type == OB_HAIR)) {
return 1;
}
- else if (RNA_struct_is_a(ptr->type, &RNA_PointCloud) && (type == -1 || type == OB_POINTCLOUD)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_PointCloud) && (type == -1 || type == OB_POINTCLOUD)) {
return 1;
}
- else if (RNA_struct_is_a(ptr->type, &RNA_Volume) && (type == -1 || type == OB_VOLUME)) {
+ if (RNA_struct_is_a(ptr->type, &RNA_Volume) && (type == -1 || type == OB_VOLUME)) {
return 1;
}
/* try to get an object in the path, no pinning supported here */
- else if (buttons_context_path_object(path)) {
+ if (buttons_context_path_object(path)) {
ob = path->ptr[path->len - 1].data;
if (ob && (type == -1 || type == ob->type)) {
@@ -326,7 +325,7 @@ static int buttons_context_path_material(ButsContextPath *path)
return 1;
}
/* if we have an object, use the object material slot */
- else if (buttons_context_path_object(path)) {
+ if (buttons_context_path_object(path)) {
ob = path->ptr[path->len - 1].data;
if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
@@ -388,14 +387,13 @@ static int buttons_context_path_pose_bone(ButsContextPath *path)
if (ob->type != OB_ARMATURE || arm->edbo) {
return 0;
}
- else {
- if (arm->act_bone) {
- bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, arm->act_bone->name);
- if (pchan) {
- RNA_pointer_create(&ob->id, &RNA_PoseBone, pchan, &path->ptr[path->len]);
- path->len++;
- return 1;
- }
+
+ if (arm->act_bone) {
+ bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, arm->act_bone->name);
+ if (pchan) {
+ RNA_pointer_create(&ob->id, &RNA_PoseBone, pchan, &path->ptr[path->len]);
+ path->len++;
+ return 1;
}
}
}
@@ -442,7 +440,7 @@ static int buttons_context_path_brush(const bContext *C, ButsContextPath *path)
return 1;
}
/* if we have a scene, use the toolsettings brushes */
- else if (buttons_context_path_scene(path)) {
+ if (buttons_context_path_scene(path)) {
scene = path->ptr[path->len - 1].data;
if (scene) {
@@ -661,10 +659,10 @@ static int buttons_shading_new_context(const bContext *C, int flag)
if (flag & (1 << BCONTEXT_MATERIAL)) {
return BCONTEXT_MATERIAL;
}
- else if (ob && ELEM(ob->type, OB_LAMP, OB_CAMERA) && (flag & (1 << BCONTEXT_DATA))) {
+ if (ob && ELEM(ob->type, OB_LAMP, OB_CAMERA) && (flag & (1 << BCONTEXT_DATA))) {
return BCONTEXT_DATA;
}
- else if (flag & (1 << BCONTEXT_WORLD)) {
+ if (flag & (1 << BCONTEXT_WORLD)) {
return BCONTEXT_WORLD;
}
@@ -825,72 +823,72 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
}
return 1;
}
- else if (CTX_data_equals(member, "scene")) {
+ if (CTX_data_equals(member, "scene")) {
/* Do not return one here if scene not found in path,
* in this case we want to get default context scene! */
return set_pointer_type(path, result, &RNA_Scene);
}
- else if (CTX_data_equals(member, "world")) {
+ if (CTX_data_equals(member, "world")) {
set_pointer_type(path, result, &RNA_World);
return 1;
}
- else if (CTX_data_equals(member, "object")) {
+ if (CTX_data_equals(member, "object")) {
set_pointer_type(path, result, &RNA_Object);
return 1;
}
- else if (CTX_data_equals(member, "mesh")) {
+ if (CTX_data_equals(member, "mesh")) {
set_pointer_type(path, result, &RNA_Mesh);
return 1;
}
- else if (CTX_data_equals(member, "armature")) {
+ if (CTX_data_equals(member, "armature")) {
set_pointer_type(path, result, &RNA_Armature);
return 1;
}
- else if (CTX_data_equals(member, "lattice")) {
+ if (CTX_data_equals(member, "lattice")) {
set_pointer_type(path, result, &RNA_Lattice);
return 1;
}
- else if (CTX_data_equals(member, "curve")) {
+ if (CTX_data_equals(member, "curve")) {
set_pointer_type(path, result, &RNA_Curve);
return 1;
}
- else if (CTX_data_equals(member, "meta_ball")) {
+ if (CTX_data_equals(member, "meta_ball")) {
set_pointer_type(path, result, &RNA_MetaBall);
return 1;
}
- else if (CTX_data_equals(member, "light")) {
+ if (CTX_data_equals(member, "light")) {
set_pointer_type(path, result, &RNA_Light);
return 1;
}
- else if (CTX_data_equals(member, "camera")) {
+ if (CTX_data_equals(member, "camera")) {
set_pointer_type(path, result, &RNA_Camera);
return 1;
}
- else if (CTX_data_equals(member, "speaker")) {
+ if (CTX_data_equals(member, "speaker")) {
set_pointer_type(path, result, &RNA_Speaker);
return 1;
}
- else if (CTX_data_equals(member, "lightprobe")) {
+ if (CTX_data_equals(member, "lightprobe")) {
set_pointer_type(path, result, &RNA_LightProbe);
return 1;
}
- else if (CTX_data_equals(member, "hair")) {
+ if (CTX_data_equals(member, "hair")) {
set_pointer_type(path, result, &RNA_Hair);
return 1;
}
- else if (CTX_data_equals(member, "pointcloud")) {
+ if (CTX_data_equals(member, "pointcloud")) {
set_pointer_type(path, result, &RNA_PointCloud);
return 1;
}
- else if (CTX_data_equals(member, "volume")) {
+ if (CTX_data_equals(member, "volume")) {
set_pointer_type(path, result, &RNA_Volume);
return 1;
}
- else if (CTX_data_equals(member, "material")) {
+ if (CTX_data_equals(member, "material")) {
set_pointer_type(path, result, &RNA_Material);
return 1;
}
- else if (CTX_data_equals(member, "texture")) {
+ if (CTX_data_equals(member, "texture")) {
ButsContextTexture *ct = sbuts->texuser;
if (ct) {
@@ -899,7 +897,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
- else if (CTX_data_equals(member, "material_slot")) {
+ if (CTX_data_equals(member, "material_slot")) {
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
if (ptr) {
@@ -917,7 +915,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
- else if (CTX_data_equals(member, "texture_user")) {
+ if (CTX_data_equals(member, "texture_user")) {
ButsContextTexture *ct = sbuts->texuser;
if (!ct) {
@@ -931,7 +929,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
- else if (CTX_data_equals(member, "texture_user_property")) {
+ if (CTX_data_equals(member, "texture_user_property")) {
ButsContextTexture *ct = sbuts->texuser;
if (!ct) {
@@ -945,7 +943,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
- else if (CTX_data_equals(member, "texture_node")) {
+ if (CTX_data_equals(member, "texture_node")) {
ButsContextTexture *ct = sbuts->texuser;
if (ct) {
@@ -958,7 +956,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
}
return -1; /* found but not available */
}
- else if (CTX_data_equals(member, "texture_slot")) {
+ if (CTX_data_equals(member, "texture_slot")) {
ButsContextTexture *ct = sbuts->texuser;
PointerRNA *ptr;
@@ -985,23 +983,23 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1;
}
- else if (CTX_data_equals(member, "bone")) {
+ if (CTX_data_equals(member, "bone")) {
set_pointer_type(path, result, &RNA_Bone);
return 1;
}
- else if (CTX_data_equals(member, "edit_bone")) {
+ if (CTX_data_equals(member, "edit_bone")) {
set_pointer_type(path, result, &RNA_EditBone);
return 1;
}
- else if (CTX_data_equals(member, "pose_bone")) {
+ if (CTX_data_equals(member, "pose_bone")) {
set_pointer_type(path, result, &RNA_PoseBone);
return 1;
}
- else if (CTX_data_equals(member, "particle_system")) {
+ if (CTX_data_equals(member, "particle_system")) {
set_pointer_type(path, result, &RNA_ParticleSystem);
return 1;
}
- else if (CTX_data_equals(member, "particle_system_editable")) {
+ if (CTX_data_equals(member, "particle_system_editable")) {
if (PE_poll((bContext *)C)) {
set_pointer_type(path, result, &RNA_ParticleSystem);
}
@@ -1010,7 +1008,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
}
return 1;
}
- else if (CTX_data_equals(member, "particle_settings")) {
+ if (CTX_data_equals(member, "particle_settings")) {
/* only available when pinned */
PointerRNA *ptr = get_pointer_type(path, &RNA_ParticleSettings);
@@ -1018,20 +1016,20 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
CTX_data_pointer_set(result, ptr->owner_id, &RNA_ParticleSettings, ptr->data);
return 1;
}
- else {
- /* get settings from active particle system instead */
- ptr = get_pointer_type(path, &RNA_ParticleSystem);
- if (ptr && ptr->data) {
- ParticleSettings *part = ((ParticleSystem *)ptr->data)->part;
- CTX_data_pointer_set(result, ptr->owner_id, &RNA_ParticleSettings, part);
- return 1;
- }
+ /* get settings from active particle system instead */
+ ptr = get_pointer_type(path, &RNA_ParticleSystem);
+
+ if (ptr && ptr->data) {
+ ParticleSettings *part = ((ParticleSystem *)ptr->data)->part;
+ CTX_data_pointer_set(result, ptr->owner_id, &RNA_ParticleSettings, part);
+ return 1;
}
+
set_pointer_type(path, result, &RNA_ParticleSettings);
return 1;
}
- else if (CTX_data_equals(member, "cloth")) {
+ if (CTX_data_equals(member, "cloth")) {
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
if (ptr && ptr->data) {
@@ -1042,7 +1040,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
}
return -1; /* found but not available */
}
- else if (CTX_data_equals(member, "soft_body")) {
+ if (CTX_data_equals(member, "soft_body")) {
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
if (ptr && ptr->data) {
@@ -1054,7 +1052,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return -1; /* found but not available */
}
- else if (CTX_data_equals(member, "fluid")) {
+ if (CTX_data_equals(member, "fluid")) {
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
if (ptr && ptr->data) {
@@ -1065,7 +1063,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
}
return -1; /* found but not available */
}
- else if (CTX_data_equals(member, "collision")) {
+ if (CTX_data_equals(member, "collision")) {
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
if (ptr && ptr->data) {
@@ -1076,11 +1074,11 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
}
return -1; /* found but not available */
}
- else if (CTX_data_equals(member, "brush")) {
+ if (CTX_data_equals(member, "brush")) {
set_pointer_type(path, result, &RNA_Brush);
return 1;
}
- else if (CTX_data_equals(member, "dynamic_paint")) {
+ if (CTX_data_equals(member, "dynamic_paint")) {
PointerRNA *ptr = get_pointer_type(path, &RNA_Object);
if (ptr && ptr->data) {
@@ -1091,19 +1089,15 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
}
return -1; /* found but not available */
}
- else if (CTX_data_equals(member, "line_style")) {
+ if (CTX_data_equals(member, "line_style")) {
set_pointer_type(path, result, &RNA_FreestyleLineStyle);
return 1;
}
- else if (CTX_data_equals(member, "gpencil")) {
+ if (CTX_data_equals(member, "gpencil")) {
set_pointer_type(path, result, &RNA_GreasePencil);
return 1;
}
- else {
- return 0; /* not found */
- }
-
- return -1; /* found but not available */
+ return 0; /* not found */
}
/************************* Drawing the Path ************************/
@@ -1154,13 +1148,13 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
ptr->type == &RNA_Scene)) {
continue;
}
- else if ((!ELEM(sbuts->mainb,
- BCONTEXT_RENDER,
- BCONTEXT_OUTPUT,
- BCONTEXT_SCENE,
- BCONTEXT_VIEW_LAYER,
- BCONTEXT_WORLD) &&
- ptr->type == &RNA_ViewLayer)) {
+ if ((!ELEM(sbuts->mainb,
+ BCONTEXT_RENDER,
+ BCONTEXT_OUTPUT,
+ BCONTEXT_SCENE,
+ BCONTEXT_VIEW_LAYER,
+ BCONTEXT_WORLD) &&
+ ptr->type == &RNA_ViewLayer)) {
continue;
}
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 53a904438eb..733f344fbc6 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -208,45 +208,44 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event)
MEM_freeN(str);
return OPERATOR_CANCELLED;
}
- else {
- PropertyRNA *prop_relpath;
- const char *path_prop = RNA_struct_find_property(op->ptr, "directory") ? "directory" :
- "filepath";
- fbo = MEM_callocN(sizeof(FileBrowseOp), "FileBrowseOp");
- fbo->ptr = ptr;
- fbo->prop = prop;
- fbo->is_undo = is_undo;
- fbo->is_userdef = is_userdef;
- op->customdata = fbo;
-
- /* normally ED_fileselect_get_params would handle this but we need to because of stupid
- * user-prefs exception - campbell */
- if ((prop_relpath = RNA_struct_find_property(op->ptr, "relative_path"))) {
- if (!RNA_property_is_set(op->ptr, prop_relpath)) {
- bool is_relative = (U.flag & USER_RELPATHS) != 0;
-
- /* while we want to follow the defaults,
- * we better not switch existing paths relative/absolute state. */
- if (str[0]) {
- is_relative = BLI_path_is_rel(str);
- }
-
- if (UNLIKELY(ptr.data == &U)) {
- is_relative = false;
- }
-
- /* annoying exception!, if we're dealing with the user prefs, default relative to be off */
- RNA_property_boolean_set(op->ptr, prop_relpath, is_relative);
+
+ PropertyRNA *prop_relpath;
+ const char *path_prop = RNA_struct_find_property(op->ptr, "directory") ? "directory" :
+ "filepath";
+ fbo = MEM_callocN(sizeof(FileBrowseOp), "FileBrowseOp");
+ fbo->ptr = ptr;
+ fbo->prop = prop;
+ fbo->is_undo = is_undo;
+ fbo->is_userdef = is_userdef;
+ op->customdata = fbo;
+
+ /* normally ED_fileselect_get_params would handle this but we need to because of stupid
+ * user-prefs exception - campbell */
+ if ((prop_relpath = RNA_struct_find_property(op->ptr, "relative_path"))) {
+ if (!RNA_property_is_set(op->ptr, prop_relpath)) {
+ bool is_relative = (U.flag & USER_RELPATHS) != 0;
+
+ /* while we want to follow the defaults,
+ * we better not switch existing paths relative/absolute state. */
+ if (str[0]) {
+ is_relative = BLI_path_is_rel(str);
+ }
+
+ if (UNLIKELY(ptr.data == &U)) {
+ is_relative = false;
}
+
+ /* annoying exception!, if we're dealing with the user prefs, default relative to be off */
+ RNA_property_boolean_set(op->ptr, prop_relpath, is_relative);
}
+ }
- RNA_string_set(op->ptr, path_prop, str);
- MEM_freeN(str);
+ RNA_string_set(op->ptr, path_prop, str);
+ MEM_freeN(str);
- WM_event_add_fileselect(C, op);
+ WM_event_add_fileselect(C, op);
- return OPERATOR_RUNNING_MODAL;
- }
+ return OPERATOR_RUNNING_MODAL;
}
void BUTTONS_OT_file_browse(wmOperatorType *ot)
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index 981e056fa63..f0d4a45a3dd 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -287,12 +287,11 @@ static bool console_line_column_from_index(
*r_col = offset - pos;
return true;
}
- else {
- *r_cl = NULL;
- *r_cl_offset = -1;
- *r_col = -1;
- return false;
- }
+
+ *r_cl = NULL;
+ *r_cl_offset = -1;
+ *r_col = -1;
+ return false;
}
/* static funcs for text editing */
@@ -403,9 +402,8 @@ static int console_insert_exec(bContext *C, wmOperator *op)
if (len == 0) {
return OPERATOR_CANCELLED;
}
- else {
- console_select_offset(sc, len);
- }
+
+ console_select_offset(sc, len);
console_textview_update_rect(sc, region);
ED_area_tag_redraw(CTX_wm_area(C));
@@ -426,21 +424,20 @@ static int console_insert_invoke(bContext *C, wmOperator *op, const wmEvent *eve
if ((event->ctrl || event->oskey) && !event->utf8_buf[0]) {
return OPERATOR_PASS_THROUGH;
}
- else {
- char str[BLI_UTF8_MAX + 1];
- size_t len;
- if (event->utf8_buf[0]) {
- len = BLI_str_utf8_size_safe(event->utf8_buf);
- memcpy(str, event->utf8_buf, len);
- }
- else {
- /* in theory, ghost can set value to extended ascii here */
- len = BLI_str_utf8_from_unicode(event->ascii, str);
- }
- str[len] = '\0';
- RNA_string_set(op->ptr, "text", str);
+ char str[BLI_UTF8_MAX + 1];
+ size_t len;
+
+ if (event->utf8_buf[0]) {
+ len = BLI_str_utf8_size_safe(event->utf8_buf);
+ memcpy(str, event->utf8_buf, len);
+ }
+ else {
+ /* in theory, ghost can set value to extended ascii here */
+ len = BLI_str_utf8_from_unicode(event->ascii, str);
}
+ str[len] = '\0';
+ RNA_string_set(op->ptr, "text", str);
}
return console_insert_exec(C, op);
}
@@ -674,9 +671,8 @@ static int console_delete_exec(bContext *C, wmOperator *op)
if (!done) {
return OPERATOR_CANCELLED;
}
- else {
- console_select_offset(sc, -stride);
- }
+
+ console_select_offset(sc, -stride);
console_textview_update_rect(sc, region);
ED_area_tag_redraw(CTX_wm_area(C));
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 6552dfc18f3..45e45093238 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -778,7 +778,7 @@ static bool file_walk_select_do(bContext *C,
}
/* if we don't extend, selecting '..' (index == 0) is allowed so
* using key selection to go to parent directory is possible */
- else if (active_new != 0) {
+ if (active_new != 0) {
/* select initial file */
active_new = active_old;
}
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 6b39dc4ae15..cb785495ad5 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -637,11 +637,10 @@ static bool is_hidden_dot_filename(const char *filename, FileListInternEntry *fi
if (filename[0] == '.' && !ELEM(filename[1], '.', '\0')) {
return true; /* ignore .file */
}
- else {
- int len = strlen(filename);
- if ((len > 0) && (filename[len - 1] == '~')) {
- return true; /* ignore file~ */
- }
+
+ int len = strlen(filename);
+ if ((len > 0) && (filename[len - 1] == '~')) {
+ return true; /* ignore file~ */
}
/* filename might actually be a piece of path, in which case we have to check all its parts. */
@@ -1011,43 +1010,41 @@ static int filelist_geticon_ex(FileDirEntry *file,
if (FILENAME_IS_PARENT(file->relpath)) {
return is_main ? ICON_FILE_PARENT : ICON_NONE;
}
- else if (typeflag & FILE_TYPE_APPLICATIONBUNDLE) {
+ if (typeflag & FILE_TYPE_APPLICATIONBUNDLE) {
return ICON_UGLYPACKAGE;
}
- else if (typeflag & FILE_TYPE_BLENDER) {
+ if (typeflag & FILE_TYPE_BLENDER) {
return ICON_FILE_BLEND;
}
- else if (is_main) {
+ if (is_main) {
/* Do not return icon for folders if icons are not 'main' draw type
* (e.g. when used over previews). */
return (file->attributes & FILE_ATTR_ANY_LINK) ? ICON_FOLDER_REDIRECT : ICON_FILE_FOLDER;
}
- else {
- /* If this path is in System list or path cache then use that icon. */
- struct FSMenu *fsmenu = ED_fsmenu_get();
- FSMenuCategory categories[] = {
- FS_CATEGORY_SYSTEM,
- FS_CATEGORY_SYSTEM_BOOKMARKS,
- FS_CATEGORY_OTHER,
- };
-
- for (int i = 0; i < ARRAY_SIZE(categories); i++) {
- FSMenuEntry *tfsm = ED_fsmenu_get_category(fsmenu, categories[i]);
- char fullpath[FILE_MAX_LIBEXTRA];
- char *target = fullpath;
- if (file->redirection_path) {
- target = file->redirection_path;
- }
- else {
- BLI_join_dirfile(fullpath, sizeof(fullpath), root, file->relpath);
- BLI_path_slash_ensure(fullpath);
- }
- for (; tfsm; tfsm = tfsm->next) {
- if (STREQ(tfsm->path, target)) {
- /* Never want a little folder inside a large one. */
- return (tfsm->icon == ICON_FILE_FOLDER) ? ICON_NONE : tfsm->icon;
- }
+ /* If this path is in System list or path cache then use that icon. */
+ struct FSMenu *fsmenu = ED_fsmenu_get();
+ FSMenuCategory categories[] = {
+ FS_CATEGORY_SYSTEM,
+ FS_CATEGORY_SYSTEM_BOOKMARKS,
+ FS_CATEGORY_OTHER,
+ };
+
+ for (int i = 0; i < ARRAY_SIZE(categories); i++) {
+ FSMenuEntry *tfsm = ED_fsmenu_get_category(fsmenu, categories[i]);
+ char fullpath[FILE_MAX_LIBEXTRA];
+ char *target = fullpath;
+ if (file->redirection_path) {
+ target = file->redirection_path;
+ }
+ else {
+ BLI_join_dirfile(fullpath, sizeof(fullpath), root, file->relpath);
+ BLI_path_slash_ensure(fullpath);
+ }
+ for (; tfsm; tfsm = tfsm->next) {
+ if (STREQ(tfsm->path, target)) {
+ /* Never want a little folder inside a large one. */
+ return (tfsm->icon == ICON_FILE_FOLDER) ? ICON_NONE : tfsm->icon;
}
}
}
@@ -1055,10 +1052,10 @@ static int filelist_geticon_ex(FileDirEntry *file,
if (file->attributes & FILE_ATTR_OFFLINE) {
return ICON_ERROR;
}
- else if (file->attributes & FILE_ATTR_TEMPORARY) {
+ if (file->attributes & FILE_ATTR_TEMPORARY) {
return ICON_FILE_CACHE;
}
- else if (file->attributes & FILE_ATTR_SYSTEM) {
+ if (file->attributes & FILE_ATTR_SYSTEM) {
return ICON_SYSTEM;
}
}
@@ -1066,49 +1063,49 @@ static int filelist_geticon_ex(FileDirEntry *file,
if (typeflag & FILE_TYPE_BLENDER) {
return ICON_FILE_BLEND;
}
- else if (typeflag & FILE_TYPE_BLENDER_BACKUP) {
+ if (typeflag & FILE_TYPE_BLENDER_BACKUP) {
return ICON_FILE_BACKUP;
}
- else if (typeflag & FILE_TYPE_IMAGE) {
+ if (typeflag & FILE_TYPE_IMAGE) {
return ICON_FILE_IMAGE;
}
- else if (typeflag & FILE_TYPE_MOVIE) {
+ if (typeflag & FILE_TYPE_MOVIE) {
return ICON_FILE_MOVIE;
}
- else if (typeflag & FILE_TYPE_PYSCRIPT) {
+ if (typeflag & FILE_TYPE_PYSCRIPT) {
return ICON_FILE_SCRIPT;
}
- else if (typeflag & FILE_TYPE_SOUND) {
+ if (typeflag & FILE_TYPE_SOUND) {
return ICON_FILE_SOUND;
}
- else if (typeflag & FILE_TYPE_FTFONT) {
+ if (typeflag & FILE_TYPE_FTFONT) {
return ICON_FILE_FONT;
}
- else if (typeflag & FILE_TYPE_BTX) {
+ if (typeflag & FILE_TYPE_BTX) {
return ICON_FILE_BLANK;
}
- else if (typeflag & FILE_TYPE_COLLADA) {
+ if (typeflag & FILE_TYPE_COLLADA) {
return ICON_FILE_3D;
}
- else if (typeflag & FILE_TYPE_ALEMBIC) {
+ if (typeflag & FILE_TYPE_ALEMBIC) {
return ICON_FILE_3D;
}
- else if (typeflag & FILE_TYPE_USD) {
+ if (typeflag & FILE_TYPE_USD) {
return ICON_FILE_3D;
}
- else if (typeflag & FILE_TYPE_VOLUME) {
+ if (typeflag & FILE_TYPE_VOLUME) {
return ICON_FILE_VOLUME;
}
- else if (typeflag & FILE_TYPE_OBJECT_IO) {
+ if (typeflag & FILE_TYPE_OBJECT_IO) {
return ICON_FILE_3D;
}
- else if (typeflag & FILE_TYPE_TEXT) {
+ if (typeflag & FILE_TYPE_TEXT) {
return ICON_FILE_TEXT;
}
- else if (typeflag & FILE_TYPE_ARCHIVE) {
+ if (typeflag & FILE_TYPE_ARCHIVE) {
return ICON_FILE_ARCHIVE;
}
- else if (typeflag & FILE_TYPE_BLENDERLIB) {
+ if (typeflag & FILE_TYPE_BLENDERLIB) {
const int ret = UI_idcode_icon_get(file->blentype);
if (ret != ICON_NONE) {
return ret;
@@ -1145,9 +1142,7 @@ static bool filelist_checkdir_dir(struct FileList *UNUSED(filelist),
parent_dir_until_exists_or_default_root(r_dir);
return true;
}
- else {
- return BLI_is_dir(r_dir);
- }
+ return BLI_is_dir(r_dir);
}
static bool filelist_checkdir_lib(struct FileList *UNUSED(filelist),
@@ -2118,7 +2113,7 @@ void filelist_cache_previews_set(FileList *filelist, const bool use_previews)
return;
}
/* Do not start preview work while listing, gives nasty flickering! */
- else if (use_previews && (filelist->flags & FL_IS_READY)) {
+ if (use_previews && (filelist->flags & FL_IS_READY)) {
cache->flags |= FLC_PREVIEWS_ACTIVE;
BLI_assert((cache->previews_pool == NULL) && (cache->previews_done == NULL));
@@ -2227,67 +2222,65 @@ int ED_path_extension_type(const char *path)
if (BLO_has_bfile_extension(path)) {
return FILE_TYPE_BLENDER;
}
- else if (file_is_blend_backup(path)) {
+ if (file_is_blend_backup(path)) {
return FILE_TYPE_BLENDER_BACKUP;
}
- else if (BLI_path_extension_check(path, ".app")) {
+ if (BLI_path_extension_check(path, ".app")) {
return FILE_TYPE_APPLICATIONBUNDLE;
}
- else if (BLI_path_extension_check(path, ".py")) {
+ if (BLI_path_extension_check(path, ".py")) {
return FILE_TYPE_PYSCRIPT;
}
- else if (BLI_path_extension_check_n(path,
- ".txt",
- ".glsl",
- ".osl",
- ".data",
- ".pov",
- ".ini",
- ".mcr",
- ".inc",
- ".fountain",
- NULL)) {
+ if (BLI_path_extension_check_n(path,
+ ".txt",
+ ".glsl",
+ ".osl",
+ ".data",
+ ".pov",
+ ".ini",
+ ".mcr",
+ ".inc",
+ ".fountain",
+ NULL)) {
return FILE_TYPE_TEXT;
}
- else if (BLI_path_extension_check_n(path, ".ttf", ".ttc", ".pfb", ".otf", ".otc", NULL)) {
+ if (BLI_path_extension_check_n(path, ".ttf", ".ttc", ".pfb", ".otf", ".otc", NULL)) {
return FILE_TYPE_FTFONT;
}
- else if (BLI_path_extension_check(path, ".btx")) {
+ if (BLI_path_extension_check(path, ".btx")) {
return FILE_TYPE_BTX;
}
- else if (BLI_path_extension_check(path, ".dae")) {
+ if (BLI_path_extension_check(path, ".dae")) {
return FILE_TYPE_COLLADA;
}
- else if (BLI_path_extension_check(path, ".abc")) {
+ if (BLI_path_extension_check(path, ".abc")) {
return FILE_TYPE_ALEMBIC;
}
- else if (BLI_path_extension_check_n(path, ".usd", ".usda", ".usdc", NULL)) {
+ if (BLI_path_extension_check_n(path, ".usd", ".usda", ".usdc", NULL)) {
return FILE_TYPE_USD;
}
- else if (BLI_path_extension_check(path, ".vdb")) {
+ if (BLI_path_extension_check(path, ".vdb")) {
return FILE_TYPE_VOLUME;
}
- else if (BLI_path_extension_check(path, ".zip")) {
+ if (BLI_path_extension_check(path, ".zip")) {
return FILE_TYPE_ARCHIVE;
}
- else if (BLI_path_extension_check_n(path, ".obj", ".3ds", ".fbx", ".glb", ".gltf", NULL)) {
+ if (BLI_path_extension_check_n(path, ".obj", ".3ds", ".fbx", ".glb", ".gltf", NULL)) {
return FILE_TYPE_OBJECT_IO;
}
- else if (BLI_path_extension_check_array(path, imb_ext_image)) {
+ if (BLI_path_extension_check_array(path, imb_ext_image)) {
return FILE_TYPE_IMAGE;
}
- else if (BLI_path_extension_check(path, ".ogg")) {
+ if (BLI_path_extension_check(path, ".ogg")) {
if (IMB_isanim(path)) {
return FILE_TYPE_MOVIE;
}
- else {
- return FILE_TYPE_SOUND;
- }
+ return FILE_TYPE_SOUND;
}
- else if (BLI_path_extension_check_array(path, imb_ext_movie)) {
+ if (BLI_path_extension_check_array(path, imb_ext_movie)) {
return FILE_TYPE_MOVIE;
}
- else if (BLI_path_extension_check_array(path, imb_ext_audio)) {
+ if (BLI_path_extension_check_array(path, imb_ext_audio)) {
return FILE_TYPE_SOUND;
}
return 0;
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 3b62941af83..e6c40dce9c8 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -438,13 +438,12 @@ int ED_fileselect_layout_numfiles(FileLayout *layout, ARegion *region)
numfiles = (int)((float)(x_view + x_over) / (float)(x_item));
return numfiles * layout->rows;
}
- else {
- const int y_item = layout->tile_h + (2 * layout->tile_border_y);
- const int y_view = (int)(BLI_rctf_size_y(&region->v2d.cur)) - layout->offset_top;
- const int y_over = y_item - (y_view % y_item);
- numfiles = (int)((float)(y_view + y_over) / (float)(y_item));
- return numfiles * layout->flow_columns;
- }
+
+ const int y_item = layout->tile_h + (2 * layout->tile_border_y);
+ const int y_view = (int)(BLI_rctf_size_y(&region->v2d.cur)) - layout->offset_top;
+ const int y_over = y_item - (y_view % y_item);
+ numfiles = (int)((float)(y_view + y_over) / (float)(y_item));
+ return numfiles * layout->flow_columns;
}
static bool is_inside(int x, int y, int cols, int rows)
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index b03df01a02b..bff81201d60 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -307,14 +307,13 @@ char *ED_fsmenu_entry_get_name(struct FSMenuEntry *fsentry)
if (fsentry->name[0]) {
return fsentry->name;
}
- else {
- /* Here we abuse fsm_iter->name, keeping first char NULL. */
- char *name = fsentry->name + 1;
- size_t name_size = sizeof(fsentry->name) - 1;
- fsmenu_entry_generate_name(fsentry, name, name_size);
- return name;
- }
+ /* Here we abuse fsm_iter->name, keeping first char NULL. */
+ char *name = fsentry->name + 1;
+ size_t name_size = sizeof(fsentry->name) - 1;
+
+ fsmenu_entry_generate_name(fsentry, name, name_size);
+ return name;
}
void ED_fsmenu_entry_set_name(struct FSMenuEntry *fsentry, const char *name)
@@ -411,7 +410,7 @@ void fsmenu_insert_entry(struct FSMenu *fsmenu,
}
return;
}
- else if ((flag & FS_INSERT_SORTED) && cmp_ret < 0) {
+ if ((flag & FS_INSERT_SORTED) && cmp_ret < 0) {
break;
}
}
@@ -948,10 +947,10 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
/* Hide share not usable to the user. */
continue;
}
- else if (!STRPREFIX(mnt->mnt_fsname, "/dev")) {
+ if (!STRPREFIX(mnt->mnt_fsname, "/dev")) {
continue;
}
- else if (STRPREFIX(mnt->mnt_fsname, "/dev/loop")) {
+ if (STRPREFIX(mnt->mnt_fsname, "/dev/loop")) {
/* The dev/loop* entries are SNAPS used by desktop environment
* (Gnome) no need for them to show up in the list. */
continue;
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index f2071d292ca..5ae175f525f 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -327,9 +327,7 @@ static bool draw_fcurve_handles_check(SpaceGraph *sipo, FCurve *fcu)
(fcu->totvert <= 1)) {
return false;
}
- else {
- return true;
- }
+ return true;
}
/* draw lines for F-Curve handles only (this is only done in EditMode)
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 03151da8d4d..1925a3847d6 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -233,9 +233,8 @@ static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
if (ac.scene == NULL) {
return OPERATOR_CANCELLED;
}
- else {
- scene = ac.scene;
- }
+
+ scene = ac.scene;
/* set the range directly */
get_graph_keyframe_extents(&ac, &min, &max, NULL, NULL, false, false);
@@ -1631,11 +1630,10 @@ static int graphkeys_decimate_modal(bContext *C, wmOperator *op, const wmEvent *
graphkeys_decimate_modal_update(C, op);
break;
}
- else {
- /* unhandled event - maybe it was some view manip? */
- /* allow to pass through */
- return OPERATOR_RUNNING_MODAL | OPERATOR_PASS_THROUGH;
- }
+
+ /* unhandled event - maybe it was some view manip? */
+ /* allow to pass through */
+ return OPERATOR_RUNNING_MODAL | OPERATOR_PASS_THROUGH;
}
}
@@ -1694,7 +1692,7 @@ static bool graphkeys_decimate_poll_property(const bContext *UNUSED(C),
if (STREQ(prop_id, "remove_ratio") && mode != DECIM_RATIO) {
return false;
}
- else if (STREQ(prop_id, "remove_error_margin") && mode != DECIM_ERROR) {
+ if (STREQ(prop_id, "remove_error_margin") && mode != DECIM_ERROR) {
return false;
}
}
@@ -2577,7 +2575,7 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
if (strstr(fcu->rna_path, "rotation_euler") == NULL) {
continue;
}
- else if (ELEM(fcu->array_index, 0, 1, 2) == 0) {
+ if (ELEM(fcu->array_index, 0, 1, 2) == 0) {
BKE_reportf(op->reports,
RPT_WARNING,
"Euler Rotation F-Curve has invalid index (ID='%s', Path='%s', Index=%d)",
@@ -2689,23 +2687,22 @@ static int graphkeys_euler_filter_exec(bContext *C, wmOperator *op)
"and that F-Curves for these are in consecutive XYZ order and selected");
return OPERATOR_CANCELLED;
}
- else {
- if (failed) {
- BKE_report(
- op->reports,
- RPT_ERROR,
- "Some Euler Rotations could not be corrected due to missing/unselected/out-of-order "
- "F-Curves, "
- "ensure each rotation has keys for all components, and that F-Curves for these are in "
- "consecutive XYZ order and selected");
- }
- /* set notifier that keyframes have changed */
- WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
-
- /* done at last */
- return OPERATOR_FINISHED;
+ if (failed) {
+ BKE_report(
+ op->reports,
+ RPT_ERROR,
+ "Some Euler Rotations could not be corrected due to missing/unselected/out-of-order "
+ "F-Curves, "
+ "ensure each rotation has keys for all components, and that F-Curves for these are in "
+ "consecutive XYZ order and selected");
}
+
+ /* set notifier that keyframes have changed */
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
+
+ /* done at last */
+ return OPERATOR_FINISHED;
}
void GRAPH_OT_euler_filter(wmOperatorType *ot)
@@ -3347,9 +3344,7 @@ static int graph_fmodifier_copy_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No F-Modifiers available to be copied");
return OPERATOR_CANCELLED;
}
- else {
- return OPERATOR_FINISHED;
- }
+ return OPERATOR_FINISHED;
}
void GRAPH_OT_fmodifier_copy(wmOperatorType *ot)
@@ -3434,10 +3429,9 @@ static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
- else {
- BKE_report(op->reports, RPT_ERROR, "No F-Modifiers to paste");
- return OPERATOR_CANCELLED;
- }
+
+ BKE_report(op->reports, RPT_ERROR, "No F-Modifiers to paste");
+ return OPERATOR_CANCELLED;
}
void GRAPH_OT_fmodifier_paste(wmOperatorType *ot)
@@ -3487,9 +3481,7 @@ static int graph_driver_vars_copy_exec(bContext *C, wmOperator *op)
if (ok) {
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void GRAPH_OT_driver_variables_copy(wmOperatorType *ot)
@@ -3533,9 +3525,7 @@ static int graph_driver_vars_paste_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void GRAPH_OT_driver_variables_paste(wmOperatorType *ot)
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index ae435b5624a..160b731629c 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -298,11 +298,10 @@ static tNearestVertInfo *get_best_nearest_fcurve_vert(ListBase *matches)
BLI_remlink(matches, nvi);
return nvi;
}
- else {
- /* if vert is selected, we've got what we want... */
- if (nvi->sel) {
- found = 1;
- }
+
+ /* if vert is selected, we've got what we want... */
+ if (nvi->sel) {
+ found = 1;
}
}
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 6f3ef44fe94..24ec2393b69 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -139,9 +139,7 @@ static bool ui_imageuser_slot_menu_step(bContext *C, int direction, void *image_
WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL);
return true;
}
- else {
- return true;
- }
+ return true;
}
static const char *ui_imageuser_layer_fake_name(RenderResult *rr)
@@ -150,12 +148,10 @@ static const char *ui_imageuser_layer_fake_name(RenderResult *rr)
if (rv->rectf) {
return IFACE_("Composite");
}
- else if (rv->rect32) {
+ if (rv->rect32) {
return IFACE_("Sequence");
}
- else {
- return NULL;
- }
+ return NULL;
}
/* workaround for passing many args */
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index f71c92b4c1f..4702b01901d 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -198,11 +198,10 @@ static Image *image_from_context(const bContext *C)
if (ima) {
return ima;
}
- else {
- /* Image editor. */
- SpaceImage *sima = CTX_wm_space_image(C);
- return (sima) ? sima->image : NULL;
- }
+
+ /* Image editor. */
+ SpaceImage *sima = CTX_wm_space_image(C);
+ return (sima) ? sima->image : NULL;
}
static ImageUser *image_user_from_context(const bContext *C)
@@ -214,11 +213,10 @@ static ImageUser *image_user_from_context(const bContext *C)
if (iuser) {
return iuser;
}
- else {
- /* Image editor. */
- SpaceImage *sima = CTX_wm_space_image(C);
- return (sima) ? &sima->iuser : NULL;
- }
+
+ /* Image editor. */
+ SpaceImage *sima = CTX_wm_space_image(C);
+ return (sima) ? &sima->iuser : NULL;
}
static bool image_from_context_has_data_poll(bContext *C)
@@ -359,10 +357,9 @@ static int image_view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *eve
image_view_pan_exec(C, op);
return OPERATOR_FINISHED;
}
- else {
- image_view_pan_init(C, op, event);
- return OPERATOR_RUNNING_MODAL;
- }
+
+ image_view_pan_init(C, op, event);
+ return OPERATOR_RUNNING_MODAL;
}
static int image_view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
@@ -549,10 +546,9 @@ static int image_view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev
return OPERATOR_FINISHED;
}
- else {
- image_view_zoom_init(C, op, event);
- return OPERATOR_RUNNING_MODAL;
- }
+
+ image_view_zoom_init(C, op, event);
+ return OPERATOR_RUNNING_MODAL;
}
static void image_zoom_apply(ViewZoomData *vpd,
@@ -697,27 +693,26 @@ static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmE
if (event->type != NDOF_MOTION) {
return OPERATOR_CANCELLED;
}
- else {
- SpaceImage *sima = CTX_wm_space_image(C);
- ARegion *region = CTX_wm_region(C);
- float pan_vec[3];
- const wmNDOFMotionData *ndof = event->customdata;
- const float speed = NDOF_PIXELS_PER_SECOND;
+ SpaceImage *sima = CTX_wm_space_image(C);
+ ARegion *region = CTX_wm_region(C);
+ float pan_vec[3];
- WM_event_ndof_pan_get(ndof, pan_vec, true);
+ const wmNDOFMotionData *ndof = event->customdata;
+ const float speed = NDOF_PIXELS_PER_SECOND;
- mul_v2_fl(pan_vec, (speed * ndof->dt) / sima->zoom);
- pan_vec[2] *= -ndof->dt;
+ WM_event_ndof_pan_get(ndof, pan_vec, true);
- sima_zoom_set_factor(sima, region, 1.0f + pan_vec[2], NULL, false);
- sima->xof += pan_vec[0];
- sima->yof += pan_vec[1];
+ mul_v2_fl(pan_vec, (speed * ndof->dt) / sima->zoom);
+ pan_vec[2] *= -ndof->dt;
- ED_region_tag_redraw(region);
+ sima_zoom_set_factor(sima, region, 1.0f + pan_vec[2], NULL, false);
+ sima->xof += pan_vec[0];
+ sima->yof += pan_vec[1];
- return OPERATOR_FINISHED;
- }
+ ED_region_tag_redraw(region);
+
+ return OPERATOR_FINISHED;
}
void IMAGE_OT_view_ndof(wmOperatorType *ot)
@@ -1678,24 +1673,23 @@ static char imtype_best_depth(ImBuf *ibuf, const char imtype)
}
return R_IMF_CHAN_DEPTH_8;
}
- else {
- if (depth_ok & R_IMF_CHAN_DEPTH_8) {
- return R_IMF_CHAN_DEPTH_8;
- }
- if (depth_ok & R_IMF_CHAN_DEPTH_12) {
- return R_IMF_CHAN_DEPTH_12;
- }
- if (depth_ok & R_IMF_CHAN_DEPTH_16) {
- return R_IMF_CHAN_DEPTH_16;
- }
- if (depth_ok & R_IMF_CHAN_DEPTH_24) {
- return R_IMF_CHAN_DEPTH_24;
- }
- if (depth_ok & R_IMF_CHAN_DEPTH_32) {
- return R_IMF_CHAN_DEPTH_32;
- }
- return R_IMF_CHAN_DEPTH_8; /* fallback, should not get here */
+
+ if (depth_ok & R_IMF_CHAN_DEPTH_8) {
+ return R_IMF_CHAN_DEPTH_8;
}
+ if (depth_ok & R_IMF_CHAN_DEPTH_12) {
+ return R_IMF_CHAN_DEPTH_12;
+ }
+ if (depth_ok & R_IMF_CHAN_DEPTH_16) {
+ return R_IMF_CHAN_DEPTH_16;
+ }
+ if (depth_ok & R_IMF_CHAN_DEPTH_24) {
+ return R_IMF_CHAN_DEPTH_24;
+ }
+ if (depth_ok & R_IMF_CHAN_DEPTH_32) {
+ return R_IMF_CHAN_DEPTH_32;
+ }
+ return R_IMF_CHAN_DEPTH_8; /* fallback, should not get here */
}
static int image_save_options_init(Main *bmain,
@@ -2147,9 +2141,8 @@ static int image_save_exec(bContext *C, wmOperator *op)
if (ok) {
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+
+ return OPERATOR_CANCELLED;
}
static int image_save_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
@@ -2160,9 +2153,7 @@ static int image_save_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
WM_operator_name_call(C, "IMAGE_OT_save_as", WM_OP_INVOKE_DEFAULT, NULL);
return OPERATOR_CANCELLED;
}
- else {
- return image_save_exec(C, op);
- }
+ return image_save_exec(C, op);
}
void IMAGE_OT_save(wmOperatorType *ot)
@@ -2294,9 +2285,7 @@ static bool image_should_be_saved(Image *ima, bool *is_format_writable)
ELEM(ima->source, IMA_SRC_FILE, IMA_SRC_GENERATED, IMA_SRC_TILED)) {
return image_should_be_saved_when_modified(ima);
}
- else {
- return false;
- }
+ return false;
}
static bool image_has_valid_path(Image *ima)
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index 3685e5de852..6c818257ec7 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -108,9 +108,8 @@ static enum eTextViewContext_LineFlag report_line_data(TextViewContext *tvc,
UI_GetThemeColor4ubv(icon_bg_id, r_icon_bg);
return TVC_LINE_FG | TVC_LINE_BG | TVC_LINE_ICON | TVC_LINE_ICON_FG | TVC_LINE_ICON_BG;
}
- else {
- return TVC_LINE_FG | TVC_LINE_BG;
- }
+
+ return TVC_LINE_FG | TVC_LINE_BG;
}
/* reports! */
@@ -159,9 +158,8 @@ static int report_textview_begin(TextViewContext *tvc)
return true;
}
- else {
- return false;
- }
+
+ return false;
}
static void report_textview_end(TextViewContext *UNUSED(tvc))
@@ -185,17 +183,14 @@ static int report_textview_step(TextViewContext *tvc)
return true;
}
- else {
- return false;
- }
+ return false;
}
- else {
- /* step to the next newline */
- tvc->iter_char_end = tvc->iter_char_begin - 1;
- report_textview_init__internal(tvc);
- return true;
- }
+ /* step to the next newline */
+ tvc->iter_char_end = tvc->iter_char_begin - 1;
+ report_textview_init__internal(tvc);
+
+ return true;
}
static void report_textview_line_get(TextViewContext *tvc, const char **r_line, int *r_len)
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
index 8076d3d7eaf..eee8b989cc2 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -186,7 +186,7 @@ static bool textview_draw_string(TextViewDrawState *tds,
MEM_freeN(offsets);
return true;
}
- else if (y_next < tds->scroll_ymin) {
+ if (y_next < tds->scroll_ymin) {
/* Have not reached the drawable area so don't break. */
tds->xy[1] = y_next;
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index d399ea47d7e..86bb189c638 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -461,10 +461,9 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op)
"block)");
return OPERATOR_CANCELLED;
}
- else {
- id = adt_ptr.owner_id;
- adt = adt_ptr.data;
- }
+
+ id = adt_ptr.owner_id;
+ adt = adt_ptr.data;
}
else {
/* indexed channel */
@@ -483,7 +482,7 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op)
ANIM_animdata_freelist(&anim_data);
return OPERATOR_CANCELLED;
}
- else if (ale->type != ANIMTYPE_NLAACTION) {
+ if (ale->type != ANIMTYPE_NLAACTION) {
BKE_reportf(op->reports,
RPT_ERROR,
"Animation channel at index %d is not a NLA 'Active Action' channel",
@@ -505,22 +504,21 @@ static int nlachannels_pushdown_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "Internal Error - AnimData block is not valid");
return OPERATOR_CANCELLED;
}
- else if (nlaedit_is_tweakmode_on(&ac)) {
+ if (nlaedit_is_tweakmode_on(&ac)) {
BKE_report(op->reports,
RPT_WARNING,
"Cannot push down actions while tweaking a strip's action, exit tweak mode first");
return OPERATOR_CANCELLED;
}
- else if (adt->action == NULL) {
+ if (adt->action == NULL) {
BKE_report(op->reports, RPT_WARNING, "No active action to push down");
return OPERATOR_CANCELLED;
}
- else {
- /* 'push-down' action - only usable when not in TweakMode */
- BKE_nla_action_pushdown(adt);
- DEG_id_tag_update_ex(CTX_data_main(C), id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
- }
+ /* 'push-down' action - only usable when not in TweakMode */
+ BKE_nla_action_pushdown(adt);
+
+ DEG_id_tag_update_ex(CTX_data_main(C), id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
@@ -735,14 +733,13 @@ static int nlaedit_add_tracks_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
- else {
- /* failed to add any tracks */
- BKE_report(
- op->reports, RPT_WARNING, "Select an existing NLA Track or an empty action line first");
- /* not done */
- return OPERATOR_CANCELLED;
- }
+ /* failed to add any tracks */
+ BKE_report(
+ op->reports, RPT_WARNING, "Select an existing NLA Track or an empty action line first");
+
+ /* not done */
+ return OPERATOR_CANCELLED;
}
void NLA_OT_tracks_add(wmOperatorType *ot)
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index dec7a0fd93c..bc9bd0e18f2 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -269,9 +269,7 @@ static int nlaedit_disable_tweakmode_exec(bContext *C, wmOperator *op)
if (ok) {
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+ return OPERATOR_CANCELLED;
}
void NLA_OT_tweakmode_exit(wmOperatorType *ot)
@@ -373,9 +371,8 @@ static int nlaedit_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
if (ac.scene == NULL) {
return OPERATOR_CANCELLED;
}
- else {
- scene = ac.scene;
- }
+
+ scene = ac.scene;
/* set the range directly */
get_nlastrip_extents(&ac, &min, &max, true);
@@ -616,7 +613,7 @@ static int nlaedit_add_actionclip_exec(bContext *C, wmOperator *op)
// printf("Add strip - actname = '%s'\n", actname);
return OPERATOR_CANCELLED;
}
- else if (act->idroot == 0) {
+ if (act->idroot == 0) {
/* hopefully in this case (i.e. library of userless actions),
* the user knows what they're doing... */
BKE_reportf(op->reports,
@@ -830,12 +827,11 @@ static int nlaedit_add_transition_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
- else {
- BKE_report(op->reports,
- RPT_ERROR,
- "Needs at least a pair of adjacent selected strips with a gap between them");
- return OPERATOR_CANCELLED;
- }
+
+ BKE_report(op->reports,
+ RPT_ERROR,
+ "Needs at least a pair of adjacent selected strips with a gap between them");
+ return OPERATOR_CANCELLED;
}
void NLA_OT_transition_add(wmOperatorType *ot)
@@ -1146,9 +1142,8 @@ static int nlaedit_duplicate_exec(bContext *C, wmOperator *op)
/* done */
return OPERATOR_FINISHED;
}
- else {
- return OPERATOR_CANCELLED;
- }
+
+ return OPERATOR_CANCELLED;
}
static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
@@ -1293,9 +1288,8 @@ static void nlaedit_split_strip_actclip(
if (IS_EQF(len, 0.0f)) {
return;
}
- else {
- splitframe = strip->start + (len / 2.0f);
- }
+
+ splitframe = strip->start + (len / 2.0f);
/* action range */
len = strip->actend - strip->actstart;
@@ -2504,10 +2498,9 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No F-Modifiers available to be copied");
return OPERATOR_CANCELLED;
}
- else {
- /* no updates needed - copy is non-destructive operation */
- return OPERATOR_FINISHED;
- }
+
+ /* no updates needed - copy is non-destructive operation */
+ return OPERATOR_FINISHED;
}
void NLA_OT_fmodifier_copy(wmOperatorType *ot)
@@ -2591,10 +2584,9 @@ static int nla_fmodifier_paste_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
- else {
- BKE_report(op->reports, RPT_ERROR, "No F-Modifiers to paste");
- return OPERATOR_CANCELLED;
- }
+
+ BKE_report(op->reports, RPT_ERROR, "No F-Modifiers to paste");
+ return OPERATOR_CANCELLED;
}
void NLA_OT_fmodifier_paste(wmOperatorType *ot)
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c
index 6633e1c427c..43341eadb97 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -360,7 +360,7 @@ bool ED_undo_is_legacy_compatible_for_property(struct bContext *C, ID *id)
CLOG_INFO(&LOG, 1, "skipping undo for paint-mode");
return false;
}
- else if (obact->mode & OB_MODE_EDIT) {
+ if (obact->mode & OB_MODE_EDIT) {
if ((id == NULL) || (obact->data == NULL) ||
(GS(id->name) != GS(((ID *)obact->data)->name))) {
/* No undo push on id type mismatch in edit-mode. */
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index af387e4f7c2..dad0b96c5e2 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -123,10 +123,10 @@ void ED_editors_init(bContext *C)
if (mode == OB_MODE_OBJECT) {
continue;
}
- else if (BKE_object_has_mode_data(ob, mode)) {
+ if (BKE_object_has_mode_data(ob, mode)) {
continue;
}
- else if (ob->type == OB_GPENCIL) {
+ if (ob->type == OB_GPENCIL) {
/* For multi-edit mode we may already have mode data (grease pencil does not need it).
* However we may have a non-active object stuck in a grease-pencil edit mode. */
if (ob != obact) {
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index be1319c37dd..3c747a29361 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -239,13 +239,12 @@ bool applyNumInput(NumInput *n, float *vec)
#endif
return true;
}
- else {
- /* Else, we set the 'org' values for numinput! */
- for (j = 0; j <= n->idx_max; j++) {
- n->val[j] = n->val_org[j] = vec[j];
- }
- return false;
+
+ /* Else, we set the 'org' values for numinput! */
+ for (j = 0; j <= n->idx_max; j++) {
+ n->val[j] = n->val_org[j] = vec[j];
}
+ return false;
}
static void value_to_editstr(NumInput *n, int idx)
@@ -291,12 +290,12 @@ bool user_string_to_number(
return BPY_execute_string_as_number(C, NULL, str_unit_convert, true, r_value);
}
- else {
- int success = BPY_execute_string_as_number(C, NULL, str, true, r_value);
- *r_value *= bUnit_PreferredInputUnitScalar(unit, type);
- *r_value /= unit_scale;
- return success;
- }
+
+ int success = BPY_execute_string_as_number(C, NULL, str, true, r_value);
+ *r_value *= bUnit_PreferredInputUnitScalar(unit, type);
+ *r_value /= unit_scale;
+ return success;
+
#else
UNUSED_VARS(C, unit, type);
*r_value = atof(str);
@@ -309,12 +308,10 @@ static bool editstr_is_simple_numinput(const char ascii)
if (ascii >= '0' && ascii <= '9') {
return true;
}
- else if (ascii == '.') {
+ if (ascii == '.') {
return true;
}
- else {
- return false;
- }
+ return false;
}
bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
@@ -348,7 +345,7 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
n->val_flag[idx] |= NUM_EDITED;
return true;
}
- else if (event->ctrl) {
+ if (event->ctrl) {
n->flag &= ~NUM_EDIT_FULL;
return true;
}