From ddddb7bab173b040342ef99270ee71ae076d45e8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 9 Mar 2013 03:46:30 +0000 Subject: code cleanup: favor braces when blocks have mixed brace use. --- source/blender/editors/animation/anim_markers.c | 4 +- source/blender/editors/armature/armature_add.c | 4 +- source/blender/editors/armature/armature_naming.c | 8 +- source/blender/editors/armature/armature_select.c | 14 +- source/blender/editors/curve/editcurve.c | 193 +++++++++++++-------- source/blender/editors/include/ED_view3d.h | 2 +- source/blender/editors/interface/interface.c | 12 +- source/blender/editors/interface/interface_draw.c | 22 ++- source/blender/editors/interface/interface_style.c | 2 +- .../editors/interface/interface_templates.c | 4 +- .../blender/editors/interface/interface_widgets.c | 4 +- source/blender/editors/interface/view2d.c | 8 +- source/blender/editors/mesh/editface.c | 4 +- source/blender/editors/mesh/editmesh_select.c | 6 +- source/blender/editors/mesh/editmesh_tools.c | 8 +- source/blender/editors/mesh/meshtools.c | 4 +- source/blender/editors/object/object_add.c | 4 +- source/blender/editors/object/object_bake.c | 4 +- source/blender/editors/object/object_constraint.c | 4 +- source/blender/editors/object/object_relations.c | 8 +- source/blender/editors/object/object_transform.c | 16 +- source/blender/editors/render/render_preview.c | 6 +- source/blender/editors/screen/area.c | 8 +- source/blender/editors/screen/glutil.c | 16 +- source/blender/editors/screen/screen_edit.c | 8 +- source/blender/editors/sculpt_paint/paint_image.c | 4 +- source/blender/editors/sculpt_paint/sculpt.c | 8 +- source/blender/editors/sculpt_paint/sculpt_undo.c | 8 +- source/blender/editors/space_graph/graph_edit.c | 3 +- source/blender/editors/space_nla/nla_edit.c | 3 +- .../blender/editors/space_outliner/outliner_draw.c | 18 +- .../blender/editors/space_outliner/outliner_edit.c | 10 +- .../editors/space_outliner/outliner_select.c | 14 +- .../editors/space_outliner/outliner_tools.c | 14 +- .../blender/editors/space_outliner/outliner_tree.c | 12 +- .../editors/space_sequencer/sequencer_draw.c | 4 +- .../editors/space_sequencer/sequencer_edit.c | 2 +- .../editors/space_sequencer/sequencer_select.c | 2 - source/blender/editors/space_text/text_draw.c | 8 +- source/blender/editors/space_text/text_ops.c | 28 ++- source/blender/editors/space_view3d/drawmesh.c | 8 +- source/blender/editors/space_view3d/drawobject.c | 14 +- source/blender/editors/space_view3d/view3d_draw.c | 4 +- source/blender/editors/space_view3d/view3d_view.c | 10 +- source/blender/editors/transform/transform.c | 8 +- .../editors/transform/transform_conversions.c | 12 +- .../editors/transform/transform_manipulator.c | 14 +- source/blender/editors/util/editmode_undo.c | 8 +- 48 files changed, 405 insertions(+), 184 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 85a80a7cc78..5cb458d36e5 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -276,7 +276,9 @@ static void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only ce->sel = marker->flag; return; } - else if (ce->cfra > marker->frame) break; + else if (ce->cfra > marker->frame) { + break; + } } cen = MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem"); diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index 531c0551c87..86ec0777ddc 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -320,8 +320,8 @@ void updateDuplicateSubtargetObjects(EditBone *dupBone, ListBase *editbones, Obj bConstraint *curcon; ListBase *conlist; - if ( (pchan = BKE_pose_channel_verify(dst_ob->pose, dupBone->name)) ) { - if ( (conlist = &pchan->constraints) ) { + if ((pchan = BKE_pose_channel_verify(dst_ob->pose, dupBone->name))) { + if ((conlist = &pchan->constraints)) { for (curcon = conlist->first; curcon; curcon = curcon->next) { /* does this constraint have a subtarget in * this armature? diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c index 4f9296a9dec..561e196bf41 100644 --- a/source/blender/editors/armature/armature_naming.c +++ b/source/blender/editors/armature/armature_naming.c @@ -152,7 +152,9 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n unique_editbone_name(arm->edbo, newname, NULL); BLI_strncpy(eBone->name, newname, MAXBONENAME); } - else return; + else { + return; + } } else { Bone *bone = BKE_armature_find_bone_name(arm, oldname); @@ -161,7 +163,9 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n unique_bone_name(arm, newname); BLI_strncpy(bone->name, newname, MAXBONENAME); } - else return; + else { + return; + } } /* do entire dbase - objects */ diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index b7a436cc209..07706d3d0d1 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -323,7 +323,9 @@ static EditBone *get_nearest_editbonepoint(ViewContext *vc, const int mval[2], else dep = 2; } - else dep = 2; + else { + dep = 2; + } } else { /* bone found */ @@ -333,7 +335,9 @@ static EditBone *get_nearest_editbonepoint(ViewContext *vc, const int mval[2], else dep = 3; } - else dep = 3; + else { + dep = 3; + } } if (ebone == ebone_next_act) { @@ -390,8 +394,10 @@ void ED_armature_deselect_all(Object *obedit, int toggle) // } } } - else sel = toggle; - + else { + sel = toggle; + } + /* Set the flags */ for (eBone = arm->edbo->first; eBone; eBone = eBone->next) { if (sel == 2) { diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index c91734fecec..92468550d1e 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -626,7 +626,9 @@ static void switch_keys_direction(Curve *cu, Nurb *actnu) bezt++; } } - else fp += a * 12; + else { + fp += a * 12; + } } else { BPoint *bp = nu->bp; @@ -640,7 +642,9 @@ static void switch_keys_direction(Curve *cu, Nurb *actnu) bp++; } } - else fp += a * 4; + else { + fp += a * 4; + } } nu = nu->next; @@ -1473,7 +1477,9 @@ static short isNurbselUV(Nurb *nu, int *u, int *v, int flag) if (*u == -1) *u = b; else return 0; } - else if (sel > 1) return 0; /* because sel == 1 is still ok */ + else if (sel > 1) { + return 0; /* because sel == 1 is still ok */ + } } for (a = 0; a < nu->pntsu; a++) { @@ -1486,7 +1492,9 @@ static short isNurbselUV(Nurb *nu, int *u, int *v, int flag) if (*v == -1) *v = a; else return 0; } - else if (sel > 1) return 0; + else if (sel > 1) { + return 0; + } } if (*u == -1 && *v > -1) return 1; @@ -1781,7 +1789,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag) else { /* which row or column is selected */ - if (isNurbselUV(nu, &u, &v, flag) ) { + if (isNurbselUV(nu, &u, &v, flag)) { /* deselect all */ bp = nu->bp; @@ -1872,7 +1880,7 @@ static void adduplicateflagNurb(Object *obedit, short flag) for (a = 0; a < nu->pntsu; a++) { enda = -1; starta = a; - while ( (bezt->f1 & flag) || (bezt->f2 & flag) || (bezt->f3 & flag) ) { + while ((bezt->f1 & flag) || (bezt->f2 & flag) || (bezt->f3 & flag)) { select_beztriple(bezt, DESELECT, flag, HIDDEN); enda = a; if (a >= nu->pntsu - 1) break; @@ -2431,12 +2439,12 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short BezTriple *bezt; BPoint *bp; int a; - short lastsel = 0; + short lastsel = false; if (next == 0) return; for (nu = editnurb->first; nu; nu = nu->next) { - lastsel = 0; + lastsel = false; if (nu->type == CU_BEZIER) { a = nu->pntsu; bezt = nu->bezt; @@ -2447,12 +2455,12 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short bezt += next; if (!(bezt->f2 & SELECT) || (selstatus == 0)) { short sel = select_beztriple(bezt, selstatus, 1, VISIBLE); - if ((sel == 1) && (cont == 0)) lastsel = 1; + if ((sel == 1) && (cont == 0)) lastsel = true; } } else { bezt += next; - lastsel = 0; + lastsel = false; } /* move around in zigzag way so that we go through each */ bezt -= (next - next / abs(next)); @@ -2468,12 +2476,12 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short bp += next; if (!(bp->f1 & SELECT) || (selstatus == 0)) { short sel = select_bpoint(bp, selstatus, 1, VISIBLE); - if ((sel == 1) && (cont == 0)) lastsel = 1; + if ((sel == 1) && (cont == 0)) lastsel = true; } } else { bp += next; - lastsel = 0; + lastsel = false; } /* move around in zigzag way so that we go through each */ bp -= (next - next / abs(next)); @@ -2878,7 +2886,7 @@ static void subdividenurb(Object *obedit, int number_cuts) keyIndex_updateBezt(editnurb, prevbezt, beztn, 1); beztn++; - if (BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { + if (BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt)) { float prevvec[3][3]; memcpy(prevvec, prevbezt->vec, sizeof(float) * 9); @@ -3062,7 +3070,7 @@ static void subdividenurb(Object *obedit, int number_cuts) bp++; } } - if (sel == (nu->pntsu * nu->pntsv) ) { /* subdivide entire nurb */ + if (sel == (nu->pntsu * nu->pntsv)) { /* subdivide entire nurb */ /* Global subdivision is a special case of partial * subdivision. Strange it is considered separately... */ @@ -3332,7 +3340,7 @@ static void findselectedNurbvert(ListBase *editnurb, Nurb **nu, BezTriple **bezt bezt1 = nu1->bezt; a = nu1->pntsu; while (a--) { - if ( (bezt1->f1 & SELECT) || (bezt1->f2 & SELECT) || (bezt1->f3 & SELECT) ) { + if ((bezt1->f1 & SELECT) || (bezt1->f2 & SELECT) || (bezt1->f3 & SELECT)) { if (*nu != NULL && *nu != nu1) { *nu = NULL; *bp = NULL; @@ -3803,7 +3811,7 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu /* first nurbs: u = resolu-1 selected */ - if (is_u_selected(nu1, nu1->pntsu - 1) ) { + if (is_u_selected(nu1, nu1->pntsu - 1)) { /* pass */ } else { @@ -3835,7 +3843,7 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu } /* 2nd nurbs: u = 0 selected */ - if (is_u_selected(nu2, 0) ) { + if (is_u_selected(nu2, 0)) { /* pass */ } else { @@ -4041,9 +4049,11 @@ static int make_segment_exec(bContext *C, wmOperator *op) if ((nu->flagu & CU_NURB_CYCLIC) == 0) { /* not cyclic */ if (nu->type == CU_BEZIER) { if (nu1 == NULL) { - if (BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) nu1 = nu; + if (BEZSELECTED_HIDDENHANDLES(cu, nu->bezt)) { + nu1 = nu; + } else { - if (BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu - 1])) ) { + if (BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu - 1]))) { nu1 = nu; BKE_nurb_direction_switch(nu); keyData_switchDirectionNurb(cu, nu); @@ -4051,23 +4061,27 @@ static int make_segment_exec(bContext *C, wmOperator *op) } } else if (nu2 == NULL) { - if (BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) { + if (BEZSELECTED_HIDDENHANDLES(cu, nu->bezt)) { nu2 = nu; BKE_nurb_direction_switch(nu); keyData_switchDirectionNurb(cu, nu); } else { - if (BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu - 1])) ) { + if (BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu - 1]))) { nu2 = nu; } } } - else break; + else { + break; + } } else if (nu->pntsv == 1) { bp = nu->bp; if (nu1 == NULL) { - if (bp->f1 & SELECT) nu1 = nu; + if (bp->f1 & SELECT) { + nu1 = nu; + } else { bp = bp + (nu->pntsu - 1); if (bp->f1 & SELECT) { @@ -4090,7 +4104,9 @@ static int make_segment_exec(bContext *C, wmOperator *op) } } } - else break; + else { + break; + } } } } @@ -4495,7 +4511,9 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) newnu->resolu = cu->resolu; newnu->flag |= CU_SMOOTH; } - else memcpy(newnu, nu, sizeof(Nurb)); + else { + memcpy(newnu, nu, sizeof(Nurb)); + } BLI_addtail(&editnurb->nurbs, newnu); set_actNurb(obedit, newnu); @@ -4609,7 +4627,9 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) bezt = newbezt; ok = 1; } - else bezt = NULL; + else { + bezt = NULL; + } if (bezt) { if (!newnu) nu->pntsu++; @@ -4687,7 +4707,9 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) bp = newbp; ok = 1; } - else bp = NULL; + else { + bp = NULL; + } if (bp) { if (mode == 'e') { @@ -4705,7 +4727,9 @@ static int addvert_Nurb(bContext *C, short mode, float location[3]) nu->pntsu++; BKE_nurb_knot_calc_u(nu); } - else BKE_nurb_knot_calc_u(newnu); + else { + BKE_nurb_knot_calc_u(newnu); + } } } @@ -4864,7 +4888,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) a = nu->pntsu; bezt = nu->bezt; while (a--) { - if (BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { + if (BEZSELECTED_HIDDENHANDLES(cu, bezt)) { nu->flagu ^= CU_NURB_CYCLIC; break; } @@ -4983,7 +5007,7 @@ static int select_linked_exec(bContext *C, wmOperator *UNUSED(op)) bezt = nu->bezt; a = nu->pntsu; while (a--) { - if ( (bezt->f1 & SELECT) || (bezt->f2 & SELECT) || (bezt->f3 & SELECT) ) { + if ((bezt->f1 & SELECT) || (bezt->f2 & SELECT) || (bezt->f3 & SELECT)) { a = nu->pntsu; bezt = nu->bezt; while (a--) { @@ -5333,7 +5357,7 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) BPoint *bp; BezTriple *bezt; int a; - short sel = 0, lastsel = 0; + short sel = 0, lastsel = false; short *selbpoints; if (obedit->type == OB_SURF) { @@ -5344,44 +5368,54 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) while (a--) { if ((bp->hide == 0) && (bp->f1 & SELECT)) { sel = 0; - + /* check if neighbors have been selected */ /* edges of surface are an exception */ - if ((a + 1) % nu->pntsu == 0) sel++; + if ((a + 1) % nu->pntsu == 0) { + sel++; + } else { bp--; if ((selbpoints[a + 1] == 1) || ((bp->hide == 0) && (bp->f1 & SELECT))) sel++; bp++; } - if ((a + 1) % nu->pntsu == 1) sel++; + if ((a + 1) % nu->pntsu == 1) { + sel++; + } else { bp++; if ((bp->hide == 0) && (bp->f1 & SELECT)) sel++; bp--; } - if (a + 1 > nu->pntsu * nu->pntsv - nu->pntsu) sel++; + if (a + 1 > nu->pntsu * nu->pntsv - nu->pntsu) { + sel++; + } else { bp -= nu->pntsu; if ((selbpoints[a + nu->pntsu] == 1) || ((bp->hide == 0) && (bp->f1 & SELECT))) sel++; bp += nu->pntsu; } - - if (a < nu->pntsu) sel++; + + if (a < nu->pntsu) { + sel++; + } else { bp += nu->pntsu; if ((bp->hide == 0) && (bp->f1 & SELECT)) sel++; bp -= nu->pntsu; } - + if (sel != 4) { select_bpoint(bp, DESELECT, 1, VISIBLE); selbpoints[a] = 1; } } - else lastsel = 0; - + else { + lastsel = false; + } + bp++; } @@ -5390,26 +5424,29 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) } else { for (nu = editnurb->first; nu; nu = nu->next) { - lastsel = 0; + lastsel = false; /* check what type of curve/nurb it is */ if (nu->type == CU_BEZIER) { a = nu->pntsu; bezt = nu->bezt; while (a--) { if ((bezt->hide == 0) && (bezt->f2 & SELECT)) { - if (lastsel == 1) sel = 1; - else sel = 0; - + sel = (lastsel == 1); + /* check if neighbors have been selected */ /* first and last are exceptions */ - if (a == nu->pntsu - 1) sel++; + if (a == nu->pntsu - 1) { + sel++; + } else { bezt--; if ((bezt->hide == 0) && (bezt->f2 & SELECT)) sel++; bezt++; } - if (a == 0) sel++; + if (a == 0) { + sel++; + } else { bezt++; if ((bezt->hide == 0) && (bezt->f2 & SELECT)) sel++; @@ -5418,12 +5455,16 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) if (sel != 2) { select_beztriple(bezt, DESELECT, 1, VISIBLE); - lastsel = 1; + lastsel = true; + } + else { + lastsel = false; } - else lastsel = 0; } - else lastsel = 0; - + else { + lastsel = false; + } + bezt++; } } @@ -5436,28 +5477,36 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) else sel = 0; /* first and last are exceptions */ - if (a == nu->pntsu * nu->pntsv - 1) sel++; + if (a == nu->pntsu * nu->pntsv - 1) { + sel++; + } else { bp--; if ((bp->hide == 0) && (bp->f1 & SELECT)) sel++; bp++; } - if (a == 0) sel++; + if (a == 0) { + sel++; + } else { bp++; if ((bp->hide == 0) && (bp->f1 & SELECT)) sel++; bp--; } - + if (sel != 2) { select_bpoint(bp, DESELECT, 1, VISIBLE); - lastsel = 1; + lastsel = true; + } + else { + lastsel = false; } - else lastsel = 0; } - else lastsel = 0; - + else { + lastsel = false; + } + bp++; } } @@ -5820,7 +5869,7 @@ static int delete_exec(bContext *C, wmOperator *op) int delta = 0; bezt = nu->bezt; for (a = 0; a < nu->pntsu; a++) { - if (BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { + if (BEZSELECTED_HIDDENHANDLES(cu, bezt)) { memmove(bezt, bezt + 1, (nu->pntsu - a - 1) * sizeof(BezTriple)); keyIndex_delBezt(editnurb, bezt + delta); keyIndex_updateBezt(editnurb, bezt + 1, bezt, nu->pntsu - a - 1); @@ -5829,7 +5878,9 @@ static int delete_exec(bContext *C, wmOperator *op) type = 1; delta++; } - else bezt++; + else { + bezt++; + } } if (type) { bezt1 = (BezTriple *)MEM_mallocN((nu->pntsu) * sizeof(BezTriple), "delNurb"); @@ -5889,16 +5940,16 @@ static int delete_exec(bContext *C, wmOperator *op) if (nu->type == CU_BEZIER) { bezt = nu->bezt; for (a = 0; a < nu->pntsu - 1; a++) { - if (BEZSELECTED_HIDDENHANDLES(cu, bezt) ) { + if (BEZSELECTED_HIDDENHANDLES(cu, bezt)) { bezt1 = bezt; bezt2 = bezt + 1; if ((bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT)) { /* pass */ } else { /* maybe do not make cyclic */ - if (a == 0 && (nu->flagu & CU_NURB_CYCLIC) ) { + if (a == 0 && (nu->flagu & CU_NURB_CYCLIC)) { bezt2 = bezt + (nu->pntsu - 1); - if ( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) { + if ((bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT)) { nu->flagu &= ~CU_NURB_CYCLIC; BKE_nurb_handles_calc(nu); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); @@ -5925,7 +5976,7 @@ static int delete_exec(bContext *C, wmOperator *op) /* pass */ } else { /* maybe do not make cyclic */ - if (a == 0 && (nu->flagu & CU_NURB_CYCLIC) ) { + if (a == 0 && (nu->flagu & CU_NURB_CYCLIC)) { bp2 = bp + (nu->pntsu - 1); if (bp2->f1 & SELECT) { nu->flagu &= ~CU_NURB_CYCLIC; @@ -6187,10 +6238,12 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op)) if (ob->totcol) { /* TODO, merge material lists */ CLAMP(newnu->mat_nr, 0, ob->totcol - 1); } - else newnu->mat_nr = 0; + else { + newnu->mat_nr = 0; + } BLI_addtail(&tempbase, newnu); - if ( (bezt = newnu->bezt) ) { + if ((bezt = newnu->bezt)) { a = newnu->pntsu; while (a--) { mul_m4_v3(cmat, bezt->vec[0]); @@ -6200,7 +6253,7 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op)) } BKE_nurb_handles_calc(newnu); } - if ( (bp = newnu->bp) ) { + if ((bp = newnu->bp)) { a = newnu->pntsu * nu->pntsv; while (a--) { mul_m4_v3(cmat, bp->vec); @@ -6653,14 +6706,18 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf) if (type & CU_PRIM_PATH) cu->flag |= CU_PATH | CU_3D; } - else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA); + else { + DAG_id_tag_update(&obedit->id, OB_RECALC_DATA); + } } else { /* adding surface */ if (obedit == NULL || obedit->type != OB_SURF) { obedit = ED_object_add_type(C, OB_SURF, loc, rot, TRUE, layer); newob = 1; } - else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA); + else { + DAG_id_tag_update(&obedit->id, OB_RECALC_DATA); + } } /* rename here, the undo stack checks name for valid undo pushes */ diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index dfb3b6bd88a..a5eaf8e53aa 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -285,7 +285,7 @@ void ED_view3d_offscreen_sky_color_get(struct Scene *scene, float sky_color[3]); struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]); void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, short do_clip); void ED_view3d_update_viewmat(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, float viewmat[4][4], float winmat[4][4]); -int ED_view3d_lock(struct RegionView3D *rv3d); +bool ED_view3d_lock(struct RegionView3D *rv3d); uint64_t ED_view3d_datamask(struct Scene *scene, struct View3D *v3d); uint64_t ED_view3d_screen_datamask(struct bScreen *screen); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index e1a541dc7de..9c1cdad4d0a 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -231,7 +231,9 @@ static void ui_text_bounds_block(uiBlock *block, float offset) nextcol = 1; col++; } - else nextcol = 0; + else { + nextcol = 0; + } bt->rect.xmin = x1addval; bt->rect.xmax = bt->rect.xmin + i + block->bounds; @@ -2555,7 +2557,9 @@ static void ui_block_do_align_but(uiBut *first, short nr) else flag = UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT; } - else flag = UI_BUT_ALIGN_TOP; + else { + flag = UI_BUT_ALIGN_TOP; + } } } else if (buts_are_horiz(but, next)) { @@ -2575,7 +2579,9 @@ static void ui_block_do_align_but(uiBut *first, short nr) if (bt == NULL || bt->alignnr != nr) flag = UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_RIGHT; } } - else flag |= UI_BUT_ALIGN_LEFT; + else { + flag |= UI_BUT_ALIGN_LEFT; + } } else { if (cols == 0) { diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 55253336f6c..be57357b6e5 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -97,7 +97,9 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r } glVertex2f(maxx, miny + rad); } - else glVertex2f(maxx, miny); + else { + glVertex2f(maxx, miny); + } /* corner right-top */ if (roundboxtype & UI_CNR_TOP_RIGHT) { @@ -107,7 +109,9 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r } glVertex2f(maxx - rad, maxy); } - else glVertex2f(maxx, maxy); + else { + glVertex2f(maxx, maxy); + } /* corner left-top */ if (roundboxtype & UI_CNR_TOP_LEFT) { @@ -117,7 +121,9 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r } glVertex2f(minx, maxy - rad); } - else glVertex2f(minx, maxy); + else { + glVertex2f(minx, maxy); + } /* corner left-bottom */ if (roundboxtype & UI_CNR_BOTTOM_LEFT) { @@ -127,7 +133,9 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r } glVertex2f(minx + rad, miny); } - else glVertex2f(minx, miny); + else { + glVertex2f(minx, miny); + } glEnd(); } @@ -1292,8 +1300,10 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect) glEndList(); } - else glCallList(displist); - + else { + glCallList(displist); + } + /* restore */ glDisable(GL_LIGHTING); glDisable(GL_CULL_FACE); diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 506e422d38c..3cd7499c78e 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -216,7 +216,7 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str) /* rotate counter-clockwise for now (assumes left-to-right language)*/ xofs += height; yofs = BLF_width(fs->uifont_id, str) + 5; - angle = M_PI / 2.0f; + angle = (float)M_PI / 2.0f; /* translate rect to vertical */ txtrect.xmin = rect->xmin - BLI_rcti_size_y(rect); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 5c0a2b8dd30..9cc45f5cf1b 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -281,7 +281,9 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) if (id->flag & LIB_FAKEUSER) id_us_plus(id); else id_us_min(id); } - else return; + else { + return; + } break; case UI_ID_LOCAL: if (id) { diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 4abd6224f08..78b6d2541fd 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1292,7 +1292,9 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB else if ((but->block->flag & UI_BLOCK_LOOP) && (but->type == BUT)) { ui_text_clip_left(fstyle, but, rect); } - else but->ofs = 0; + else { + but->ofs = 0; + } /* check for button text label */ if (but->type == ICONTEXTROW) { diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index ad6428c7e80..8a6de9a549b 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -457,8 +457,12 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, int resize, int mask_ if (ABS(winx - v2d->oldwinx) > ABS(winy - v2d->oldwiny)) do_y = FALSE; else do_x = FALSE; } - else if (winRatio > 1.0f) do_x = FALSE; - else do_x = TRUE; + else if (winRatio > 1.0f) { + do_x = FALSE; + } + else { + do_x = TRUE; + } } do_cur = do_x; /* do_win = do_y; */ /* UNUSED */ diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 7ddf2b54a88..8d2e428b02c 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -525,7 +525,9 @@ int paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], in else mpoly_sel->flag |= ME_FACE_SEL; } - else mpoly_sel->flag |= ME_FACE_SEL; + else { + mpoly_sel->flag |= ME_FACE_SEL; + } /* image window redraw */ diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 36b9463a61c..a1f836ad037 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -307,8 +307,10 @@ int EDBM_backbuf_circle_init(ViewContext *vc, short xs, short ys, short rads) return 0; } } - else if (vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) return 0; - + else if (vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) { + return 0; + } + xmin = xs - rads; xmax = xs + rads; ymin = ys - rads; ymax = ys + rads; buf = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 10bb9a6acf8..379b88dea0b 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -2292,8 +2292,12 @@ static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op) if (!BM_elem_flag_test(eve, BM_ELEM_SELECT) || BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) continue; - if (svert == NULL) svert = eve; - else if (evert == NULL) evert = eve; + if (svert == NULL) { + svert = eve; + } + else if (evert == NULL) { + evert = eve; + } else { /* more than two vertices are selected, * show warning message and cancel operator */ diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 378f6374336..3d4d204299f 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -789,7 +789,9 @@ static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, const float c return (*bt)->index[a]; } } - else return -1; + else { + return -1; + } } if ( (*bt)->next) return mesh_octree_find_index(&(*bt)->next, mvert, co); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index f5971166a24..bdd5db37b47 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -662,7 +662,9 @@ static int object_armature_add_exec(bContext *C, wmOperator *op) ED_object_enter_editmode(C, 0); newob = 1; } - else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA); + else { + DAG_id_tag_update(&obedit->id, OB_RECALC_DATA); + } if (obedit == NULL) { BKE_report(op->reports, RPT_ERROR, "Cannot create editmode armature"); diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index a680230fb32..1a23a599d7c 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -138,7 +138,9 @@ static int multiresbake_check(bContext *C, wmOperator *op) } } } - else ok = 0; + else { + ok = 0; + } if (!ok) { BKE_report(op->reports, RPT_ERROR, "Multires data baking requires multi-resolution object"); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 1bed7d7dd11..e8b6b29c73f 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -435,7 +435,9 @@ static void test_constraints(Object *owner, bPoseChannel *pchan) curcon->flag |= CONSTRAINT_DISABLE; } } - else curcon->flag |= CONSTRAINT_DISABLE; + else { + curcon->flag |= CONSTRAINT_DISABLE; + } } } else if (curcon->type == CONSTRAINT_TYPE_CAMERASOLVER) { diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index f9dde043607..deb6bf65d1d 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -215,7 +215,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) } } - if (v4 || !((v1 && v2 == 0 && v3 == 0) || (v1 && v2 && v3)) ) { + if (v4 || !((v1 && v2 == 0 && v3 == 0) || (v1 && v2 && v3))) { BKE_report(op->reports, RPT_ERROR, "Select either 1 or 3 vertices to parent to"); return OPERATOR_CANCELLED; } @@ -608,8 +608,10 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object cu->flag |= CU_PATH | CU_FOLLOW; BKE_displist_make_curveTypes(scene, par, 0); /* force creation of path data */ } - else cu->flag |= CU_FOLLOW; - + else { + cu->flag |= CU_FOLLOW; + } + /* if follow, add F-Curve for ctime (i.e. "eval_time") so that path-follow works */ if (partype == PAR_FOLLOW) { /* get or create F-Curve */ diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 3fa6c301fcb..80d494a6a07 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -795,8 +795,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) if (centermode == ORIGIN_TO_CURSOR) { /* done */ } else if (centermode == ORIGIN_TO_CENTER_OF_MASS) { BKE_mesh_center_centroid(me, cent); } - else if (around == V3D_CENTROID) { BKE_mesh_center_median(me, cent); } - else { BKE_mesh_center_bounds(me, cent); } + else if (around == V3D_CENTROID) { BKE_mesh_center_median(me, cent); } + else { BKE_mesh_center_bounds(me, cent); } negate_v3_v3(cent_neg, cent); BKE_mesh_translate(me, cent_neg, 1); @@ -808,9 +808,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) else if (ELEM(ob->type, OB_CURVE, OB_SURF)) { Curve *cu = ob->data; - if (centermode == ORIGIN_TO_CURSOR) { /* done */ } + if (centermode == ORIGIN_TO_CURSOR) { /* done */ } else if (around == V3D_CENTROID) { BKE_curve_center_median(cu, cent); } - else { BKE_curve_center_bounds(cu, cent); } + else { BKE_curve_center_bounds(cu, cent); } /* don't allow Z change if curve is 2D */ if ((ob->type == OB_CURVE) && !(cu->flag & CU_3D)) @@ -889,9 +889,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) else if (ob->type == OB_MBALL) { MetaBall *mb = ob->data; - if (centermode == ORIGIN_TO_CURSOR) { /* done */ } + if (centermode == ORIGIN_TO_CURSOR) { /* done */ } else if (around == V3D_CENTROID) { BKE_mball_center_median(mb, cent); } - else { BKE_mball_center_bounds(mb, cent); } + else { BKE_mball_center_bounds(mb, cent); } negate_v3_v3(cent_neg, cent); BKE_mball_translate(mb, cent_neg); @@ -910,9 +910,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) else if (ob->type == OB_LATTICE) { Lattice *lt = ob->data; - if (centermode == ORIGIN_TO_CURSOR) { /* done */ } + if (centermode == ORIGIN_TO_CURSOR) { /* done */ } else if (around == V3D_CENTROID) { BKE_lattice_center_median(lt, cent); } - else { BKE_lattice_center_bounds(lt, cent); } + else { BKE_lattice_center_bounds(lt, cent); } negate_v3_v3(cent_neg, cent); BKE_lattice_translate(lt, cent_neg, 1); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 754b0408854..5caa8744be7 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -671,8 +671,10 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs if (first) sizex = sp->sizex / 2; else sizex = sp->sizex - sp->sizex / 2; } - else sizex = sp->sizex; - + else { + sizex = sp->sizex; + } + /* we have to set preview variables first */ sce = preview_get_scene(pr_main); if (sce) { diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 1b7cd4a6d20..a0d83d7b9d8 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1071,7 +1071,9 @@ static void region_rect_recursive(wmWindow *win, ScrArea *sa, ARegion *ar, rcti if (G.debug & G_DEBUG) printf("region quadsplit failed\n"); } - else quad = 1; + else { + quad = 1; + } } if (quad) { if (quad == 1) { /* left bottom */ @@ -1746,7 +1748,9 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * /* uiScalePanels(ar, BLI_rctf_size_x(&v2d->cur)); break; */ } - else break; + else { + break; + } } diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 105c2dc88d1..0844d63d0b5 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -807,7 +807,9 @@ void bglBegin(int mode) pointhack = floor(value[0] + 0.5f); if (pointhack > 4) pointhack = 4; } - else glBegin(mode); + else { + glBegin(mode); + } } } @@ -835,7 +837,9 @@ void bglVertex3fv(const float vec[3]) glRasterPos3fv(vec); glBitmap(pointhack, pointhack, (float)pointhack / 2.0f, (float)pointhack / 2.0f, 0.0, 0.0, Squaredot); } - else glVertex3fv(vec); + else { + glVertex3fv(vec); + } break; } } @@ -848,7 +852,9 @@ void bglVertex3f(float x, float y, float z) glRasterPos3f(x, y, z); glBitmap(pointhack, pointhack, (float)pointhack / 2.0f, (float)pointhack / 2.0f, 0.0, 0.0, Squaredot); } - else glVertex3f(x, y, z); + else { + glVertex3f(x, y, z); + } break; } } @@ -861,7 +867,9 @@ void bglVertex2fv(const float vec[2]) glRasterPos2fv(vec); glBitmap(pointhack, pointhack, (float)pointhack / 2, pointhack / 2, 0.0, 0.0, Squaredot); } - else glVertex2fv(vec); + else { + glVertex2fv(vec); + } break; } } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 7c22dff1b01..9551b1c4926 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -194,7 +194,9 @@ void removenotused_scrverts(bScreen *sc) BLI_remlink(&sc->vertbase, sv); MEM_freeN(sv); } - else sv->flag = 0; + else { + sv->flag = 0; + } sv = svn; } } @@ -250,7 +252,9 @@ void removenotused_scredges(bScreen *sc) BLI_remlink(&sc->edgebase, se); MEM_freeN(se); } - else se->flag = 0; + else { + se->flag = 0; + } se = sen; } } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 3db25800a06..18a464ff302 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -4357,7 +4357,9 @@ static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, c if (brush_painter_2d_paint(painter, project_paint_op, pos, time, pressure, ps, 0)) { return 1; } - else return 0; + else { + return 0; + } } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 48c37c060ec..ea5b012bf46 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3512,7 +3512,9 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, } } } - else free_sculptsession_deformMats(ss); + else { + free_sculptsession_deformMats(ss); + } /* if pbvh is deformed, key block is already applied to it */ if (ss->kb && !BKE_pbvh_isDeformed(ss->pbvh)) { @@ -3780,7 +3782,9 @@ static void sculpt_update_cache_invariants(bContext *C, Sculpt *sd, SculptSessio ss->layer_co = MEM_mallocN(sizeof(float) * 3 * ss->totvert, "sculpt mesh vertices copy"); - if (ss->deform_cos) memcpy(ss->layer_co, ss->deform_cos, ss->totvert); + if (ss->deform_cos) { + memcpy(ss->layer_co, ss->deform_cos, ss->totvert); + } else { for (i = 0; i < ss->totvert; ++i) { copy_v3_v3(ss->layer_co[i], ss->mvert[i].co); diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 406756f4197..b49cbf7ff2b 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -131,7 +131,9 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo vertCos = BKE_key_convert_to_vertcos(ob, ss->kb); for (i = 0; i < unode->totvert; i++) { - if (ss->modifiers_active) sculpt_undo_restore_deformed(ss, unode, i, index[i], vertCos[index[i]]); + if (ss->modifiers_active) { + sculpt_undo_restore_deformed(ss, unode, i, index[i], vertCos[index[i]]); + } else { if (unode->orig_co) swap_v3_v3(vertCos[index[i]], unode->orig_co[i]); else swap_v3_v3(vertCos[index[i]], unode->co[i]); @@ -149,7 +151,9 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo } else { for (i = 0; i < unode->totvert; i++) { - if (ss->modifiers_active) sculpt_undo_restore_deformed(ss, unode, i, index[i], mvert[index[i]].co); + if (ss->modifiers_active) { + sculpt_undo_restore_deformed(ss, unode, i, index[i], mvert[index[i]].co); + } else { if (unode->orig_co) swap_v3_v3(mvert[index[i]].co, unode->orig_co[i]); else swap_v3_v3(mvert[index[i]].co, unode->co[i]); diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index b92430ce0e9..e4d1ec73d67 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -2196,8 +2196,9 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op) /* add F-Modifier of specified type to active F-Curve, and make it the active one */ fcm = add_fmodifier(&fcu->modifiers, type); - if (fcm) + if (fcm) { set_active_fmodifier(&fcu->modifiers, fcm); + } else { BKE_report(op->reports, RPT_ERROR, "Modifier could not be added (see console for details)"); break; diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 484eb47fa8e..c95f46d0e7c 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -2021,8 +2021,9 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op) /* add F-Modifier of specified type to selected, and make it the active one */ fcm = add_fmodifier(&strip->modifiers, type); - if (fcm) + if (fcm) { set_active_fmodifier(&strip->modifiers, fcm); + } else { BKE_reportf(op->reports, RPT_ERROR, "Modifier could not be added to (%s : %s) (see console for details)", diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 3d5125fc075..2c88ef158b0 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1236,12 +1236,20 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa /* active blocks get white circle */ if (tselem->type == 0) { - if (te->idcode == ID_OB) active = (OBACT == (Object *)tselem->id); - else if (scene->obedit && scene->obedit->data == tselem->id) active = 1; // XXX use context? - else active = tree_element_active(C, scene, soops, te, 0); + if (te->idcode == ID_OB) { + active = (OBACT == (Object *)tselem->id); + } + else if (scene->obedit && scene->obedit->data == tselem->id) { + active = 1; // XXX use context? + } + else { + active = tree_element_active(C, scene, soops, te, 0); + } } - else active = tree_element_type_active(NULL, scene, soops, te, tselem, 0); - + else { + active = tree_element_type_active(NULL, scene, soops, te, tselem, 0); + } + if (active) { float ufac = UI_UNIT_X / 20.0f; diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 9a1b3628196..e3290e7dd82 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -890,9 +890,13 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase else tselem->flag |= TSE_CLOSED; } } - else tselem->flag |= TSE_CLOSED; - - if (TSELEM_OPEN(tselem, soops)) tree_element_show_hierarchy(scene, soops, &te->subtree); + else { + tselem->flag |= TSE_CLOSED; + } + + if (TSELEM_OPEN(tselem, soops)) { + tree_element_show_hierarchy(scene, soops, &te->subtree); + } } } diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index fa337ba7af1..b3d8dc9f366 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -148,7 +148,9 @@ static int tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops Object *ob = NULL; /* if id is not object, we search back */ - if (te->idcode == ID_OB) ob = (Object *)tselem->id; + if (te->idcode == ID_OB) { + ob = (Object *)tselem->id; + } else { ob = (Object *)outliner_search_back(soops, te, ID_OB); if (ob == OBACT) return 0; @@ -312,7 +314,9 @@ static int tree_element_active_lamp(bContext *UNUSED(C), Scene *scene, SpaceOops if (set) { // XXX extern_set_butspace(F5KEY, 0); } - else return 1; + else { + return 1; + } return 0; } @@ -791,9 +795,11 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa else { // rest of types tree_element_active(C, scene, soops, te, 1); } - + + } + else { + tree_element_type_active(C, scene, soops, te, tselem, 1 + (extend != 0)); } - else tree_element_type_active(C, scene, soops, te, tselem, 1 + (extend != 0)); return 1; } diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 0a3aea3b1f9..07e22363ad5 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -190,8 +190,10 @@ static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEle World *wrld = (World *)tsep->id; mtex = wrld->mtex; } - else return; - + else { + return; + } + for (a = 0; a < MAX_MTEX; a++) { if (a == te->index && mtex[a]) { if (mtex[a]->tex) { @@ -1259,7 +1261,9 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S WM_operator_name_call(C, "OUTLINER_OT_object_operation", WM_OP_INVOKE_REGION_WIN, NULL); } else if (idlevel) { - if (idlevel == -1 || datalevel) BKE_report(reports, RPT_WARNING, "Mixed selection"); + if (idlevel == -1 || datalevel) { + BKE_report(reports, RPT_WARNING, "Mixed selection"); + } else { if (idlevel == ID_GR) WM_operator_name_call(C, "OUTLINER_OT_group_operation", WM_OP_INVOKE_REGION_WIN, NULL); @@ -1268,7 +1272,9 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S } } else if (datalevel) { - if (datalevel == -1) BKE_report(reports, RPT_WARNING, "Mixed selection"); + if (datalevel == -1) { + BKE_report(reports, RPT_WARNING, "Mixed selection"); + } else { if (datalevel == TSE_ANIM_DATA) WM_operator_name_call(C, "OUTLINER_OT_animdata_operation", WM_OP_INVOKE_REGION_WIN, NULL); diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index f723fbedc7b..62c947594b3 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -1257,19 +1257,23 @@ static int treesort_obtype_alpha(const void *v1, const void *v2) const tTreeSort *x1 = v1, *x2 = v2; /* first put objects last (hierarchy) */ - if (x1->idcode == ID_OB && x2->idcode != ID_OB) return 1; - else if (x2->idcode == ID_OB && x1->idcode != ID_OB) return -1; + if (x1->idcode == ID_OB && x2->idcode != ID_OB) { + return 1; + } + else if (x2->idcode == ID_OB && x1->idcode != ID_OB) { + return -1; + } else { /* 2nd we check ob type */ if (x1->idcode == ID_OB && x2->idcode == ID_OB) { - if (((Object *)x1->id)->type > ((Object *)x2->id)->type) return 1; + if (((Object *)x1->id)->type > ((Object *)x2->id)->type) return 1; else if (((Object *)x1->id)->type > ((Object *)x2->id)->type) return -1; else return 0; } else { int comp = strcmp(x1->name, x2->name); - if (comp > 0) return 1; + if (comp > 0) return 1; else if (comp < 0) return -1; return 0; } diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 396878cbfeb..7ebe04f666b 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -813,7 +813,9 @@ static void UNUSED_FUNCTION(set_special_seq_update) (int val) if (val) { // XXX special_seq_update = find_nearest_seq(&x); } - else special_seq_update = NULL; + else { + special_seq_update = NULL; + } } ImBuf *sequencer_ibuf_get(struct Main *bmain, Scene *scene, SpaceSeq *sseq, int cfra, int frame_ofs) diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 5f9f7668d14..e6d053ceb37 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -520,7 +520,7 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen return 0; } if ((seq != activeseq) && (seq != seq2)) { - if (seq2 == NULL) seq2 = seq; + if (seq2 == NULL) seq2 = seq; else if (seq1 == NULL) seq1 = seq; else if (seq3 == NULL) seq3 = seq; else { diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 0cce8a81c84..60032b0d333 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -552,8 +552,6 @@ void SEQUENCER_OT_select(wmOperatorType *ot) } - - /* run recursively to select linked */ static int select_more_less_seq__internal(Scene *scene, int sel, int linked) { diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index c264368e714..a146fec3dac 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -678,7 +678,9 @@ int text_get_visible_lines(SpaceText *st, ARegion *ar, const char *str) chars = st->tabnumber - i % st->tabnumber; ch = ' '; } - else chars = 1; + else { + chars = 1; + } while (chars--) { if (i - start >= max) { @@ -712,7 +714,9 @@ int text_get_span_wrap(SpaceText *st, ARegion *ar, TextLine *from, TextLine *to) return ret; } - else return txt_get_span(from, to); + else { + return txt_get_span(from, to); + } } int text_get_total_lines(SpaceText *st, ARegion *ar) diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index b45961bff11..e6f95c39baf 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -1413,7 +1413,9 @@ static int text_get_cursor_rel(SpaceText *st, ARegion *ar, TextLine *linein, int chars = st->tabnumber - i % st->tabnumber; ch = ' '; } - else chars = 1; + else { + chars = 1; + } while (chars--) { if (rell == 0 && i - start == relc) { @@ -1591,7 +1593,9 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, short sel) chars = st->tabnumber - i % st->tabnumber; ch = ' '; } - else chars = 1; + else { + chars = 1; + } while (chars--) { if (i - start >= max) { @@ -1657,7 +1661,9 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, short sel) chars = st->tabnumber - i % st->tabnumber; ch = ' '; } - else chars = 1; + else { + chars = 1; + } while (chars--) { if (i - start >= max) { @@ -1716,7 +1722,9 @@ static void txt_wrap_move_up(SpaceText *st, ARegion *ar, short sel) visible_lines = text_get_visible_lines(st, ar, (*linep)->line); *charp = text_get_cursor_rel(st, ar, *linep, visible_lines - 1, col); } - else *charp = 0; + else { + *charp = 0; + } } if (!sel) txt_pop_sel(text); @@ -1745,7 +1753,9 @@ static void txt_wrap_move_down(SpaceText *st, ARegion *ar, short sel) *linep = (*linep)->next; *charp = text_get_cursor_rel(st, ar, *linep, 0, col); } - else *charp = (*linep)->len; + else { + *charp = (*linep)->len; + } } if (!sel) txt_pop_sel(text); @@ -2350,7 +2360,9 @@ static int flatten_len(SpaceText *st, const char *str) if (str[i] == '\t') { total += st->tabnumber - total % st->tabnumber; } - else total++; + else { + total++; + } } return total; @@ -2412,7 +2424,9 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in chars = st->tabnumber - i % st->tabnumber; ch = ' '; } - else chars = 1; + else { + chars = 1; + } while (chars--) { /* Gone too far, go back to last wrap point */ diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 2cef10e1981..9000ccbf324 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -428,7 +428,9 @@ static DMDrawOption draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */ } else if (!has_mcol) { - if (tface) glColor3f(1.0, 1.0, 1.0); + if (tface) { + glColor3f(1.0, 1.0, 1.0); + } else { if (ma) { float col[3]; @@ -437,7 +439,9 @@ static DMDrawOption draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int glColor3fv(col); } - else glColor3f(1.0, 1.0, 1.0); + else { + glColor3f(1.0, 1.0, 1.0); + } } return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */ } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 5d669974711..3bbfa3d4926 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3879,7 +3879,9 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix if (draw_as == PART_DRAW_AXIS) { copy_v3_v3(vec2, state->co); } - else sub_v3_v3v3(vec2, state->co, vec); + else { + sub_v3_v3v3(vec2, state->co, vec); + } add_v3_v3(vec, state->co); copy_v3_v3(pdd->vd, vec); pdd->vd += 3; @@ -3891,7 +3893,9 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix if (draw_as == PART_DRAW_AXIS) { copy_v3_v3(vec2, state->co); } - else sub_v3_v3v3(vec2, state->co, vec); + else { + sub_v3_v3v3(vec2, state->co, vec); + } add_v3_v3(vec, state->co); @@ -5966,8 +5970,10 @@ static void drawtexspace(Object *ob) copy_v3_v3(size, mb->size); copy_v3_v3(loc, mb->loc); } - else return; - + else { + return; + } + vec[0][0] = vec[1][0] = vec[2][0] = vec[3][0] = loc[0] - size[0]; vec[4][0] = vec[5][0] = vec[6][0] = vec[7][0] = loc[0] + size[0]; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index de6b6607619..2aae3e39e7f 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1600,7 +1600,9 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, if (scene->camera) clip = BKE_object_movieclip_get(scene, scene->camera, 1); } - else clip = bgpic->clip; + else { + clip = bgpic->clip; + } if (clip == NULL) continue; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index fba1ce328ba..5d2a351b233 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -791,7 +791,7 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short #define QUATSET(a, b, c, d, e) { a[0] = b; a[1] = c; a[2] = d; a[3] = e; } (void)0 -int ED_view3d_lock(RegionView3D *rv3d) +bool ED_view3d_lock(RegionView3D *rv3d) { switch (rv3d->view) { case RV3D_VIEW_BOTTOM: @@ -818,10 +818,10 @@ int ED_view3d_lock(RegionView3D *rv3d) QUATSET(rv3d->viewquat, 0.5, -0.5, -0.5, -0.5); break; default: - return FALSE; + return false; } - return TRUE; + return true; } /* don't set windows active in here, is used by renderwin too */ @@ -863,7 +863,9 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d) copy_v3_v3(vec, give_cursor(scene, v3d)); translate_m4(rv3d->viewmat, -vec[0], -vec[1], -vec[2]); } - else translate_m4(rv3d->viewmat, rv3d->ofs[0], rv3d->ofs[1], rv3d->ofs[2]); + else { + translate_m4(rv3d->viewmat, rv3d->ofs[0], rv3d->ofs[1], rv3d->ofs[2]); + } } } diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index c8874d13cac..4aa5439a25f 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1298,7 +1298,9 @@ int transformEvent(TransInfo *t, wmEvent *event) if (t->flag & T_AUTOIK) { transform_autoik_update(t, 1); } - else view_editmove(event->type); + else { + view_editmove(event->type); + } t->redraw = 1; break; case PADMINUS: @@ -1313,7 +1315,9 @@ int transformEvent(TransInfo *t, wmEvent *event) if (t->flag & T_AUTOIK) { transform_autoik_update(t, -1); } - else view_editmove(event->type); + else { + view_editmove(event->type); + } t->redraw = 1; break; case LEFTALTKEY: diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 57816e7546c..828d0ec9208 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -223,7 +223,9 @@ static void set_prop_dist(TransInfo *t, short with_dist) tob->rdist = dist; } } - else break; // by definition transdata has selected items in beginning + else { + break; /* by definition transdata has selected items in beginning */ + } } if (with_dist) { tob->dist = tob->rdist; @@ -2048,7 +2050,9 @@ static void createTransEditVerts(TransInfo *t) if (propmode & T_PROP_CONNECTED) dists = MEM_mallocN(em->bm->totvert * sizeof(float), "scratch nears"); } - else t->total = countsel; + else { + t->total = countsel; + } tob = t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Mesh EditMode)"); if (ELEM(t->mode, TFM_SKIN_RESIZE, TFM_SHRINKFATTEN)) { @@ -3584,7 +3588,9 @@ static void createTransGraphEditData(bContext *C, TransInfo *t) if (ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)) { /* for 'normal' pivots - just include anything that is selected. * this works a bit differently in translation modes */ - if (sel2) count++; + if (sel2) { + count++; + } else { if (sel1) count++; if (sel3) count++; diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 54fb567b8a2..290ab68712a 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -856,7 +856,7 @@ static void axis_sort_v3(const float axis_values[3], int r_axis_order[3]) } else { if (v[1] < v[2]) { SWAP_AXIS(0, 1); } - else { SWAP_AXIS(0, 2); } + else { SWAP_AXIS(0, 2); } } if (v[2] < v[1]) { SWAP_AXIS(1, 2); } @@ -1293,7 +1293,9 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving, dz = 1.0; } - else dz = 1.0f - 4.0f * cusize; + else { + dz = 1.0f - 4.0f * cusize; + } if (moving) { float matt[4][4]; @@ -1739,8 +1741,12 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl dep = buffer[4 * a + 1]; val = buffer[4 * a + 3]; - if (val == MAN_TRANS_C) return MAN_TRANS_C; - else if (val == MAN_SCALE_C) return MAN_SCALE_C; + if (val == MAN_TRANS_C) { + return MAN_TRANS_C; + } + else if (val == MAN_SCALE_C) { + return MAN_SCALE_C; + } else { if (val & MAN_ROT_C) { if (minvalrot == 0 || dep < mindeprot) { diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index c8c26ed771d..7f4e05ddefa 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -246,7 +246,9 @@ void undo_editmode_step(bContext *C, int step) } else if (step == 1) { - if (curundo == NULL || curundo->prev == NULL) error("No more steps to undo"); + if (curundo == NULL || curundo->prev == NULL) { + error("No more steps to undo"); + } else { if (G.debug & G_DEBUG) printf("undo %s\n", curundo->name); curundo = curundo->prev; @@ -256,7 +258,9 @@ void undo_editmode_step(bContext *C, int step) else { /* curundo has to remain current situation! */ - if (curundo == NULL || curundo->next == NULL) error("No more steps to redo"); + if (curundo == NULL || curundo->next == NULL) { + error("No more steps to redo"); + } else { undo_restore(curundo->next, curundo->getdata(C), obedit->data); curundo = curundo->next; -- cgit v1.2.3