[Bf-blender-cvs] [fe7812f7c24] master: Cleanup: style, use braces for editor/curve
Campbell Barton
noreply at git.blender.org
Tue Mar 26 11:17:51 CET 2019
Commit: fe7812f7c24f4c89cd1d046abc87daad545c2d48
Author: Campbell Barton
Date: Tue Mar 26 21:15:47 2019 +1100
Branches: master
https://developer.blender.org/rBfe7812f7c24f4c89cd1d046abc87daad545c2d48
Cleanup: style, use braces for editor/curve
===================================================================
M source/blender/editors/curve/editcurve.c
M source/blender/editors/curve/editcurve_add.c
M source/blender/editors/curve/editcurve_select.c
M source/blender/editors/curve/editcurve_undo.c
M source/blender/editors/curve/editfont.c
===================================================================
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 63768493f7a..3a284d80e5f 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -140,7 +140,9 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
CVKeyIndex *keyIndex;
int a, key_index = 0, nu_index = 0, pt_index = 0, vertex_index = 0;
- if (editnurb->keyindex) return;
+ if (editnurb->keyindex) {
+ return;
+ }
gh = BLI_ghash_ptr_new("editNurb keyIndex");
@@ -346,8 +348,12 @@ static void keyIndex_swap(EditNurb *editnurb, void *a, void *b)
CVKeyIndex *index1 = popCVKeyIndex(editnurb, a);
CVKeyIndex *index2 = popCVKeyIndex(editnurb, b);
- if (index2) BLI_ghash_insert(editnurb->keyindex, a, index2);
- if (index1) BLI_ghash_insert(editnurb->keyindex, b, index1);
+ if (index2) {
+ BLI_ghash_insert(editnurb->keyindex, a, index2);
+ }
+ if (index1) {
+ BLI_ghash_insert(editnurb->keyindex, b, index1);
+ }
}
static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
@@ -363,7 +369,9 @@ static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
bezt1 = nu->bezt;
bezt2 = bezt1 + (a - 1);
- if (a & 1) ++a;
+ if (a & 1) {
+ a++;
+ }
a /= 2;
@@ -371,12 +379,16 @@ static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
index1 = getCVKeyIndex(editnurb, bezt1);
index2 = getCVKeyIndex(editnurb, bezt2);
- if (index1) index1->switched = !index1->switched;
+ if (index1) {
+ index1->switched = !index1->switched;
+ }
if (bezt1 != bezt2) {
keyIndex_swap(editnurb, bezt1, bezt2);
- if (index2) index2->switched = !index2->switched;
+ if (index2) {
+ index2->switched = !index2->switched;
+ }
}
bezt1++;
@@ -395,10 +407,14 @@ static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
index1 = getCVKeyIndex(editnurb, bp1);
index2 = getCVKeyIndex(editnurb, bp2);
- if (index1) index1->switched = !index1->switched;
+ if (index1) {
+ index1->switched = !index1->switched;
+ }
if (bp1 != bp2) {
- if (index2) index2->switched = !index2->switched;
+ if (index2) {
+ index2->switched = !index2->switched;
+ }
keyIndex_swap(editnurb, bp1, bp2);
}
@@ -422,10 +438,14 @@ static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
index1 = getCVKeyIndex(editnurb, bp1);
index2 = getCVKeyIndex(editnurb, bp2);
- if (index1) index1->switched = !index1->switched;
+ if (index1) {
+ index1->switched = !index1->switched;
+ }
if (bp1 != bp2) {
- if (index2) index2->switched = !index2->switched;
+ if (index2) {
+ index2->switched = !index2->switched;
+ }
keyIndex_swap(editnurb, bp1, bp2);
}
@@ -506,8 +526,9 @@ static void keyData_switchDirectionNurb(Curve *cu, Nurb *nu)
}
keyIndex_switchDirection(editnurb, nu);
- if (cu->key)
+ if (cu->key) {
switch_keys_direction(cu, nu);
+ }
}
GHash *ED_curve_keyindex_hash_duplicate(GHash *keyindex)
@@ -579,8 +600,12 @@ static void calc_keyHandles(ListBase *nurb, float *key)
while (a--) {
key_to_bezt(fp, bezt, &cur);
- if (nextp) key_to_bezt(nextfp, nextp, &next);
- if (prevp) key_to_bezt(prevfp, prevp, &prev);
+ if (nextp) {
+ key_to_bezt(nextfp, nextp, &next);
+ }
+ if (prevp) {
+ key_to_bezt(prevfp, prevp, &prev);
+ }
BKE_nurb_handle_calc(&cur, prevp ? &prev : NULL, nextp ? &next : NULL, 0, 0);
bezt_to_key(&cur, fp);
@@ -856,13 +881,17 @@ static void calc_shapeKeys(Object *obedit, ListBase *newnurbs)
}
currkey->totelem = totvert;
- if (currkey->data) MEM_freeN(currkey->data);
+ if (currkey->data) {
+ MEM_freeN(currkey->data);
+ }
currkey->data = newkey;
currkey = currkey->next;
}
- if (ofs) MEM_freeN(ofs);
+ if (ofs) {
+ MEM_freeN(ofs);
+ }
}
}
@@ -894,10 +923,12 @@ static void fcurve_path_rename(AnimData *adt, const char *orig_rna_path, char *r
action_groups_remove_channel(adt->action, fcu);
action_groups_add_channel(adt->action, fcu->grp, nfcu);
}
- else if ((adt->action) && (&adt->action->curves == orig_curves))
+ else if ((adt->action) && (&adt->action->curves == orig_curves)) {
BLI_remlink(&adt->action->curves, fcu);
- else
+ }
+ else {
BLI_remlink(&adt->drivers, fcu);
+ }
free_fcurve(fcu);
@@ -908,8 +939,12 @@ static void fcurve_path_rename(AnimData *adt, const char *orig_rna_path, char *r
static void fcurve_remove(AnimData *adt, ListBase *orig_curves, FCurve *fcu)
{
- if (orig_curves == &adt->drivers) BLI_remlink(&adt->drivers, fcu);
- else action_groups_remove_channel(adt->action, fcu);
+ if (orig_curves == &adt->drivers) {
+ BLI_remlink(&adt->drivers, fcu);
+ }
+ else {
+ action_groups_remove_channel(adt->action, fcu);
+ }
free_fcurve(fcu);
}
@@ -989,16 +1024,21 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
if (STREQLEN(fcu->rna_path, "splines", 7)) {
const char *ch = strchr(fcu->rna_path, '.');
- if (ch && (STREQLEN(ch, ".bezier_points", 14) || STREQLEN(ch, ".points", 7)))
+ if (ch && (STREQLEN(ch, ".bezier_points", 14) || STREQLEN(ch, ".points", 7))) {
fcurve_remove(adt, orig_curves, fcu);
+ }
}
}
for (nu = editnurb->nurbs.first, nu_index = 0; nu != NULL; nu = nu->next, nu_index++) {
keyIndex = NULL;
if (nu->pntsu) {
- if (nu->bezt) keyIndex = getCVKeyIndex(editnurb, &nu->bezt[0]);
- else keyIndex = getCVKeyIndex(editnurb, &nu->bp[0]);
+ if (nu->bezt) {
+ keyIndex = getCVKeyIndex(editnurb, &nu->bezt[0]);
+ }
+ else {
+ keyIndex = getCVKeyIndex(editnurb, &nu->bp[0]);
+ }
}
if (keyIndex) {
@@ -1013,8 +1053,12 @@ static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
for (fcu = orig_curves->first; fcu; fcu = next) {
next = fcu->next;
- if (STREQLEN(fcu->rna_path, "splines", 7)) fcurve_remove(adt, orig_curves, fcu);
- else BLI_addtail(&curves, fcu);
+ if (STREQLEN(fcu->rna_path, "splines", 7)) {
+ fcurve_remove(adt, orig_curves, fcu);
+ }
+ else {
+ BLI_addtail(&curves, fcu);
+ }
}
*orig_curves = curves;
@@ -1026,10 +1070,13 @@ int ED_curve_updateAnimPaths(Main *bmain, Curve *cu)
AnimData *adt = BKE_animdata_from_id(&cu->id);
EditNurb *editnurb = cu->editnurb;
- if (!editnurb->keyindex)
+ if (!editnurb->keyindex) {
return 0;
+ }
- if (!curve_is_animated(cu)) return 0;
+ if (!curve_is_animated(cu)) {
+ return 0;
+ }
if (adt->action != NULL) {
curve_rename_fcurves(cu, &adt->action->curves);
@@ -1199,7 +1246,9 @@ void ED_curve_editnurb_load(Main *bmain, Object *obedit)
{
ListBase *editnurb = object_editcurve_get(obedit);
- if (obedit == NULL) return;
+ if (obedit == NULL) {
+ return;
+ }
if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu = obedit->data;
@@ -1509,11 +1558,17 @@ static bool isNurbselUV(
for (b = 0; b < nu->pntsv; b++) {
sel = 0;
for (a = 0; a < nu->pntsu; a++, bp++) {
- if (bp->f1 & flag) sel++;
+ if (bp->f1 & flag) {
+ sel++;
+ }
}
if (sel == nu->pntsu) {
- if (*r_u == -1) *r_u = b;
- else return 0;
+ if (*r_u == -1) {
+ *r_u = b;
+ }
+ else {
+ return 0;
+ }
}
else if (sel > 1) {
return 0; /* because sel == 1 is still ok */
@@ -1524,19 +1579,29 @@ static bool isNurbselUV(
sel = 0;
bp = &nu->bp[a];
for (b = 0; b < nu->pntsv; b++, bp += nu->pntsu) {
- if (bp->f1 & flag) sel++;
+ if (bp->f1 & flag) {
+ sel++;
+ }
}
if (sel == nu->pntsv) {
- if (*r_v == -1) *r_v = a;
- else return 0;
+ if (*r_v == -1) {
+ *r_v = a;
+ }
+ else {
+ return 0;
+ }
}
else if (sel > 1) {
return 0;
}
}
- if (*r_u == -1 && *r_v > -1) return 1;
- if (*r_v == -1 && *r_u > -1) return 1;
+ if (*r_u == -1 && *r_v > -1) {
+ return 1;
+ }
+ if (*r_v == -1 && *r_u > -1) {
+ return 1;
+ }
return 0;
}
@@ -1551,7 +1616,9 @@ static bool isNurbselU(Nurb *nu, int *v, int flag)
for (b = 0, bp = nu->bp; b < nu->pntsv; b++) {
sel = 0;
for (a = 0; a < nu->pntsu; a++, bp++) {
- if (bp->f1 & flag) sel++;
+ if (bp->f1 & flag) {
+ sel++;
+ }
}
if (sel == nu->pntsu) {
(*v)++;
@@ -1577,7 +1644,9 @@ static bool isNurbselV(Nurb *nu, int *u, int flag)
bp = &nu->bp[a];
sel = 0;
for (b = 0; b < nu->pntsv; b++, bp += nu->pntsu) {
- if (bp->f1 & flag) sel++;
+ if (bp->f1 & flag) {
+ sel++;
+ }
}
if (sel == nu->pntsv) {
(*u)++;
@@ -1628,9 +1697,9 @@ void ed_editnurb_translate_flag(ListBase *editnurb, short flag, const float vec[
a = nu->pntsu;
bezt = nu->bezt;
while (a--) {
- if (bezt->f1 & flag) add_v3_v3(bezt->vec[0], vec);
- if (bezt->f2 & flag) add_v3_v3(bezt->vec[1], vec);
- if (bezt->f3 & flag) add_v3_v3(bezt->vec[2], vec);
+ if (bezt->f1 & flag) { add_v3_v3(bezt->vec[0], vec); }
+ if (bezt->f2 & flag) { add_v3_v3(bezt->vec[1], vec); }
+ if (bezt->f3 & flag) { add_v3_v3(bezt->vec[2], vec); }
bezt++;
}
}
@@ -1638,7 +1707,9 @@ void ed_editnurb_translate_flag(ListBase *editnurb, short flag, const float vec[
a = nu->pntsu * nu->pntsv;
bp = nu->bp;
while (a--) {
- if (bp->f1 & flag) add_v3_v3(bp->vec, vec);
+ if (bp->f1 & flag) {
+ add_v3_v3(bp->vec, vec);
+ }
bp++;
}
}
@@ -1753,7 +1824,9 @@ static void ed_surf_delete_selected(Object *obedit)
nu->pntsv = 1;
SWAP(short, nu->orderu, nu->orderv);
BKE_nurb_order_clamp_u(nu);
- if (nu->knotsv) MEM_freeN(nu->knotsv);
+ if (nu->knotsv) {
+ MEM_freeN(nu->knotsv);
+ }
nu->knotsv = NULL;
}
else {
@@ -1797,8 +1870,9 @@ static void ed_curve_delete_selected(Object *obedit, View3D *v3d)
bezt++;
}
if (a == 0) {
- if (cu->actnu == nuindex)
+ if (cu->actnu == nuindex) {
cu->actnu = CU_ACT_NONE;
+ }
BLI_remlink(nubase, nu);
keyIndex_delNurb(editnurb, nu);
@@ -1821,8 +1895,9 @@ static void ed_curve_delete_selected(Object *obedit, View3D *v3d)
bp++;
}
if (a == 0) {
- if (cu->actnu == nuindex)
+ if (cu->actnu == nuindex) {
cu
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list