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/util/ed_util.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/util/ed_util.c')
-rw-r--r--source/blender/editors/util/ed_util.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index f5548119e0a..1a33b50ff10 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -230,7 +230,7 @@ void ED_editors_exit(Main *bmain, bool do_undo_system)
/* flush any temp data from object editing to DNA before writing files,
* rendering, copying, etc. */
-bool ED_editors_flush_edits(Main *bmain, bool for_render)
+bool ED_editors_flush_edits_ex(Main *bmain, bool for_render, bool check_needs_flush)
{
bool has_edited = false;
Object *ob;
@@ -244,6 +244,15 @@ bool ED_editors_flush_edits(Main *bmain, bool for_render)
* Auto-save prevents this from happening but scripts
* may cause a flush on saving: T53986. */
if ((ob->sculpt && ob->sculpt->cache) == 0) {
+
+ {
+ char *needs_flush_ptr = &ob->sculpt->needs_flush_to_id;
+ if (check_needs_flush && (*needs_flush_ptr == 0)) {
+ continue;
+ }
+ *needs_flush_ptr = 0;
+ }
+
/* flush multires changes (for sculpt) */
multires_flush_sculpt_updates(ob);
has_edited = true;
@@ -260,15 +269,31 @@ bool ED_editors_flush_edits(Main *bmain, bool for_render)
}
}
else if (ob->mode & OB_MODE_EDIT) {
+
+ char *needs_flush_ptr = BKE_object_data_editmode_flush_ptr_get(ob->data);
+ if (needs_flush_ptr != NULL) {
+ if (check_needs_flush && (*needs_flush_ptr == 0)) {
+ continue;
+ }
+ *needs_flush_ptr = 0;
+ }
+
/* get editmode results */
has_edited = true;
ED_object_editmode_load(bmain, ob);
}
}
+ bmain->is_memfile_undo_flush_needed = false;
+
return has_edited;
}
+bool ED_editors_flush_edits(Main *bmain, bool for_render)
+{
+ return ED_editors_flush_edits_ex(bmain, for_render, false);
+}
+
/* ***** XXX: functions are using old blender names, cleanup later ***** */
/* now only used in 2d spaces, like time, ipo, nla, sima... */