Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-01-15 13:38:56 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-01-15 13:43:59 +0300
commit4d8b78b0a9b760bba2f715a7421b3fdd5e076ccf (patch)
tree899cc855ceb757d4013656fcb450a1529065ad48 /source/blender/blenkernel/intern/pbvh.c
parent6cb06501c3283a4d443151ddb93ec5a097cd9078 (diff)
Sculpting: Sdd an option to hide mask in viewport
Brushes themselves are still affected by the mask, but the viewport is not showing the mask. This way it's easier to see details while sculpting. Studio request by Julien Kaspar
Diffstat (limited to 'source/blender/blenkernel/intern/pbvh.c')
-rw-r--r--source/blender/blenkernel/intern/pbvh.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 3a7bade1ee3..d926c96c0d8 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1107,6 +1107,7 @@ static int pbvh_get_buffers_update_flags(PBVH *bvh)
{
int update_flags = 0;
update_flags |= bvh->show_diffuse_color ? GPU_PBVH_BUFFERS_SHOW_DIFFUSE_COLOR : 0;
+ update_flags |= bvh->show_mask ? GPU_PBVH_BUFFERS_SHOW_MASK : 0;
return update_flags;
}
@@ -2109,6 +2110,16 @@ static void pbvh_node_check_diffuse_changed(PBVH *bvh, PBVHNode *node)
node->flag |= PBVH_UpdateDrawBuffers;
}
+static void pbvh_node_check_mask_changed(PBVH *bvh, PBVHNode *node)
+{
+ if (!node->draw_buffers) {
+ return;
+ }
+ if (GPU_pbvh_buffers_mask_changed(node->draw_buffers, bvh->show_mask)) {
+ node->flag |= PBVH_UpdateDrawBuffers;
+ }
+}
+
void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*fnors)[3],
DMSetMaterial setMaterial, bool wireframe, bool fast)
{
@@ -2116,8 +2127,10 @@ void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*fnors)[3],
PBVHNode **nodes;
int totnode;
- for (int a = 0; a < bvh->totnode; a++)
+ for (int a = 0; a < bvh->totnode; a++) {
pbvh_node_check_diffuse_changed(bvh, &bvh->nodes[a]);
+ pbvh_node_check_mask_changed(bvh, &bvh->nodes[a]);
+ }
BKE_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(PBVH_UpdateNormals | PBVH_UpdateDrawBuffers),
&nodes, &totnode);
@@ -2367,3 +2380,8 @@ void pbvh_show_diffuse_color_set(PBVH *bvh, bool show_diffuse_color)
bvh->show_diffuse_color = !has_mask || show_diffuse_color;
}
+
+void pbvh_show_mask_set(PBVH *bvh, bool show_mask)
+{
+ bvh->show_mask = show_mask;
+}