style cleanup: follow style guide for formatting of if/for/while loops, and else...
[blender.git] / source / blender / editors / sculpt_paint / paint_hide.c
index fbb0df401f977787854a62b2de7ca5456e0125a7..fcf7d2eba68cf8b38e689e6308ece33e27020154 100644 (file)
@@ -74,8 +74,8 @@ static int planes_contain_v3(float (*planes)[4], int totplane, const float p[3])
 {
        int i;
 
-       for(i = 0; i < totplane; i++) {
-               if(dot_v3v3(planes[i], p) + planes[i][3] > 0)
+       for (i = 0; i < totplane; i++) {
+               if (dot_v3v3(planes[i], p) + planes[i][3] > 0)
                        return 0;
        }
 
@@ -87,7 +87,7 @@ static int is_effected(PartialVisArea area,
                                           float planes[4][4],
                                           const float co[3])
 {
-       if(area == PARTIALVIS_ALL)
+       if (area == PARTIALVIS_ALL)
                return 1;
        else {
                int inside = planes_contain_v3(planes, 4, co);
@@ -112,23 +112,23 @@ static void partialvis_update_mesh(Object *ob,
 
        sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
 
-       for(i = 0; i < totvert; i++) {
+       for (i = 0; i < totvert; i++) {
                MVert *v = &mvert[vert_indices[i]];
 
                /* hide vertex if in the hide volume */
-               if(is_effected(area, planes, v->co)) {
-                       if(action == PARTIALVIS_HIDE)
+               if (is_effected(area, planes, v->co)) {
+                       if (action == PARTIALVIS_HIDE)
                                v->flag |= ME_HIDE;
                        else
                                v->flag &= ~ME_HIDE;
                        any_changed = 1;
                }
 
-               if(!(v->flag & ME_HIDE))
+               if (!(v->flag & ME_HIDE))
                        any_visible = 1;
        }
 
-       if(any_changed) {
+       if (any_changed) {
                BLI_pbvh_node_mark_rebuild_draw(node);
                BLI_pbvh_node_fully_hidden_set(node, !any_visible);
        }
@@ -157,12 +157,12 @@ static void partialvis_update_grids(Object *ob,
        sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
        
        any_changed = 0;
-       for(i = 0; i < totgrid; i++) {
+       for (i = 0; i < totgrid; i++) {
                int any_hidden = 0;
                int g = grid_indices[i], x, y;
                BLI_bitmap gh = grid_hidden[g];
 
-               if(!gh) {
+               if (!gh) {
                        switch(action) {
                        case PARTIALVIS_HIDE:
                                /* create grid flags data */
@@ -174,7 +174,7 @@ static void partialvis_update_grids(Object *ob,
                                continue;
                        }
                }
-               else if(action == PARTIALVIS_SHOW && area == PARTIALVIS_ALL) {
+               else if (action == PARTIALVIS_SHOW && area == PARTIALVIS_ALL) {
                        /* special case if we're showing all, just free the
                           grid */
                        MEM_freeN(gh);
@@ -184,12 +184,12 @@ static void partialvis_update_grids(Object *ob,
                        continue;
                }
 
-               for(y = 0; y < gridsize; y++) {
-                       for(x = 0; x < gridsize; x++) {
+               for (y = 0; y < gridsize; y++) {
+                       for (x = 0; x < gridsize; x++) {
                                const float *co = grids[g][y * gridsize + x].co;
 
                                /* skip grid element if not in the effected area */
-                               if(is_effected(area, planes, co)) {
+                               if (is_effected(area, planes, co)) {
                                        /* set or clear the hide flag */
                                        BLI_BITMAP_MODIFY(gh, y * gridsize + x,
                                                                          action == PARTIALVIS_HIDE);
@@ -198,7 +198,7 @@ static void partialvis_update_grids(Object *ob,
                                }
 
                                /* keep track of whether any elements are still hidden */
-                               if(BLI_BITMAP_GET(gh, y * gridsize + x))
+                               if (BLI_BITMAP_GET(gh, y * gridsize + x))
                                        any_hidden = 1;
                                else
                                        any_visible = 1;
@@ -207,14 +207,14 @@ static void partialvis_update_grids(Object *ob,
 
                /* if everything in the grid is now visible, free the grid
                   flags */
-               if(!any_hidden) {
+               if (!any_hidden) {
                        MEM_freeN(gh);
                        grid_hidden[g] = NULL;
                }
        }
 
        /* mark updates if anything was hidden/shown */
-       if(any_changed) {
+       if (any_changed) {
                BLI_pbvh_node_mark_rebuild_draw(node);
                BLI_pbvh_node_fully_hidden_set(node, !any_visible);
                multires_mark_as_modified(ob, MULTIRES_HIDDEN_MODIFIED);
@@ -310,7 +310,7 @@ static int hide_show_exec(bContext *C, wmOperator *op)
                break;
        }
 
-       for(i = 0; i < totnode; i++) {
+       for (i = 0; i < totnode; i++) {
                switch(pbvh_type) {
                case PBVH_FACES:
                        partialvis_update_mesh(ob, pbvh, nodes[i], action, area, clip_planes);
@@ -321,7 +321,7 @@ static int hide_show_exec(bContext *C, wmOperator *op)
                }
        }
 
-       if(nodes)
+       if (nodes)
                MEM_freeN(nodes);
        
        /* end undo */
@@ -329,7 +329,7 @@ static int hide_show_exec(bContext *C, wmOperator *op)
 
        /* ensure that edges and faces get hidden as well (not used by
           sculpt but it looks wrong when entering editmode otherwise) */
-       if(pbvh_type == PBVH_FACES) {
+       if (pbvh_type == PBVH_FACES) {
                mesh_flush_hidden_from_verts(me->mvert, me->mloop,
                                                                         me->medge, me->totedge,
                                                                         me->mpoly, me->totpoly);
@@ -344,7 +344,7 @@ static int hide_show_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
        PartialVisArea area = RNA_enum_get(op->ptr, "area");
 
-       if(area != PARTIALVIS_ALL)
+       if (area != PARTIALVIS_ALL)
                return WM_border_select_invoke(C, op, event);
        else
                return op->type->exec(C, op);