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_deferred.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_deferred.c')
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_deferred.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index ce14ee66ab2..91dffe352ae 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -715,13 +715,14 @@ void workbench_deferred_solid_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)) { const Mesh *me = ob->data; 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) { @@ -744,7 +745,7 @@ void workbench_deferred_solid_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) { @@ -763,7 +764,7 @@ void workbench_deferred_solid_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) { @@ -787,7 +788,7 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob) bool is_manifold; struct GPUBatch *geom_shadow = DRW_cache_object_edge_detection_get(ob, &is_manifold); if (geom_shadow) { - if (is_sculpt_mode) { + if (is_sculpt_mode || use_hide) { /* Currently unsupported in sculpt mode. We could revert to the slow * method in this case but I'm not sure if it's a good idea given that * sculpted meshes are heavy to begin with. */ |