forked from bartvdbraak/blender
File Browser: Add Ctrl+F shortcut to activate filter textbox
Reviewers: Severin, brecht Differential Revision: https://developer.blender.org/D6941
This commit is contained in:
parent
e0f41d32c9
commit
e8ab0137f8
@ -1846,6 +1846,7 @@ def km_file_browser(params):
|
||||
("file.delete", {"type": 'DEL', "value": 'PRESS'}, None),
|
||||
("file.smoothscroll", {"type": 'TIMER1', "value": 'ANY', "any": True}, None),
|
||||
("file.bookmark_add", {"type": 'B', "value": 'PRESS', "ctrl": True}, None),
|
||||
("file.start_filter", {"type": 'F', "value": 'PRESS', "ctrl": True}, None),
|
||||
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS'},
|
||||
{"properties": [("increment", 1)]}),
|
||||
("file.filenum", {"type": 'NUMPAD_PLUS', "value": 'PRESS', "shift": True},
|
||||
|
@ -8432,7 +8432,10 @@ void ui_but_activate_event(bContext *C, ARegion *ar, uiBut *but)
|
||||
event.customdata = but;
|
||||
event.customdatafree = false;
|
||||
|
||||
ARegion *old_ar = CTX_wm_region(C);
|
||||
CTX_wm_region_set(C, ar);
|
||||
ui_do_button(C, but->block, but, &event);
|
||||
CTX_wm_region_set(C, old_ar);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,6 +80,7 @@ void FILE_OT_delete(struct wmOperatorType *ot);
|
||||
void FILE_OT_rename(struct wmOperatorType *ot);
|
||||
void FILE_OT_smoothscroll(struct wmOperatorType *ot);
|
||||
void FILE_OT_filepath_drop(struct wmOperatorType *ot);
|
||||
void FILE_OT_start_filter(struct wmOperatorType *ot);
|
||||
|
||||
int file_exec(bContext *C, struct wmOperator *exec_op);
|
||||
int file_cancel_exec(bContext *C, struct wmOperator *unused);
|
||||
|
@ -2542,6 +2542,28 @@ void FILE_OT_delete(struct wmOperatorType *ot)
|
||||
ot->poll = file_delete_poll; /* <- important, handler is on window level */
|
||||
}
|
||||
|
||||
static int file_start_filter_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
|
||||
SpaceFile *sf = CTX_wm_space_file(C);
|
||||
|
||||
UI_textbutton_activate_rna(C, ar, sf->params, "filter_search");
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void FILE_OT_start_filter(struct wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name = "Filter";
|
||||
ot->description = "Start entering filter text";
|
||||
ot->idname = "FILE_OT_start_filter";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = file_start_filter_exec;
|
||||
ot->poll = ED_operator_file_active;
|
||||
}
|
||||
|
||||
void ED_operatormacros_file(void)
|
||||
{
|
||||
// wmOperatorType *ot;
|
||||
|
@ -541,6 +541,7 @@ static void file_operatortypes(void)
|
||||
WM_operatortype_append(FILE_OT_rename);
|
||||
WM_operatortype_append(FILE_OT_smoothscroll);
|
||||
WM_operatortype_append(FILE_OT_filepath_drop);
|
||||
WM_operatortype_append(FILE_OT_start_filter);
|
||||
}
|
||||
|
||||
/* NOTE: do not add .blend file reading on this level */
|
||||
|
Loading…
Reference in New Issue
Block a user