Fix redraw and undo issues with hidden parts in dyntopo after recent
authorAntony Riakiotakis <kalast@gmail.com>
Fri, 11 Apr 2014 12:02:02 +0000 (15:02 +0300)
committerAntony Riakiotakis <kalast@gmail.com>
Fri, 11 Apr 2014 12:02:31 +0000 (15:02 +0300)
changes.

source/blender/blenkernel/intern/pbvh_bmesh.c
source/blender/bmesh/intern/bmesh_log.c

index 9547ac9fc8128f0ebce0016f965611fce3c59266..40605c598bd7870f145befd1ebc1149ab2840be8 100644 (file)
@@ -312,6 +312,7 @@ static BMFace *pbvh_bmesh_face_create(PBVH *bvh, int node_index,
        BLI_assert(BM_face_exists(v_tri, 3, NULL) == false);
 
        f = BM_face_create(bvh->bm, v_tri, e_tri, 3, f_example, BM_CREATE_NOP);
+       f->head.hflag = f_example->head.hflag;
 
        BLI_assert(!BLI_ghash_haskey(bvh->bm_face_to_node, f));
 
@@ -321,6 +322,7 @@ static BMFace *pbvh_bmesh_face_create(PBVH *bvh, int node_index,
 
                /* mark node for update */
                bvh->nodes[node_index].flag |= PBVH_UpdateDrawBuffers | PBVH_UpdateNormals | PBVH_UpdateBB;
+               bvh->nodes[node_index].flag &= ~PBVH_FullyHidden;
 
                /* Log the new face */
                BM_log_face_added(bvh->bm_log, f);
@@ -540,7 +542,8 @@ static void edge_queue_insert(EdgeQueueContext *eq_ctx, BMEdge *e,
         * should already make the brush move the vertices only 50%, which means
         * that topology updates will also happen less frequent, that should be
         * enough. */
-       if (check_mask(eq_ctx, e->v1) || check_mask(eq_ctx, e->v2)) {
+       if ((check_mask(eq_ctx, e->v1) || check_mask(eq_ctx, e->v2)) &&
+           !(BM_elem_flag_test_bool(e->v1, BM_ELEM_HIDDEN) || BM_elem_flag_test_bool(e->v2, BM_ELEM_HIDDEN))) {
                pair = BLI_mempool_alloc(eq_ctx->pool);
                pair[0] = e->v1;
                pair[1] = e->v2;
@@ -619,7 +622,8 @@ static void long_edge_queue_create(EdgeQueueContext *eq_ctx,
 
                /* Check leaf nodes marked for topology update */
                if ((node->flag & PBVH_Leaf) &&
-                   (node->flag & PBVH_UpdateTopology))
+                   (node->flag & PBVH_UpdateTopology) &&
+                   !(node->flag & PBVH_FullyHidden))
                {
                        GSetIterator gs_iter;
 
@@ -658,7 +662,8 @@ static void short_edge_queue_create(EdgeQueueContext *eq_ctx,
 
                /* Check leaf nodes marked for topology update */
                if ((node->flag & PBVH_Leaf) &&
-                   (node->flag & PBVH_UpdateTopology))
+                   (node->flag & PBVH_UpdateTopology) &&
+                   !(node->flag & PBVH_FullyHidden))
                {
                        GSetIterator gs_iter;
 
index d9bbb5c421dbab894b6ad84c67b3eef33934802f..7dac0d45f69cae4c23e86f3d71f2047617d45e88 100644 (file)
@@ -316,6 +316,7 @@ static void bm_log_faces_restore(BMesh *bm, BMLog *log, GHash *faces)
                BMFace *f;
 
                f = BM_face_create_verts(bm, v, 3, NULL, BM_CREATE_NOP, true);
+               f->head.hflag = lf->hflag;
                bm_log_face_id_set(log, f, GET_UINT_FROM_POINTER(key));
        }
 }