diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-18 15:15:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-18 16:25:55 +0300 |
commit | 985712e5ee178789dbdf9124a896252db042ba50 (patch) | |
tree | 3362fd14f079071fa12ba9404105a96ba90c13df /source/blender/editors/sculpt_paint/sculpt.c | |
parent | c8067a555932b122b9495dacbac86992a5ff1a8e (diff) |
Fix loading a file saved w/ dyntopo
Ensure ED_editors_init doesn't create any undo steps
before the initial memfile undo is written.
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index e315f88836a..e72b5490f8a 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -5739,11 +5739,18 @@ void ED_object_sculptmode_enter_ex( } if (message_unsupported == NULL) { + /* Needed because we may be entering this mode before the undo system loads. */ + wmWindowManager *wm = bmain->wm.first; + bool has_undo = wm->undo_stack != NULL; /* undo push is needed to prevent memory leak */ - sculpt_undo_push_begin("Dynamic topology enable"); + if (has_undo) { + sculpt_undo_push_begin("Dynamic topology enable"); + } sculpt_dynamic_topology_enable_ex(depsgraph, scene, ob); - sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN); - sculpt_undo_push_end(); + if (has_undo) { + sculpt_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN); + sculpt_undo_push_end(); + } } else { BKE_reportf(reports, RPT_WARNING, |