Fix regression in 2cc5af9c55

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.
This commit is contained in:
Campbell Barton 2021-03-12 02:58:02 +11:00
parent 350ad4bcb1
commit 9dfc81ccf1
1 changed files with 4 additions and 0 deletions

View File

@ -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);