From 9dfc81ccf10153385e8ff744ab2a9e2a25ce6606 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 12 Mar 2021 02:58:02 +1100 Subject: Fix regression in 2cc5af9c553cfc00b7d4616445ad954597a92d94 The check for undo-depth increment/decrement assumed a newly loaded window manager would have a different pointer. This broke bl_animation_fcurves test indirectly, the change to undo-depth caused the redo panel to attempt to popup in background mode - which isn't supported. Now the pointer is unchanged, the undo-depth is assumed to match the value used when calling the operator. The undo-depth is now properly maintained between file loads, which is an improvement on the original behavior which reset it. --- source/blender/windowmanager/intern/wm_files.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/windowmanager/intern/wm_files.c') diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index bd220e2ff95..8357dfd7417 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -311,6 +311,10 @@ static void wm_window_match_replace_by_file_wm(bContext *C, BLI_assert(bmain->relations == NULL); BKE_libblock_remap(bmain, wm, oldwm, ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_USER_CLEAR); + /* Maintain the undo-depth between file loads. Useful so Python can perform + * nested operator calls that exit with the proper undo-depth. */ + wm->op_undo_depth = oldwm->op_undo_depth; + /* Simple pointer swapping step. */ BLI_remlink(current_wm_list, oldwm); BLI_remlink(readfile_wm_list, wm); -- cgit v1.2.3