diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-31 15:04:16 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-05-31 18:17:03 +0300 |
commit | 692891f69ea42af0ba890f5f92cbd1a3260442c9 (patch) | |
tree | 1aeb9469b7a2b26a8a25a09c6045faa51d34944b /source/blender/draw/modes | |
parent | 9899999e944c0d954dbe5a7aa96c8e1680e7b3f8 (diff) |
Fix sculpt mode drawing with modifiers still being wrong in some cases
Centralize logic for when to use the PBVH for drawing, fix missing tests in
mask drawing, fix missing tests for multiple windows, only do more expensive
update for all viewports at end of the stroke.
Diffstat (limited to 'source/blender/draw/modes')
-rw-r--r-- | source/blender/draw/modes/overlay_mode.c | 13 | ||||
-rw-r--r-- | source/blender/draw/modes/sculpt_mode.c | 4 |
2 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/draw/modes/overlay_mode.c b/source/blender/draw/modes/overlay_mode.c index 667f2c9e70a..3c5cb7cb5aa 100644 --- a/source/blender/draw/modes/overlay_mode.c +++ b/source/blender/draw/modes/overlay_mode.c @@ -26,8 +26,9 @@ #include "BIF_glutil.h" #include "BKE_editmesh.h" -#include "BKE_object.h" #include "BKE_global.h" +#include "BKE_object.h" +#include "BKE_paint.h" #include "BLI_hash.h" @@ -391,10 +392,10 @@ 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 = DRW_object_use_pbvh_drawing(ob); + const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d); 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 && + const bool use_coloring = (pd->show_overlays && !is_edit_mode && !use_sculpt_pbvh && !has_edit_mesh_cage); const int stencil_mask = (ob->dtx & OB_DRAWXRAY) ? 0x00 : 0xFF; float *rim_col, *wire_col; @@ -405,11 +406,11 @@ static void overlay_cache_populate(void *vedata, Object *ob) struct GPUBatch *geom; geom = DRW_cache_object_face_wireframe_get(ob); - if (geom || is_sculpt_mode) { + if (geom || use_sculpt_pbvh) { shgrp = DRW_shgroup_create_sub(pd->face_wires_shgrp); float wire_step_param = 10.0f; - if (!is_sculpt_mode) { + if (!use_sculpt_pbvh) { wire_step_param = (all_wires) ? 1.0f : pd->wire_step_param; } DRW_shgroup_uniform_float_copy(shgrp, "wireStepParam", wire_step_param); @@ -420,7 +421,7 @@ static void overlay_cache_populate(void *vedata, Object *ob) DRW_shgroup_uniform_vec3(shgrp, "rimColor", rim_col, 1); } - if (is_sculpt_mode) { + if (use_sculpt_pbvh) { DRW_shgroup_call_sculpt(shgrp, ob, true, false, false); } else { diff --git a/source/blender/draw/modes/sculpt_mode.c b/source/blender/draw/modes/sculpt_mode.c index cc3435014d3..42a2333f305 100644 --- a/source/blender/draw/modes/sculpt_mode.c +++ b/source/blender/draw/modes/sculpt_mode.c @@ -152,10 +152,10 @@ static void SCULPT_cache_populate(void *vedata, Object *ob) UNUSED_VARS(psl, stl); - if (ob->type == OB_MESH) { + if (ob->sculpt) { const DRWContextState *draw_ctx = DRW_context_state_get(); - if (ob->sculpt && (ob == draw_ctx->obact)) { + if ((ob == draw_ctx->obact) && BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d)) { PBVH *pbvh = ob->sculpt->pbvh; if (pbvh && pbvh_has_mask(pbvh)) { DRW_shgroup_call_sculpt(stl->g_data->mask_overlay_grp, ob, false, true, false); |