Fix T63997 Weird z-fight during weight paint

PBVH drawing was used even in weightpaint/vertexpaint because both uses
the sculpt session.
This commit is contained in:
2019-05-02 16:51:17 +02:00
parent 102daed1f2
commit 95e052f830
6 changed files with 11 additions and 4 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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)) {

View File

@@ -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);

View File

@@ -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();

View File

@@ -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 &&