Refactor: Separate template selection from read_homefile operator
This is a first step towards T61599. This way the invoke function can be used for the confirm dialog in a separate patch. Reviewers: campbellbarton Differential Revision: https://developer.blender.org/D4723
This commit is contained in:
parent
8955ec6776
commit
cfe9c7b3bd
|
@ -326,7 +326,7 @@ def km_window(params):
|
|||
if params.apple:
|
||||
# Apple standard shortcuts. Cmd+F for search since F-keys are not easy to use.
|
||||
items.extend([
|
||||
("wm.read_homefile", {"type": 'N', "value": 'PRESS', "oskey": True}, None),
|
||||
op_menu("TOPBAR_MT_file_new", {"type": 'N', "value": 'PRESS', "oskey": True}),
|
||||
op_menu("TOPBAR_MT_file_open_recent", {"type": 'O', "value": 'PRESS', "shift": True, "oskey": True}),
|
||||
("wm.open_mainfile", {"type": 'O', "value": 'PRESS', "oskey": True}, None),
|
||||
("wm.save_mainfile", {"type": 'S', "value": 'PRESS', "oskey": True}, None),
|
||||
|
@ -356,7 +356,7 @@ def km_window(params):
|
|||
|
||||
items.extend([
|
||||
# File operations
|
||||
("wm.read_homefile", {"type": 'N', "value": 'PRESS', "ctrl": True}, None),
|
||||
op_menu("TOPBAR_MT_file_new", {"type": 'N', "value": 'PRESS', "ctrl": True}),
|
||||
op_menu("TOPBAR_MT_file_open_recent", {"type": 'O', "value": 'PRESS', "shift": True, "ctrl": True}),
|
||||
("wm.open_mainfile", {"type": 'O', "value": 'PRESS', "ctrl": True}, None),
|
||||
("wm.save_mainfile", {"type": 'S', "value": 'PRESS', "ctrl": True}, None),
|
||||
|
|
|
@ -1846,24 +1846,6 @@ static int wm_homefile_read_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int wm_homefile_read_invoke(bContext *C,
|
||||
wmOperator *UNUSED(op),
|
||||
const wmEvent *UNUSED(event))
|
||||
{
|
||||
/* Draw menu which includes default startup and application templates. */
|
||||
uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("New File"), ICON_FILE_NEW);
|
||||
uiLayout *layout = UI_popup_menu_layout(pup);
|
||||
|
||||
MenuType *mt = WM_menutype_find("TOPBAR_MT_file_new", false);
|
||||
if (mt) {
|
||||
UI_menutype_draw(C, mt, layout);
|
||||
}
|
||||
|
||||
UI_popup_menu_end(C, pup);
|
||||
|
||||
return OPERATOR_INTERFACE;
|
||||
}
|
||||
|
||||
void WM_OT_read_homefile(wmOperatorType *ot)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
@ -1871,7 +1853,6 @@ void WM_OT_read_homefile(wmOperatorType *ot)
|
|||
ot->idname = "WM_OT_read_homefile";
|
||||
ot->description = "Open the default file (doesn't save the current file)";
|
||||
|
||||
ot->invoke = wm_homefile_read_invoke;
|
||||
ot->exec = wm_homefile_read_exec;
|
||||
|
||||
prop = RNA_def_string_file_path(
|
||||
|
|
Loading…
Reference in New Issue