diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-22 02:39:35 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-22 12:48:17 +0300 |
commit | 735515a3f9e4c41738bf714d682b13db64adb638 (patch) | |
tree | 04b551336131bc84ecc664a77ae0cefdded78d0b /source/blender/blenkernel/intern/pbvh_bmesh.c | |
parent | 14a49950ff11f43b7a5a73da545339b969de97f0 (diff) |
Cleanup: style, use braces for blenkernel
Diffstat (limited to 'source/blender/blenkernel/intern/pbvh_bmesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/pbvh_bmesh.c | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index f2daab5ef38..bc84b3737aa 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -240,8 +240,9 @@ static void pbvh_bmesh_node_finalize(PBVH *bvh, BB_expand(&n->vb, v->co); } while ((l_iter = l_iter->next) != l_first); - if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) + if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { has_visible = true; + } } BLI_assert(n->vb.bmin[0] <= n->vb.bmax[0] && n->vb.bmin[1] <= n->vb.bmax[1] && @@ -304,10 +305,12 @@ static void pbvh_bmesh_node_split(PBVH *bvh, const BBC *bbc_array, int node_inde BMFace *f = BLI_gsetIterator_getKey(&gs_iter); const BBC *bbc = &bbc_array[BM_elem_index_get(f)]; - if (bbc->bcentroid[axis] < mid) + if (bbc->bcentroid[axis] < mid) { BLI_gset_insert(c1->bm_faces, f); - else + } + else { BLI_gset_insert(c2->bm_faces, f); + } } /* Enforce at least one primitive in each node */ @@ -347,11 +350,13 @@ static void pbvh_bmesh_node_split(PBVH *bvh, const BBC *bbc_array, int node_inde } BLI_gset_free(n->bm_faces, NULL); - if (n->bm_other_verts) + if (n->bm_other_verts) { BLI_gset_free(n->bm_other_verts, NULL); + } - if (n->layer_disp) + if (n->layer_disp) { MEM_freeN(n->layer_disp); + } n->bm_faces = NULL; n->bm_unique_verts = NULL; @@ -707,10 +712,12 @@ static void pbvh_bmesh_edge_loops(BLI_Buffer *buf, BMEdge *e) static void pbvh_bmesh_node_drop_orig(PBVHNode *node) { - if (node->bm_orco) + if (node->bm_orco) { MEM_freeN(node->bm_orco); - if (node->bm_ortri) + } + if (node->bm_ortri) { MEM_freeN(node->bm_ortri); + } node->bm_orco = NULL; node->bm_ortri = NULL; node->bm_tot_ortri = 0; @@ -1155,8 +1162,9 @@ static void pbvh_bmesh_split_edge(EdgeQueueContext *eq_ctx, v1 = l_adj->v; v2 = l_adj->next->v; - if (ni != node_index && i == 0) + if (ni != node_index && i == 0) { pbvh_bmesh_vert_ownership_transfer(bvh, &bvh->nodes[ni], v_new); + } /** * The 2 new faces created and assigned to ``f_new`` have their @@ -1248,8 +1256,9 @@ static bool pbvh_bmesh_subdivide_long_edges(EdgeQueueContext *eq_ctx, /* At the moment edges never get shorter (subdiv will make new edges) * unlike collapse where edges can become longer. */ #if 0 - if (len_squared_v3v3(v1->co, v2->co) <= eq_ctx->q->limit_len_squared) + if (len_squared_v3v3(v1->co, v2->co) <= eq_ctx->q->limit_len_squared) { continue; + } #else BLI_assert(len_squared_v3v3(v1->co, v2->co) > eq_ctx->q->limit_len_squared); #endif @@ -1395,8 +1404,9 @@ static void pbvh_bmesh_collapse_edge(PBVH *bvh, /* Check if any of the face's edges are now unused by any * face, if so delete them */ for (int j = 0; j < 3; j++) { - if (BM_edge_is_wire(e_tri[j])) + if (BM_edge_is_wire(e_tri[j])) { BM_edge_kill(bvh->bm, e_tri[j]); + } } /* Check if any of the face's vertices are now unused, if so @@ -1471,8 +1481,9 @@ static bool pbvh_bmesh_collapse_short_edges(EdgeQueueContext *eq_ctx, EDGE_QUEUE_DISABLE(e); #endif - if (len_squared_v3v3(v1->co, v2->co) >= min_len_squared) + if (len_squared_v3v3(v1->co, v2->co) >= min_len_squared) { continue; + } /* Check that the edge's vertices are still in the PBVH. It's * possible that an edge collapse has deleted adjacent faces @@ -1540,8 +1551,9 @@ bool BKE_pbvh_bmesh_node_raycast_detail(PBVHNode *node, float *depth, float *r_edge_length) { - if (node->flag & PBVH_FullyHidden) + if (node->flag & PBVH_FullyHidden) { return 0; + } GSetIterator gs_iter; bool hit = false; @@ -1818,8 +1830,9 @@ static void pbvh_bmesh_create_nodes_fast_recursive( /* Update node bounding box */ } while ((l_iter = l_iter->next) != l_first); - if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) + if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { has_visible = true; + } BB_expand_with_bb(&n->vb, (BB *)bbc); } @@ -1859,8 +1872,9 @@ void BKE_pbvh_build_bmesh(PBVH *bvh, /* TODO: choose leaf limit better */ bvh->leaf_limit = 100; - if (smooth_shading) + if (smooth_shading) { bvh->flags |= PBVH_DYNTOPO_SMOOTH_SHADING; + } /* bounding box array of all faces, no need to recalculate every time */ BBC *bbc_array = MEM_mallocN(sizeof(BBC) * bm->totface, "BBC"); @@ -2001,8 +2015,9 @@ bool BKE_pbvh_bmesh_update_topology(PBVH *bvh, void BKE_pbvh_bmesh_node_save_orig(PBVHNode *node) { /* Skip if original coords/triangles are already saved */ - if (node->bm_orco) + if (node->bm_orco) { return; + } const int totvert = BLI_gset_len(node->bm_unique_verts) + BLI_gset_len(node->bm_other_verts); @@ -2032,8 +2047,9 @@ void BKE_pbvh_bmesh_node_save_orig(PBVHNode *node) GSET_ITER (gs_iter, node->bm_faces) { BMFace *f = BLI_gsetIterator_getKey(&gs_iter); - if (BM_elem_flag_test(f, BM_ELEM_HIDDEN)) + if (BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { continue; + } #if 0 BMIter bm_iter; @@ -2115,8 +2131,9 @@ static void pbvh_bmesh_print(PBVH *bvh) for (int n = 0; n < bvh->totnode; n++) { PBVHNode *node = &bvh->nodes[n]; - if (!(node->flag & PBVH_Leaf)) + if (!(node->flag & PBVH_Leaf)) { continue; + } GSetIterator gs_iter; fprintf(stderr, "node %d\n faces:\n", n); @@ -2266,8 +2283,9 @@ static void pbvh_bmesh_verify(PBVH *bvh) bool has_unique = false; for (int i = 0; i < bvh->totnode; i++) { PBVHNode *n = &bvh->nodes[i]; - if ((n->bm_unique_verts != NULL) && BLI_gset_haskey(n->bm_unique_verts, vi)) + if ((n->bm_unique_verts != NULL) && BLI_gset_haskey(n->bm_unique_verts, vi)) { has_unique = true; + } } BLI_assert(has_unique); vert_count++; |