diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-11-25 23:39:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-11-25 23:39:14 +0400 |
commit | 63caaa2b12edf0e0a47764156416fac9d43d3664 (patch) | |
tree | 39d9455df141edc2f232240da34514b0468dcc28 /source/blender/editors/sculpt_paint | |
parent | 5928af11ef97d6d9318d3a06fe32f0d77fc48e9c (diff) |
Code Cleanup: rename vars for detecting change to be more consistent
rename change/is_change/is_changed/modified -> changed
also use bools over int/short/char and once accidental float.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_hide.c | 69 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 14 |
2 files changed, 42 insertions, 41 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index 345db7a0ed0..0eb019afbf7 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -100,7 +100,8 @@ static void partialvis_update_mesh(Object *ob, MVert *mvert; float *paint_mask; int *vert_indices; - int any_changed = 0, any_visible = 0, totvert, i; + int totvert, i; + bool any_changed = false, any_visible = false; BKE_pbvh_node_num_verts(pbvh, node, NULL, &totvert); BKE_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert); @@ -118,11 +119,11 @@ static void partialvis_update_mesh(Object *ob, v->flag |= ME_HIDE; else v->flag &= ~ME_HIDE; - any_changed = 1; + any_changed = true; } if (!(v->flag & ME_HIDE)) - any_visible = 1; + any_visible = true; } if (any_changed) { @@ -143,8 +144,9 @@ static void partialvis_update_grids(Object *ob, CCGElem **grids; CCGKey key; BLI_bitmap **grid_hidden; - int any_visible = 0; - int *grid_indices, totgrid, any_changed, i; + int *grid_indices, totgrid, i; + bool any_changed = false, any_visible = false; + /* get PBVH data */ BKE_pbvh_node_get_grids(pbvh, node, @@ -154,8 +156,7 @@ static void partialvis_update_grids(Object *ob, BKE_pbvh_get_grid_key(pbvh, &key); sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN); - - any_changed = 0; + for (i = 0; i < totgrid; i++) { int any_hidden = 0; int g = grid_indices[i], x, y; @@ -178,8 +179,8 @@ static void partialvis_update_grids(Object *ob, * grid */ MEM_freeN(gh); grid_hidden[g] = NULL; - any_changed = 1; - any_visible = 1; + any_changed = true; + any_visible = true; continue; } @@ -195,14 +196,14 @@ static void partialvis_update_grids(Object *ob, BLI_BITMAP_MODIFY(gh, y * key.grid_size + x, action == PARTIALVIS_HIDE); - any_changed = 1; + any_changed = true; } /* keep track of whether any elements are still hidden */ if (BLI_BITMAP_GET(gh, y * key.grid_size + x)) - any_hidden = 1; + any_hidden = true; else - any_visible = 1; + any_visible = true; } } @@ -227,8 +228,8 @@ static void partialvis_update_bmesh_verts(BMesh *bm, PartialVisAction action, PartialVisArea area, float planes[4][4], - int *any_changed, - int *any_visible) + bool *any_changed, + bool *any_visible) { GSetIterator gs_iter; @@ -244,24 +245,24 @@ static void partialvis_update_bmesh_verts(BMesh *bm, BM_elem_flag_enable(v, BM_ELEM_HIDDEN); else BM_elem_flag_disable(v, BM_ELEM_HIDDEN); - (*any_changed) = TRUE; + (*any_changed) = true; } if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN)) - (*any_visible) = TRUE; + (*any_visible) = true; } } static void partialvis_update_bmesh(Object *ob, - PBVH *pbvh, - PBVHNode *node, - PartialVisAction action, - PartialVisArea area, - float planes[4][4]) + PBVH *pbvh, + PBVHNode *node, + PartialVisAction action, + PartialVisArea area, + float planes[4][4]) { BMesh *bm; GSet *unique, *other; - int any_changed = 0, any_visible = 0; + bool any_changed = false, any_visible = false; bm = BKE_pbvh_get_bmesh(pbvh); unique = BKE_pbvh_bmesh_node_unique_verts(node); @@ -270,20 +271,20 @@ static void partialvis_update_bmesh(Object *ob, sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN); partialvis_update_bmesh_verts(bm, - unique, - action, - area, - planes, - &any_changed, - &any_visible); + unique, + action, + area, + planes, + &any_changed, + &any_visible); partialvis_update_bmesh_verts(bm, - other, - action, - area, - planes, - &any_changed, - &any_visible); + other, + action, + area, + planes, + &any_changed, + &any_visible); if (any_changed) { BKE_pbvh_node_mark_rebuild_draw(node); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 714d67c8039..7e598ff788b 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1088,7 +1088,7 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even { ViewContext vc; Mesh *me; - short change = FALSE; + bool changed = false; view3d_set_viewcontext(C, &vc); me = BKE_mesh_from_object(vc.obact); @@ -1122,11 +1122,11 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even const int vgroup_active = vc.obact->actdef - 1; float vgroup_weight = defvert_find_weight(&me->dvert[v_idx_best], vgroup_active); BKE_brush_weight_set(vc.scene, brush, vgroup_weight); - change = TRUE; + changed = true; } } - if (change) { + if (changed) { /* not really correct since the brush didnt change, but redraws the toolbar */ WM_main_add_notifier(NC_BRUSH | NA_EDITED, NULL); /* ts->wpaint->paint.brush */ @@ -1468,14 +1468,14 @@ static float redistribute_change(MDeformVert *ndv, const int defbase_tot, float totchange, float total_valid, char do_auto_normalize) { - float was_change; + bool changed; float change; float oldval; MDeformWeight *ndw; int i; do { /* assume there is no change until you see one */ - was_change = FALSE; + changed = false; /* change each group by the same amount each time */ change = totchange / total_valid; for (i = 0; i < ndv->totweight && total_valid && totchange; i++) { @@ -1507,14 +1507,14 @@ static float redistribute_change(MDeformVert *ndv, const int defbase_tot, } /* see if there was a change */ if (oldval != ndw->weight) { - was_change = TRUE; + changed = true; } } } } /* don't go again if there was no change, if there is no valid group, * or there is no change left */ - } while (was_change && total_valid && totchange); + } while (changed && total_valid && totchange); /* left overs */ return totchange; } |