From 2cd6a89d07e031901291ab95b9a5d6cdeb372bbe Mon Sep 17 00:00:00 2001 From: christian brinkmann <> Date: Thu, 20 Oct 2016 00:27:14 +0200 Subject: Python API: add full_path parameter for bpy.ops.ui.copy_data_path_button. Also use the operator as part of the UI keymap now, to deduplicate code and let users configure a custom shortcut. Reviewed By: brecht Differential Revision: https://developer.blender.org/D2303 --- .../blender/editors/interface/interface_handlers.c | 35 +--------------------- 1 file changed, 1 insertion(+), 34 deletions(-) (limited to 'source/blender/editors/interface/interface_handlers.c') diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 369eba66f32..863f5e3852c 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2218,32 +2218,6 @@ static void ui_but_drop(bContext *C, const wmEvent *event, uiBut *but, uiHandleB /* ******************* copy and paste ******************** */ -static void ui_but_copy_data_path(uiBut *but, const bool full_path) -{ - char *id_path; - - if (but->rnapoin.id.data == NULL) { - return; - } - - if (full_path) { - if (but->rnaprop) { - id_path = RNA_path_full_property_py_ex(&but->rnapoin, but->rnaprop, but->rnaindex, true); - } - else { - id_path = RNA_path_full_struct_py(&but->rnapoin); - } - } - else { - id_path = RNA_path_from_ID_to_property(&but->rnapoin, but->rnaprop); - } - - if (id_path) { - WM_clipboard_text_set(id_path, false); - MEM_freeN(id_path); - } -} - /* c = copy, v = paste */ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, char mode) { @@ -6985,7 +6959,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * if ((data->state == BUTTON_STATE_HIGHLIGHT) || (event->type == EVT_DROP)) { /* handle copy-paste */ if (ELEM(event->type, CKEY, VKEY) && event->val == KM_PRESS && - IS_EVENT_MOD(event, ctrl, oskey)) + IS_EVENT_MOD(event, ctrl, oskey) && !event->shift && !event->alt) { /* Specific handling for listrows, we try to find their overlapping tex button. */ if (but->type == UI_BTYPE_LISTROW) { @@ -6995,13 +6969,6 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * data = but->active; } } - - /* special case, copy-data-path */ - if ((event->type == CKEY) && event->shift) { - ui_but_copy_data_path(but, event->alt != 0); - return WM_UI_HANDLER_BREAK; - } - ui_but_copy_paste(C, but, data, (event->type == CKEY) ? 'c' : 'v'); return WM_UI_HANDLER_BREAK; } -- cgit v1.2.3