From ba36b848eb670d29a797faceebfea77efee5fc9c Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Tue, 19 Jan 2010 03:59:05 +0000 Subject: Added new macro "file.select_execute", by default mapped to LMB doubleclick in file selector. This selects+opens the file under the mouse pointer, can be customised. This somewhat fixes [#20727] MMB don't load .blend from the file browser --- source/blender/editors/include/ED_fileselect.h | 1 + source/blender/editors/space_api/spacetypes.c | 2 ++ source/blender/editors/space_file/file_ops.c | 12 +++++++++++- source/blender/editors/space_file/space_file.c | 5 +++-- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index 221b377dd25..24a846a53a7 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -86,6 +86,7 @@ int ED_fileselect_layout_offset(FileLayout* layout, int x, int y); void ED_fileselect_layout_tilepos(FileLayout* layout, int tile, int *x, int *y); +void ED_operatormacros_file(void); #endif /* ED_FILES_H */ diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 90457c05fa7..c1fec6cd1de 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -42,6 +42,7 @@ #include "ED_anim_api.h" #include "ED_armature.h" #include "ED_curve.h" +#include "ED_fileselect.h" #include "ED_gpencil.h" #include "ED_markers.h" #include "ED_mesh.h" @@ -115,6 +116,7 @@ void ED_spacetypes_init(void) ED_operatormacros_mesh(); ED_operatormacros_node(); ED_operatormacros_object(); + ED_operatormacros_file(); } /* called in wm.c */ diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 8fe1ddd636d..85068200878 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -567,7 +567,7 @@ int file_exec(bContext *C, wmOperator *unused) if(sfile->op) { wmOperator *op= sfile->op; - + sfile->op = NULL; RNA_string_set(op->ptr, "filename", sfile->params->file); BLI_strncpy(name, sfile->params->dir, sizeof(name)); @@ -1090,3 +1090,13 @@ void FILE_OT_delete(struct wmOperatorType *ot) ot->poll= file_delete_poll; /* <- important, handler is on window level */ } + +void ED_operatormacros_file(void) +{ + wmOperatorType *ot; + + ot= WM_operatortype_append_macro("FILE_OT_select_execute", "Select and Execute", OPTYPE_UNDO|OPTYPE_REGISTER); + WM_operatortype_macro_define(ot, "FILE_OT_select"); + WM_operatortype_macro_define(ot, "FILE_OT_execute"); + +} diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index e0915010e16..bf18c938a8a 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -381,8 +381,9 @@ void file_keymap(struct wmKeyConfig *keyconf) /* keys for main area */ keymap= WM_keymap_find(keyconf, "File Browser Main", SPACE_FILE, 0); - WM_keymap_add_item(keymap, "FILE_OT_select", LEFTMOUSE, KM_PRESS, 0, 0); - kmi = WM_keymap_add_item(keymap, "FILE_OT_select", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_item(keymap, "FILE_OT_select_execute", LEFTMOUSE, KM_DBL_CLICK, 0, 0); + WM_keymap_add_item(keymap, "FILE_OT_select", LEFTMOUSE, KM_CLICK, 0, 0); + kmi = WM_keymap_add_item(keymap, "FILE_OT_select", LEFTMOUSE, KM_CLICK, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "extend", 1); WM_keymap_add_item(keymap, "FILE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "FILE_OT_select_border", BKEY, KM_PRESS, 0, 0); -- cgit v1.2.3