Commit: d4827cfa81214f095f4d6a0e644bc2f8328fa77c
Author: Clément Foucault
Date:   Fri Apr 26 16:17:35 2019 +0200
Branches: master
https://developer.blender.org/rBd4827cfa81214f095f4d6a0e644bc2f8328fa77c

Fix T58966 Sculpted changes dissapear visually when selecting a second object

Display sculpt mesh if there is a sculpt session.

===================================================================

M       source/blender/draw/engines/eevee/eevee_materials.c
M       source/blender/draw/engines/workbench/workbench_deferred.c
M       source/blender/draw/engines/workbench/workbench_forward.c
M       source/blender/draw/modes/overlay_mode.c

===================================================================

diff --git a/source/blender/draw/engines/eevee/eevee_materials.c 
b/source/blender/draw/engines/eevee/eevee_materials.c
index 86a87121683..a7eae2e2a41 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -1615,11 +1615,10 @@ 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_active = (ob == draw_ctx->obact);
-  const bool is_sculpt_mode = is_active && (draw_ctx->object_mode & 
OB_MODE_SCULPT) != 0;
+  const bool is_sculpt_mode = (ob->sculpt != NULL);
   /* For now just force fully shaded with eevee when supported. */
-  const bool is_sculpt_mode_draw = is_sculpt_mode &&
-                                   ((ob->sculpt && ob->sculpt->pbvh) &&
-                                    (BKE_pbvh_type(ob->sculpt->pbvh) != 
PBVH_FACES));
+  const bool is_sculpt_mode_draw = ob->sculpt && ob->sculpt->pbvh &&
+                                   BKE_pbvh_type(ob->sculpt->pbvh) != 
PBVH_FACES;
   const bool is_default_mode_shader = is_sculpt_mode;
 
   /* First get materials for this mesh. */
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c 
b/source/blender/draw/engines/workbench/workbench_deferred.c
index efbe33b45da..5d7bdc72546 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 = is_active && (draw_ctx->object_mode & 
OB_MODE_SCULPT) != 0;
+    const bool is_sculpt_mode = (ob->sculpt != NULL);
     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 1117ee0126b..b15131bd9a6 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -566,7 +566,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_active = (ob == draw_ctx->obact);
-    const bool is_sculpt_mode = is_active && (draw_ctx->object_mode & 
OB_MODE_SCULPT) != 0;
+    const bool is_sculpt_mode = (ob->sculpt != NULL);
     bool is_drawn = false;
 
     if (!is_sculpt_mode && TEXTURE_DRAWING_ENABLED(wpd) && ELEM(ob->type, 
OB_MESH)) {
diff --git a/source/blender/draw/modes/overlay_mode.c 
b/source/blender/draw/modes/overlay_mode.c
index 4d583066f44..a0791e4496d 100644
--- a/source/blender/draw/modes/overlay_mode.c
+++ b/source/blender/draw/modes/overlay_mode.c
@@ -360,7 +360,7 @@ static void overlay_cache_populate(void *vedata, Object *ob)
         (((ob != draw_ctx->object_edit) && !is_edit_mode) || 
has_edit_mesh_cage) ||
         ob->type != OB_MESH) {
       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 is_sculpt_mode = (ob->sculpt != NULL);
       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 &&

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to