diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-02 17:51:17 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-02 17:51:45 +0300 |
commit | 95e052f830807a89f36021b77638a3a5d0c01309 (patch) | |
tree | 8027630ed821d2ddbdfb33e853110db1471f6825 /source/blender/draw | |
parent | 102daed1f2a243706436925280b0a34703ca2735 (diff) |
Fix T63997 Weird z-fight during weight paint
PBVH drawing was used even in weightpaint/vertexpaint because both uses
the sculpt session.
Diffstat (limited to 'source/blender/draw')
6 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index 456f4bdb5f1..c6a523e4822 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -1617,7 +1617,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, const bool do_cull = (draw_ctx->v3d && (draw_ctx->v3d->shading.flag & V3D_SHADING_BACKFACE_CULLING)); - const bool is_sculpt_mode = (ob->sculpt != NULL); + const bool is_sculpt_mode = DRW_object_use_pbvh_drawing(ob); /* For now just force fully shaded with eevee when supported. */ const bool is_sculpt_mode_draw = ob->sculpt && ob->sculpt->pbvh && BKE_pbvh_type(ob->sculpt->pbvh) != PBVH_FACES; diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index a4c09efb28b..9dcd53a8158 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -935,7 +935,7 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob) WORKBENCH_MaterialData *material; 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 = (ob->sculpt != NULL); + const bool is_sculpt_mode = DRW_object_use_pbvh_drawing(ob); const bool use_hide = is_active && DRW_object_use_hide_faces(ob); const int materials_len = MAX2(1, (is_sculpt_mode ? 1 : ob->totcol)); const Mesh *me = (ob->type == OB_MESH) ? ob->data : NULL; diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c index 7766fe918ca..1d55a54df8d 100644 --- a/source/blender/draw/engines/workbench/workbench_forward.c +++ b/source/blender/draw/engines/workbench/workbench_forward.c @@ -565,7 +565,7 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob) WORKBENCH_MaterialData *material; if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) { - const bool is_sculpt_mode = (ob->sculpt != NULL); + const bool is_sculpt_mode = DRW_object_use_pbvh_drawing(ob); bool is_drawn = false; if (!is_sculpt_mode && TEXTURE_DRAWING_ENABLED(wpd) && ELEM(ob->type, OB_MESH)) { diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index cf5543233bb..134fb5d99f8 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -641,6 +641,7 @@ bool DRW_object_is_renderable(const struct Object *ob); int DRW_object_visibility_in_active_context(const struct Object *ob); bool DRW_object_is_flat_normal(const struct Object *ob); bool DRW_object_use_hide_faces(const struct Object *ob); +bool DRW_object_use_pbvh_drawing(const struct Object *ob); bool DRW_object_is_visible_psys_in_active_context(const struct Object *object, const struct ParticleSystem *psys); diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 5c88c1f93db..9bca424af11 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -40,6 +40,7 @@ #include "BKE_mesh.h" #include "BKE_object.h" #include "BKE_particle.h" +#include "BKE_paint.h" #include "BKE_pointcache.h" #include "draw_manager.h" @@ -212,6 +213,11 @@ bool DRW_object_use_hide_faces(const struct Object *ob) return false; } +bool DRW_object_use_pbvh_drawing(const struct Object *ob) +{ + return ob->sculpt && (ob->sculpt->mode_type == OB_MODE_SCULPT); +} + bool DRW_object_is_visible_psys_in_active_context(const Object *object, const ParticleSystem *psys) { const bool for_render = DRW_state_is_image_render(); diff --git a/source/blender/draw/modes/overlay_mode.c b/source/blender/draw/modes/overlay_mode.c index ed96b2a05bc..68d9a7d3bed 100644 --- a/source/blender/draw/modes/overlay_mode.c +++ b/source/blender/draw/modes/overlay_mode.c @@ -359,7 +359,7 @@ static void overlay_cache_populate(void *vedata, Object *ob) if ((!pd->show_overlays) || (((ob != draw_ctx->object_edit) && !is_edit_mode) || has_edit_mesh_cage) || ob->type != OB_MESH) { - const bool is_sculpt_mode = (ob->sculpt != NULL); + const bool is_sculpt_mode = DRW_object_use_pbvh_drawing(ob); const bool all_wires = (ob->dtx & OB_DRAW_ALL_EDGES); const bool is_wire = (ob->dt < OB_SOLID); const bool use_coloring = (pd->show_overlays && !is_edit_mode && !is_sculpt_mode && |