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/metaball/editmball_undo.c
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/metaball/editmball_undo.c')
-rw-r--r--source/blender/editors/metaball/editmball_undo.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/source/blender/editors/metaball/editmball_undo.c b/source/blender/editors/metaball/editmball_undo.c
index 9a95560ccdd..e8700e94e91 100644
--- a/source/blender/editors/metaball/editmball_undo.c
+++ b/source/blender/editors/metaball/editmball_undo.c
@@ -35,6 +35,7 @@
#include "BKE_context.h"
#include "BKE_layer.h"
+#include "BKE_main.h"
#include "BKE_undo_system.h"
#include "DEG_depsgraph.h"
@@ -153,9 +154,7 @@ static bool mball_undosys_poll(bContext *C)
return editmball_object_from_context(C) != NULL;
}
-static bool mball_undosys_step_encode(struct bContext *C,
- struct Main *UNUSED(bmain),
- UndoStep *us_p)
+static bool mball_undosys_step_encode(struct bContext *C, struct Main *bmain, UndoStep *us_p)
{
MBallUndoStep *us = (MBallUndoStep *)us_p;
@@ -176,17 +175,18 @@ static bool mball_undosys_step_encode(struct bContext *C,
elem->obedit_ref.ptr = ob;
MetaBall *mb = ob->data;
editmball_from_undomball(&elem->data, mb);
+ mb->needs_flush_to_id = 1;
us->step.data_size += elem->data.undo_size;
}
MEM_freeN(objects);
+
+ bmain->is_memfile_undo_flush_needed = true;
+
return true;
}
-static void mball_undosys_step_decode(struct bContext *C,
- struct Main *UNUSED(bmain),
- UndoStep *us_p,
- int UNUSED(dir),
- bool UNUSED(is_final))
+static void mball_undosys_step_decode(
+ struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir), bool UNUSED(is_final))
{
MBallUndoStep *us = (MBallUndoStep *)us_p;
@@ -209,6 +209,7 @@ static void mball_undosys_step_decode(struct bContext *C,
continue;
}
undomball_to_editmball(&elem->data, mb);
+ mb->needs_flush_to_id = 1;
DEG_id_tag_update(&obedit->id, ID_RECALC_GEOMETRY);
}
@@ -216,6 +217,8 @@ static void mball_undosys_step_decode(struct bContext *C,
ED_undo_object_set_active_or_warn(
CTX_data_view_layer(C), us->elems[0].obedit_ref.ptr, us_p->name, &LOG);
+ bmain->is_memfile_undo_flush_needed = true;
+
WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL);
}