Added new macro "file.select_execute", by default mapped to LMB doubleclick in file...
authorMatt Ebb <matt@mke3.net>
Tue, 19 Jan 2010 03:59:05 +0000 (03:59 +0000)
committerMatt Ebb <matt@mke3.net>
Tue, 19 Jan 2010 03:59:05 +0000 (03:59 +0000)
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
source/blender/editors/space_api/spacetypes.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/space_file.c

index 221b377dd25d701107a305ff358840e3c082ae3e..24a846a53a7c4848f193d4e6574b655743a892f9 100644 (file)
@@ -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 */
 
index 90457c05fa794f8dfff5f9b7ae44fd0d4190435a..c1fec6cd1de08fd932bb3bffb340cba420d25f82 100644 (file)
@@ -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 */
index 8fe1ddd636d00aa8fc4ca8ae2f96c794089d7869..8506820087868fe75893b377810ee17b625fdf95 100644 (file)
@@ -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");
+
+}
index e0915010e16087052425e41a77aa10555e654fc7..bf18c938a8a43715119bfae4feb09b830df757dd 100644 (file)
@@ -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);