Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-11-07 08:52:03 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-11-07 08:56:21 +0300
commit79b703bb635ea719bbe31c1ece9884d2d298eaef (patch)
tree7ee7e896e8e66233f85dd425708a595f66607f48 /source/blender/editors/undo
parent85637311c28f49b55286d3287d4c7cefbcbca18a (diff)
Fix T69822: Switching sculpt objects breaks undo
This introduces object mode tagging for data which hasn't yet been written back to the ID data. Now when selecting other sculpt objects, the original objects data is flushed back to the ID before writing a memfile undo step.
Diffstat (limited to 'source/blender/editors/undo')
-rw-r--r--source/blender/editors/undo/ed_undo.c2
-rw-r--r--source/blender/editors/undo/memfile_undo.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c
index 315a4c73e5f..9770b52158a 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -322,7 +322,7 @@ bool ED_undo_is_memfile_compatible(const bContext *C)
if (view_layer != NULL) {
Object *obact = OBACT(view_layer);
if (obact != NULL) {
- if (obact->mode & (OB_MODE_SCULPT | OB_MODE_EDIT)) {
+ if (obact->mode & OB_MODE_EDIT) {
return false;
}
}
diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c
index f3e2ee92558..a5f30409aa6 100644
--- a/source/blender/editors/undo/memfile_undo.c
+++ b/source/blender/editors/undo/memfile_undo.c
@@ -28,6 +28,7 @@
#include "BKE_blender_undo.h"
#include "BKE_context.h"
#include "BKE_undo_system.h"
+#include "BKE_main.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -74,6 +75,10 @@ static bool memfile_undosys_step_encode(struct bContext *UNUSED(C),
/* Important we only use 'main' from the context (see: BKE_undosys_stack_init_from_main). */
UndoStack *ustack = ED_undo_stack_get();
+ if (bmain->is_memfile_undo_flush_needed) {
+ ED_editors_flush_edits_ex(bmain, false, true);
+ }
+
/* can be NULL, use when set. */
MemFileUndoStep *us_prev = (MemFileUndoStep *)BKE_undosys_step_find_by_type(
ustack, BKE_UNDOSYS_TYPE_MEMFILE);