diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-11-25 18:34:28 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-11-26 20:26:29 +0300 |
commit | 7d32d87a86e442c11e7775d7200eba2055f34f07 (patch) | |
tree | a370091fc1ee952a54ff870174f05e5216824b39 /source/blender/draw/engines/workbench/workbench_forward.c | |
parent | 99f7934e19ddf6796e866d2ddc0c3882ed8fcc2b (diff) |
Viewport: implement hiding faces in paint modes.
In 2.79 hiding works in paint modes with selection enabled,
so it is a missing feature. This implements it in texture
paint overlays and in workbench base shading.
Reviewers: fclem
Differential Revision: https://developer.blender.org/D3989
Diffstat (limited to 'source/blender/draw/engines/workbench/workbench_forward.c')
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_forward.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c index 7a03984b196..b169f6c165e 100644 --- a/source/blender/draw/engines/workbench/workbench_forward.c +++ b/source/blender/draw/engines/workbench/workbench_forward.c @@ -505,6 +505,7 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob) if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) { const bool is_active = (ob == draw_ctx->obact); const bool is_sculpt_mode = is_active && (draw_ctx->object_mode & OB_MODE_SCULPT) != 0; + const bool use_hide = is_active && DRW_object_use_hide_faces(ob); bool is_drawn = false; if (!is_sculpt_mode && TEXTURE_DRAWING_ENABLED(wpd) && ELEM(ob->type, OB_MESH)) { @@ -512,7 +513,7 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob) if (me->mloopuv) { const int materials_len = MAX2(1, (is_sculpt_mode ? 1 : ob->totcol)); struct GPUMaterial **gpumat_array = BLI_array_alloca(gpumat_array, materials_len); - struct GPUBatch **geom_array = me->totcol ? DRW_cache_mesh_surface_texpaint_get(ob) : NULL; + struct GPUBatch **geom_array = me->totcol ? DRW_cache_mesh_surface_texpaint_get(ob, use_hide) : NULL; if (materials_len > 0 && geom_array) { for (int i = 0; i < materials_len; i++) { if (geom_array[i] == NULL) { @@ -545,7 +546,7 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob) if (!is_drawn) { if (ELEM(wpd->shading.color_type, V3D_SHADING_SINGLE_COLOR, V3D_SHADING_RANDOM_COLOR)) { /* No material split needed */ - struct GPUBatch *geom = DRW_cache_object_surface_get(ob); + struct GPUBatch *geom = DRW_cache_object_surface_get_ex(ob, use_hide); if (geom) { material = get_or_create_material_data(vedata, ob, NULL, NULL, wpd->shading.color_type); if (is_sculpt_mode) { @@ -570,7 +571,7 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob) } struct GPUBatch **mat_geom = DRW_cache_object_surface_material_get( - ob, gpumat_array, materials_len, NULL, NULL, NULL); + ob, gpumat_array, materials_len, use_hide, NULL, NULL, NULL); if (mat_geom) { for (int i = 0; i < materials_len; ++i) { if (mat_geom[i] == NULL) { |