diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-03-07 20:08:32 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-03-10 05:35:53 +0300 |
commit | d77b7b097d3411a0d28e579bb2d67c8dfa8d04c7 (patch) | |
tree | 108fda1ee8358bfcf5dba6aaf08878068327296c | |
parent | 40412499433ef6d8619fd1e8ecaa00addb163721 (diff) |
Fix T58890: Sculpt Mode not updating in LookDev or Rendered
This fix is a hack and will slow down update performance. But at least,
all shading features are supported. This is only in "normal" sculpt mode
(no dyntopo, no multires).
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 69b768c4318..f1b41ff792a 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -5056,21 +5056,43 @@ void sculpt_update_object_bounding_box(Object *ob) static void sculpt_flush_update(bContext *C) { + Depsgraph *depsgraph = CTX_data_depsgraph(C); Object *ob = CTX_data_active_object(C); + Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); SculptSession *ss = ob->sculpt; ARegion *ar = CTX_wm_region(C); + bScreen *screen = CTX_wm_screen(C); MultiresModifierData *mmd = ss->multires; if (mmd != NULL) { /* NOTE: SubdivCCG is living in the evaluated object. */ - Depsgraph *depsgraph = CTX_data_depsgraph(C); - Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); multires_mark_as_modified(ob_eval, MULTIRES_COORDS_MODIFIED); } DEG_id_tag_update(&ob->id, ID_RECALC_SHADING); - if (ss->kb || ss->modifiers_active) { + bool use_shaded_mode = false; + if (mmd || (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH)) { + /* Multres or dyntopo are drawn directly by EEVEE, + * no need for hacks in this case. */ + } + else { + /* We search if an area of the current window is in lookdev/rendered + * display mode. In this case, for changes to show up, we need to + * tag for ID_RECALC_GEOMETRY. */ + for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { + for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) { + if (sl->spacetype == SPACE_VIEW3D) { + View3D *v3d = (View3D *)sl; + if (v3d->shading.type > OB_SOLID) { + use_shaded_mode = true; + } + } + } + } + } + + if (ss->kb || ss->modifiers_active || use_shaded_mode) { DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); ED_region_tag_redraw(ar); } @@ -5101,9 +5123,6 @@ static void sculpt_flush_update(bContext *C) ED_region_tag_redraw_partial(ar, &r); } } - - /* 2.8x - avoid full mesh update! */ - BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_SCULPT_COORDS); } /* Returns whether the mouse/stylus is over the mesh (1) |