[Bf-blender-cvs] [66c8a8ac245] sculpt-dev: Fix typo in last commit
Joseph Eagar
noreply at git.blender.org
Wed Oct 6 03:52:39 CEST 2021
Commit: 66c8a8ac24526b23a13fd00b89bf6c490752913e
Author: Joseph Eagar
Date: Tue Oct 5 18:52:23 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB66c8a8ac24526b23a13fd00b89bf6c490752913e
Fix typo in last commit
===================================================================
M source/blender/blenkernel/intern/pbvh_bmesh.c
M source/blender/editors/sculpt_paint/sculpt.c
===================================================================
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index b4a4cdb6488..a90e6df76c4 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -14,30 +14,30 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
- /** \file
- * \ingroup bli
- */
+/** \file
+ * \ingroup bli
+ */
- /*
+/*
- TODO:
+TODO:
- Convergence improvements:
- 1. DONE: Limit number of edges processed per run.
- 2. DONE: Scale split steps by ratio of long to short edges to
- prevent runaway tesselation.
- 3. DONE: Detect and dissolve three and four valence vertices that are surrounded by
- all tris.
- 4. DONE: Use different (coarser) brush spacing for applying dyntopo
+Convergence improvements:
+1. DONE: Limit number of edges processed per run.
+2. DONE: Scale split steps by ratio of long to short edges to
+ prevent runaway tesselation.
+3. DONE: Detect and dissolve three and four valence vertices that are surrounded by
+ all tris.
+4. DONE: Use different (coarser) brush spacing for applying dyntopo
- Drawing improvements:
- 4. PARTIAL DONE: Build and cache vertex index buffers, to reduce GPU bandwidth
+Drawing improvements:
+4. PARTIAL DONE: Build and cache vertex index buffers, to reduce GPU bandwidth
- Topology rake:
- 5. DONE: Enable new curvature topology rake code and add to UI.
- 6. DONE: Add code to cache curvature data per vertex in a CD layer.
+Topology rake:
+5. DONE: Enable new curvature topology rake code and add to UI.
+6. DONE: Add code to cache curvature data per vertex in a CD layer.
- */
+*/
#include "MEM_guardedalloc.h"
@@ -74,11 +74,11 @@
#include <stdarg.h>
-static void _debugprint(const char *fmt,...)
+static void _debugprint(const char *fmt, ...)
{
va_list args;
- va_start(args,fmt);
- vprintf(fmt,args);
+ va_start(args, fmt);
+ vprintf(fmt, args);
va_end(args);
}
@@ -239,10 +239,10 @@ void pbvh_bmesh_pbvh_bmesh_check_nodes(PBVH *pbvh)
/* Update node data after splitting */
static void pbvh_bmesh_node_finalize(PBVH *pbvh,
- const int node_index,
- const int cd_vert_node_offset,
- const int cd_face_node_offset,
- bool add_orco)
+ const int node_index,
+ const int cd_vert_node_offset,
+ const int cd_face_node_offset,
+ bool add_orco)
{
PBVHNode *n = &pbvh->nodes[node_index];
bool has_visible = false;
@@ -256,9 +256,9 @@ static void pbvh_bmesh_node_finalize(PBVH *pbvh,
BB_reset(&n->vb);
BMFace *f;
- TGSET_ITER (f,n->bm_faces) {
+ TGSET_ITER (f, n->bm_faces) {
/* Update ownership of faces */
- BM_ELEM_CD_SET_INT(f,cd_face_node_offset,node_index);
+ BM_ELEM_CD_SET_INT(f, cd_face_node_offset, node_index);
/* Update vertices */
BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
@@ -266,58 +266,59 @@ static void pbvh_bmesh_node_finalize(PBVH *pbvh,
do {
BMVert *v = l_iter->v;
- MDynTopoVert *mv = BKE_PBVH_DYNVERT(pbvh->cd_dyn_vert,v);
- MV_ADD_FLAG(mv,DYNVERT_NEED_BOUNDARY);
+ MDynTopoVert *mv = BKE_PBVH_DYNVERT(pbvh->cd_dyn_vert, v);
+ MV_ADD_FLAG(mv, DYNVERT_NEED_BOUNDARY);
- if (!BLI_table_gset_haskey(n->bm_unique_verts,v)) {
- if (BM_ELEM_CD_GET_INT(v,cd_vert_node_offset) != DYNTOPO_NODE_NONE) {
- BLI_table_gset_add(n->bm_other_verts,v);
- } else {
- BLI_table_gset_insert(n->bm_unique_verts,v);
- BM_ELEM_CD_SET_INT(v,cd_vert_node_offset,node_index);
+ if (!BLI_table_gset_haskey(n->bm_unique_verts, v)) {
+ if (BM_ELEM_CD_GET_INT(v, cd_vert_node_offset) != DYNTOPO_NODE_NONE) {
+ BLI_table_gset_add(n->bm_other_verts, v);
+ }
+ else {
+ BLI_table_gset_insert(n->bm_unique_verts, v);
+ BM_ELEM_CD_SET_INT(v, cd_vert_node_offset, node_index);
}
}
/* Update node bounding box */
- BB_expand(&n->vb,v->co);
+ 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;
}
}
TGSET_ITER_END
- BLI_assert(n->vb.bmin[0] <= n->vb.bmax[0] && n->vb.bmin[1] <= n->vb.bmax[1] &&
- n->vb.bmin[2] <= n->vb.bmax[2]);
+ BLI_assert(n->vb.bmin[0] <= n->vb.bmax[0] && n->vb.bmin[1] <= n->vb.bmax[1] &&
+ n->vb.bmin[2] <= n->vb.bmax[2]);
n->orig_vb = n->vb;
/* Build GPU buffers for new node and update vertex normals */
BKE_pbvh_node_mark_rebuild_draw(n);
- BKE_pbvh_node_fully_hidden_set(n,!has_visible);
+ BKE_pbvh_node_fully_hidden_set(n, !has_visible);
n->flag |= PBVH_UpdateNormals | PBVH_UpdateCurvatureDir | PBVH_UpdateTris;
if (add_orco) {
- BKE_pbvh_bmesh_check_tris(pbvh,n);
+ BKE_pbvh_bmesh_check_tris(pbvh, n);
}
}
/* Recursively split the node if it exceeds the leaf_limit */
static void pbvh_bmesh_node_split(
- PBVH *pbvh,const BBC *bbc_array,int node_index,bool add_orco,int depth)
+ PBVH *pbvh, const BBC *bbc_array, int node_index, bool add_orco, int depth)
{
const int cd_vert_node_offset = pbvh->cd_vert_node_offset;
const int cd_face_node_offset = pbvh->cd_face_node_offset;
PBVHNode *n = &pbvh->nodes[node_index];
#ifdef PROXY_ADVANCED
- BKE_pbvh_free_proxyarray(pbvh,n);
+ BKE_pbvh_free_proxyarray(pbvh, n);
#endif
if (depth > 6 || BLI_table_gset_len(n->bm_faces) <= pbvh->leaf_limit) {
/* Node limit not exceeded */
- pbvh_bmesh_node_finalize(pbvh,node_index,cd_vert_node_offset,cd_face_node_offset,add_orco);
+ pbvh_bmesh_node_finalize(pbvh, node_index, cd_vert_node_offset, cd_face_node_offset, add_orco);
return;
}
@@ -326,36 +327,36 @@ static void pbvh_bmesh_node_split(
BB_reset(&cb);
BMFace *f;
- TGSET_ITER (f,n->bm_faces) {
+ TGSET_ITER (f, n->bm_faces) {
const BBC *bbc = &bbc_array[BM_elem_index_get(f)];
- BB_expand(&cb,bbc->bcentroid);
+ BB_expand(&cb, bbc->bcentroid);
}
TGSET_ITER_END
- /* Find widest axis and its midpoint */
- const int axis = BB_widest_axis(&cb);
+ /* Find widest axis and its midpoint */
+ const int axis = BB_widest_axis(&cb);
const float mid = (cb.bmax[axis] + cb.bmin[axis]) * 0.5f;
if (isnan(mid)) {
- printf("NAN ERROR! %s\n",__func__);
+ printf("NAN ERROR! %s\n", __func__);
}
/* Add two new child nodes */
const int children = pbvh->totnode;
n->children_offset = children;
- pbvh_grow_nodes(pbvh,pbvh->totnode + 2);
+ pbvh_grow_nodes(pbvh, pbvh->totnode + 2);
/* Array reallocated, update current node pointer */
n = &pbvh->nodes[node_index];
/* Initialize children */
- PBVHNode *c1 = &pbvh->nodes[children],*c2 = &pbvh->nodes[children + 1];
+ PBVHNode *c1 = &pbvh->nodes[children], *c2 = &pbvh->nodes[children + 1];
c1->flag |= PBVH_Leaf;
c2->flag |= PBVH_Leaf;
- c1->bm_faces = BLI_table_gset_new_ex("bm_faces",BLI_table_gset_len(n->bm_faces) / 2);
- c2->bm_faces = BLI_table_gset_new_ex("bm_faces",BLI_table_gset_len(n->bm_faces) / 2);
+ c1->bm_faces = BLI_table_gset_new_ex("bm_faces", BLI_table_gset_len(n->bm_faces) / 2);
+ c2->bm_faces = BLI_table_gset_new_ex("bm_faces", BLI_table_gset_len(n->bm_faces) / 2);
c1->bm_unique_verts = BLI_table_gset_new("bm_unique_verts");
c2->bm_unique_verts = BLI_table_gset_new("bm_unique_verts");
@@ -363,13 +364,14 @@ static void pbvh_bmesh_node_split(
c1->bm_other_verts = c2->bm_other_verts = NULL;
/* Partition the parent node's faces between the two children */
- TGSET_ITER (f,n->bm_faces) {
+ TGSET_ITER (f, n->bm_faces) {
const BBC *bbc = &bbc_array[BM_elem_index_get(f)];
if (bbc->bcentroid[axis] < mid) {
- BLI_table_gset_insert(c1->bm_faces,f);
- } else {
- BLI_table_gset_insert(c2->bm_faces,f);
+ BLI_table_gset_insert(c1->bm_faces, f);
+ }
+ else {
+ BLI_table_gset_insert(c2->bm_faces, f);
}
}
TGSET_ITER_END
@@ -404,32 +406,33 @@ static void pbvh_bmesh_node_split(
never assigns verts to nodes that don't contain their
faces.*/
if (n->bm_unique_verts) {
- TGSET_ITER (v,n->bm_unique_verts) {
+ TGSET_ITER (v, n->bm_unique_verts) {
if (v->co[axis] < mid) {
- BM_ELEM_CD_SET_INT(v,cd_vert_node_offset,(c1 - pbvh->nodes));
- BLI_table_gset_add(c1->bm_unique_verts,v);
- } else {
- BM_ELEM_CD_SET_INT(v,cd_vert_node_offset,(c2 - pbvh->nodes));
- BLI_table_gset_add(c2->bm_unique_verts,v);
+ BM_ELEM_CD_SET_INT(v, cd_vert_node_offset, (c1 - pbvh->nodes));
+ BLI_table_gset_add(c1->bm_unique_verts, v);
+ }
+ else {
+ BM_ELEM_CD_SET_INT(v, cd_vert_node_offset, (c2 - pbvh->nodes));
+ BLI_table_gset_add(c2->bm_unique_verts, v);
}
}
TGSET_ITER_END
- BLI_table_gset_free(n->bm_unique_verts,NULL);
+ BLI_table_gset_free(n->bm_unique_verts, NULL);
}
if (n->bm_faces) {
/* Unclaim faces */
- TGSET_ITER (f,n->bm_faces) {
- BM_ELEM_CD_SET_INT(f,cd_face_node_offset,DYNTOPO_NODE_NONE);
+ TGSET_ITER (f, n->bm_faces) {
+ BM_ELEM_CD_SET_INT(f, cd_face_node_offset, DYNTOPO_NODE_NONE);
}
TGSET_ITER_END
- BLI_table_gset_free(n->bm_faces,NULL);
+ BLI_table_gset_free(n->bm_faces, NULL);
}
if (n->bm_other_verts) {
- BLI_table_gset_free(n->bm_other_verts,NULL);
+ BLI_table_gset_free(n->bm_other_verts, NULL);
}
if (n->layer_disp) {
@@ -437,7 +440,7 @@ static void pbvh_bmesh_node_split(
}
if (n->tribuf || n->tri_buffers) {
- BKE_pbvh_bmesh_free_tris(pbvh,n);
+ BKE_pbvh_bmesh_free_tris(pbvh, n);
}
n->bm_faces = NULL;
@@ -450,21 +453,21 @@ static void pbvh_bmesh_node_split(
n->flag &= ~PBVH_Leaf;
/* Recurse */
- pbvh_bmesh_node_split(pbvh,bbc_array,children,add_orco,depth + 1);
- pbvh_bmesh_node_split(pbvh,bbc_array,children + 1,add_orco,depth + 1);
+ pbvh_bmesh_node_split(pbvh, bbc_array, children, add_orco, depth + 1);
+ pbvh_bmesh_node_split(pbvh, bbc_array, children + 1, add_orco, depth
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list