diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_pbvh.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pbvh_bmesh.c | 5 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_hide.c | 20 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 2 |
4 files changed, 26 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index 73ca60d40b9..79a41f06c3a 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -185,6 +185,7 @@ bool BKE_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data); struct GSet *BKE_pbvh_bmesh_node_unique_verts(PBVHNode *node); struct GSet *BKE_pbvh_bmesh_node_other_verts(PBVHNode *node); +struct GSet *BKE_pbvh_bmesh_node_faces(PBVHNode *node); void BKE_pbvh_bmesh_node_save_orig(PBVHNode *node); void BKE_pbvh_bmesh_after_stroke(PBVH *bvh); diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index 432694f75f9..ba383279900 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -1338,6 +1338,11 @@ GSet *BKE_pbvh_bmesh_node_other_verts(PBVHNode *node) return node->bm_other_verts; } +struct GSet *BKE_pbvh_bmesh_node_faces(PBVHNode *node) +{ + return node->bm_faces; +} + /****************************** Debugging *****************************/ #if 0 diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index 6542bb2ca9b..fb3fd10a5f1 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -253,6 +253,20 @@ static void partialvis_update_bmesh_verts(BMesh *bm, } } +static void partialvis_update_bmesh_faces(GSet *faces, PartialVisAction action) +{ + GSetIterator gs_iter; + + GSET_ITER (gs_iter, faces) { + BMFace *f = BLI_gsetIterator_getKey(&gs_iter); + + if ((action == PARTIALVIS_HIDE) && paint_is_bmesh_face_hidden(f)) + BM_elem_flag_enable(f, BM_ELEM_HIDDEN); + else + BM_elem_flag_disable(f, BM_ELEM_HIDDEN); + } +} + static void partialvis_update_bmesh(Object *ob, PBVH *pbvh, PBVHNode *node, @@ -261,12 +275,13 @@ static void partialvis_update_bmesh(Object *ob, float planes[4][4]) { BMesh *bm; - GSet *unique, *other; + GSet *unique, *other, *faces; bool any_changed = false, any_visible = false; bm = BKE_pbvh_get_bmesh(pbvh); unique = BKE_pbvh_bmesh_node_unique_verts(node); other = BKE_pbvh_bmesh_node_other_verts(node); + faces = BKE_pbvh_bmesh_node_faces(node); sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN); @@ -286,6 +301,9 @@ static void partialvis_update_bmesh(Object *ob, &any_changed, &any_visible); + /* finally loop over node faces and tag the ones that are fully hidden */ + partialvis_update_bmesh_faces(faces, action); + if (any_changed) { BKE_pbvh_node_mark_rebuild_draw(node); BKE_pbvh_node_fully_hidden_set(node, !any_visible); diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 82c14695fec..e1db9b6f83a 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -2056,7 +2056,7 @@ static int gpu_bmesh_face_visible_count(GSet *bm_faces) GSET_ITER (gh_iter, bm_faces) { BMFace *f = BLI_gsetIterator_getKey(&gh_iter); - if (!paint_is_bmesh_face_hidden(f)) + if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) totface++; } |