diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_undo.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_undo.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 287e1eb03d1..f4f30c903aa 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -55,7 +55,7 @@ #include "BKE_subsurf.h" #include "BKE_undo_system.h" -// XXX: Ideally should be no direct call to such low level things. +/* XXX: Ideally should be no direct call to such low level things. */ #include "BKE_subdiv_eval.h" #include "DEG_depsgraph.h" @@ -239,7 +239,7 @@ static bool sculpt_undo_restore_coords(bContext *C, Depsgraph *depsgraph, Sculpt /* Propagate new coords to keyblock. */ SCULPT_vertcos_to_key(ob, ss->shapekey_active, vertCos); - /* PBVH uses it's own mvert array, so coords should be */ + /* PBVH uses its own mvert array, so coords should be */ /* propagated to PBVH here. */ BKE_pbvh_vert_coords_apply(ss->pbvh, vertCos, ss->shapekey_active->totelem); @@ -647,7 +647,7 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase BKE_sculpt_update_object_for_edit(depsgraph, ob, true, need_mask, false); - SCULPT_visibility_sync_all_face_sets_to_vertices(ss); + SCULPT_visibility_sync_all_face_sets_to_vertices(ob); BKE_pbvh_update_vertex_data(ss->pbvh, PBVH_UpdateVisibility); @@ -1477,8 +1477,6 @@ static void sculpt_undosys_step_decode( { Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); - /* Sculpt needs evaluated state. */ - BKE_scene_view_layer_graph_evaluated_ensure(bmain, scene, view_layer); Object *ob = OBACT(view_layer); if (ob && (ob->type == OB_MESH)) { if (ob->mode & OB_MODE_SCULPT) { @@ -1486,6 +1484,12 @@ static void sculpt_undosys_step_decode( } else { ED_object_mode_generic_exit(bmain, depsgraph, scene, ob); + + /* Sculpt needs evaluated state. + * Note: needs to be done here, as #ED_object_mode_generic_exit will usually invalidate + * (some) evaluated data. */ + BKE_scene_graph_evaluated_ensure(depsgraph, bmain); + Mesh *me = ob->data; /* Don't add sculpt topology undo steps when reading back undo state. * The undo steps must enter/exit for us. */ |