diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2016-09-21 23:20:24 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2016-09-21 23:20:24 +0300 |
commit | e9bcdcdbbd91d93b1c00e05226818448d9f9b60f (patch) | |
tree | 0053838fa44932fbde17089cc266fe8976432d02 /source/blender/editors/interface/interface_handlers.c | |
parent | f6c09eadf06161d185835757afbf40c6512cc7cc (diff) |
UI: Make eyedropper shortcut configurable
It's now possible to change the shortcut for invoking the eyedropper while hovering a button (E by default). Also removed the keymap editor entry for the modal eyedropper keymap, it's now automatically appended to the eyedropper shortcut.
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c40260a8454..369eba66f32 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -6979,6 +6979,9 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * /* if but->pointype is set, but->poin should be too */ BLI_assert(!but->pointype || but->poin); + /* Only hard-coded stuff here, button interactions with configurable + * keymaps are handled using operators (see #ED_keymap_ui). */ + if ((data->state == BUTTON_STATE_HIGHLIGHT) || (event->type == EVT_DROP)) { /* handle copy-paste */ if (ELEM(event->type, CKEY, VKEY) && event->val == KM_PRESS && @@ -7006,40 +7009,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * else if (event->type == EVT_DROP) { ui_but_drop(C, event, but, data); } - /* handle eyedropper */ - else if ((event->type == EKEY) && (event->val == KM_PRESS)) { - if (IS_EVENT_MOD(event, shift, ctrl, alt, oskey)) { - /* pass */ - } - else { - if (but->type == UI_BTYPE_COLOR) { - WM_operator_name_call(C, "UI_OT_eyedropper_color", WM_OP_INVOKE_DEFAULT, NULL); - return WM_UI_HANDLER_BREAK; - } - else if ((but->type == UI_BTYPE_SEARCH_MENU) && - (but->flag & UI_BUT_SEARCH_UNLINK)) - { - if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_POINTER) { - StructRNA *type = RNA_property_pointer_type(&but->rnapoin, but->rnaprop); - const short idcode = RNA_type_to_ID_code(type); - if ((idcode == ID_OB) || OB_DATA_SUPPORT_ID(idcode)) { - WM_operator_name_call(C, "UI_OT_eyedropper_id", WM_OP_INVOKE_DEFAULT, NULL); - return WM_UI_HANDLER_BREAK; - } - } - } - else if (but->type == UI_BTYPE_NUM) { - if (but->rnaprop && - (RNA_property_type(but->rnaprop) == PROP_FLOAT) && - (RNA_property_subtype(but->rnaprop) & PROP_UNIT_LENGTH) && - (RNA_property_array_check(but->rnaprop) == false)) - { - WM_operator_name_call(C, "UI_OT_eyedropper_depth", WM_OP_INVOKE_DEFAULT, NULL); - return WM_UI_HANDLER_BREAK; - } - } - } - } /* handle menu */ else if ((event->type == RIGHTMOUSE) && !IS_EVENT_MOD(event, shift, ctrl, alt, oskey) && |