Page MenuHome
Paste P1043

Fix T66325 (re-evaluate depsgraph on undo load)
ActivePublic

Authored by Campbell Barton (campbellbarton) on Jul 19 2019, 8:06 AM.
diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c
index f3e2ee92558..fee3713f97d 100644
--- a/source/blender/editors/undo/memfile_undo.c
+++ b/source/blender/editors/undo/memfile_undo.c
@@ -104,6 +104,8 @@ static void memfile_undosys_step_decode(
us_iter->is_applied = true;
}
+ WM_event_do_depsgraph_for_undo(C);
+
/* bmain has been freed. */
bmain = CTX_data_main(C);
ED_editors_init_for_undo(bmain);
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 04e3f7e88dc..9bd43bcf633 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -774,6 +774,8 @@ bool WM_event_is_ime_switch(const struct wmEvent *event);
/* For testing only 'G_FLAG_EVENT_SIMULATE' */
struct wmEvent *WM_event_add_simulate(struct wmWindow *win, const struct wmEvent *event_to_add);
+void WM_event_do_depsgraph_for_undo(struct bContext *C);
+
const char *WM_window_cursor_keymap_status_get(const struct wmWindow *win,
int button_index,
int type_index);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 76cb78b1e04..3d5dbb0d567 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -327,16 +327,10 @@ static void wm_notifier_clear(wmNotifier *note)
memset(((char *)note) + sizeof(Link), 0, sizeof(*note) - sizeof(Link));
}
-void wm_event_do_depsgraph(bContext *C, bool is_after_open_file)
+static void wm_event_do_depsgraph_no_interface_lock(bContext *C,
+ wmWindowManager *wm,
+ bool is_after_open_file)
{
- wmWindowManager *wm = CTX_wm_manager(C);
- /* The whole idea of locked interface is to prevent viewport and whatever
- * thread to modify the same data. Because of this, we can not perform
- * dependency graph update.
- */
- if (wm->is_interface_locked) {
- return;
- }
/* Combine datamasks so 1 win doesn't disable UV's in another [#26448]. */
CustomData_MeshMasks win_combine_v3d_datamask = {0};
for (wmWindow *win = wm->windows.first; win; win = win->next) {
@@ -370,6 +364,26 @@ void wm_event_do_depsgraph(bContext *C, bool is_after_open_file)
}
}
+void wm_event_do_depsgraph(bContext *C, bool is_after_open_file)
+{
+ wmWindowManager *wm = CTX_wm_manager(C);
+ /* The whole idea of locked interface is to prevent viewport and whatever
+ * thread to modify the same data. Because of this, we can not perform
+ * dependency graph update.
+ */
+ if (wm->is_interface_locked) {
+ return;
+ }
+
+ wm_event_do_depsgraph_no_interface_lock(C, wm, is_after_open_file);
+}
+
+void WM_event_do_depsgraph_for_undo(bContext *C)
+{
+ wmWindowManager *wm = CTX_wm_manager(C);
+ wm_event_do_depsgraph_no_interface_lock(C, wm, true);
+}
+
/**
* Was part of #wm_event_do_notifiers,
* split out so it can be called once before entering the #WM_main loop.