[Bf-blender-cvs] [7c513f5] master: Fix some redrawing and possibly other issues in dyntopo:

Antony Riakiotakis noreply at git.blender.org
Tue Apr 1 23:57:41 CEST 2014


Commit: 7c513f59135006c5a01b94e4590a4b77e8771707
Author: Antony Riakiotakis
Date:   Wed Apr 2 00:55:19 2014 +0300
https://developer.blender.org/rB7c513f59135006c5a01b94e4590a4b77e8771707

Fix some redrawing and possibly other issues in dyntopo:

When node face gets deleted, added or exchanged, the nodes should update
their draw buffers, normals and bounding boxes. This was not being done
before so there were graphical glitches apparent, especially in collapse
mode.

===================================================================

M	source/blender/blenkernel/intern/pbvh_bmesh.c

===================================================================

diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index 7c4b687..1c26539 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -318,6 +318,9 @@ static BMFace *pbvh_bmesh_face_create(PBVH *bvh, int node_index,
 		BLI_ghash_insert(bvh->nodes[node_index].bm_faces, f, NULL);
 		BLI_ghash_insert(bvh->bm_face_to_node, f, val);
 
+		/* mark node for update */
+		bvh->nodes[node_index].flag |= PBVH_UpdateDrawBuffers | PBVH_UpdateNormals | PBVH_UpdateBB;
+
 		/* Log the new face */
 		BM_log_face_added(bvh->bm_log, f);
 	}
@@ -371,6 +374,10 @@ static void pbvh_bmesh_vert_ownership_transfer(PBVH *bvh, PBVHNode *new_owner,
 	PBVHNode *current_owner;
 
 	current_owner = pbvh_bmesh_node_lookup(bvh, bvh->bm_vert_to_node, v);
+	/* mark node for update */
+	current_owner->flag |= PBVH_UpdateDrawBuffers | PBVH_UpdateNormals | PBVH_UpdateBB;
+
+
 	BLI_assert(current_owner != new_owner);
 
 	/* Remove current ownership */
@@ -382,6 +389,9 @@ static void pbvh_bmesh_vert_ownership_transfer(PBVH *bvh, PBVHNode *new_owner,
 	BLI_gset_insert(new_owner->bm_unique_verts, v);
 	BLI_gset_remove(new_owner->bm_other_verts, v, NULL);
 	BLI_assert(!BLI_gset_haskey(new_owner->bm_other_verts, v));
+
+	/* mark node for update */
+	new_owner->flag |= PBVH_UpdateDrawBuffers | PBVH_UpdateNormals | PBVH_UpdateBB;
 }
 
 static void pbvh_bmesh_vert_remove(PBVH *bvh, BMVert *v)
@@ -449,6 +459,9 @@ static void pbvh_bmesh_face_remove(PBVH *bvh, BMFace *f)
 
 	/* Log removed face */
 	BM_log_face_removed(bvh->bm_log, f);
+
+	/* mark node for update */
+	f_node->flag |= PBVH_UpdateDrawBuffers | PBVH_UpdateNormals | PBVH_UpdateBB;
 }
 
 static void pbvh_bmesh_edge_loops(BLI_Buffer *buf, BMEdge *e)
@@ -709,9 +722,6 @@ static void pbvh_bmesh_split_edge(EdgeQueueContext *eq_ctx, PBVH *bvh,
 		nip = BLI_ghash_lookup(bvh->bm_face_to_node, f_adj);
 		ni = GET_INT_FROM_POINTER(nip);
 
-		/* Ensure node gets redrawn */
-		bvh->nodes[ni].flag |= PBVH_UpdateDrawBuffers | PBVH_UpdateNormals;
-
 		/* Find the vertex not in the edge */
 		v_opp = l_adj->prev->v;




More information about the Bf-blender-cvs mailing list