diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-05-30 23:56:04 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-06-02 21:52:46 +0300 |
commit | 85098bdb89495896a22bb1739cbe2af1d8343d59 (patch) | |
tree | a8c93335c279a6d8f54f8926c463aa6c97ed05e6 /source/blender/editors/sculpt_paint/sculpt.c | |
parent | 071cc71fb066dd39569e9c8c90ab7aed8d7b0eda (diff) |
Fix T76776: Implement vertex_visibility_get for PBVH_GRIDS
This was missing from when Face Sets were enabled in Multires, so it was
always considering that all vertices in the grids are visible. This
should also fix other unreported bugs.
Reviewed By: sergey
Maniphest Tasks: T76776
Differential Revision: https://developer.blender.org/D7809
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 6e56135ec83..fb82d5d12d6 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -261,8 +261,15 @@ bool SCULPT_vertex_visible_get(SculptSession *ss, int index) return !(ss->mvert[index].flag & ME_HIDE); case PBVH_BMESH: return !BM_elem_flag_test(BM_vert_at_index(ss->bm, index), BM_ELEM_HIDDEN); - case PBVH_GRIDS: - return true; + case PBVH_GRIDS: { + const CCGKey *key = BKE_pbvh_get_grid_key(ss->pbvh); + const int grid_index = index / key->grid_area; + const int vertex_index = index - grid_index * key->grid_area; + BLI_bitmap **grid_hidden = BKE_pbvh_get_grid_visibility(ss->pbvh); + if (grid_hidden && grid_hidden[grid_index]) { + return !BLI_BITMAP_TEST(grid_hidden[grid_index], vertex_index); + } + } } return true; } |