diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-18 16:48:00 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-18 16:53:39 +0300 |
commit | 547cb5e264eb1f6b03c7327e1acae6e4f2b0187a (patch) | |
tree | 353bfad695c19dbd55dcc0a303d8a08e6b3bef19 /source/blender/editors/undo/ed_undo.c | |
parent | 985712e5ee178789dbdf9124a896252db042ba50 (diff) |
Fix/workaround: Undo erase all dyntopo changes
Memfile undo isn't compatible with sculpt or edit-mode.
This didn't work in 2.7x, so best disable memfile undo for now in
situations where it's going to loose data or crash.
Diffstat (limited to 'source/blender/editors/undo/ed_undo.c')
-rw-r--r-- | source/blender/editors/undo/ed_undo.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index 09de2998561..337ad1d514a 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -273,6 +273,23 @@ bool ED_undo_is_valid(const bContext *C, const char *undoname) return BKE_undosys_stack_has_undo(wm->undo_stack, undoname); } +bool ED_undo_is_memfile_compatible(const bContext *C) +{ + /* Some modes don't co-exist with memfile undo, disable their use: T60593 + * (this matches 2.7x behavior). */ + ViewLayer *view_layer = CTX_data_view_layer(C); + if (view_layer != NULL) { + Object *obact = OBACT(view_layer); + if (obact != NULL) { + if (obact->mode & (OB_MODE_SCULPT | OB_MODE_EDIT)) { + return false; + } + } + } + return true; +} + + /** * Ideally we wont access the stack directly, * this is needed for modes which handle undo themselves (bypassing #ED_undo_push). |