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
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user