diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-05-14 15:13:02 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-05-14 15:21:17 +0300 |
commit | 687385b963f4389b3d714fed264bb0ff24bc43f5 (patch) | |
tree | b45b5c6492361425533230e4267e848d7c383715 /release | |
parent | 37f87ae81bc31134cf985277d877afb7b922dbbc (diff) |
UI: Confirm dialog when closing an unsaved file
The complexity in this patch comes from the fact
that the current operator system does not support
multi-step user interactions well.
More specifically, for this to work, we need to show
a confirm dialog and a file browser afterwards.
We decided that it is easier to keep everything in
a single operator, instead of creating separate
operators that invoke each other.
So, now the `WM_OT_open_mainfile` operator invokes
itself in different states. It implements a simple
finite state machine to manage the states.
The dialog itself is expected to be improved in
a future commit. See D4829 for more details.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D4829
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 85f4f89d01e..0788e3bc51c 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1747,8 +1747,10 @@ class WM_OT_drop_blend_file(Operator): layout = menu.layout col = layout.column() - col.operator_context = 'EXEC_DEFAULT' - col.operator("wm.open_mainfile", text="Open", icon='FILE_FOLDER').filepath = self.filepath + col.operator_context = 'INVOKE_DEFAULT' + props = col.operator("wm.open_mainfile", text="Open", icon='FILE_FOLDER') + props.filepath = self.filepath + props.display_file_selector = False layout.separator() col = layout.column() |