Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-03-24 02:50:01 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-03-24 02:52:23 +0300
commit809101e69e98713ff04d3afbc7f92d530b7eec40 (patch)
tree1b0fd7ef058cb198c5a07904250e8bafa00e6be0 /source/blender
parent72c323d50c290a91414a3363647f45b5444c4e66 (diff)
UI: support Ctrl-C copy for popover buttons
Match menu logic that sets the Python expression to call the popover.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/interface/interface_handlers.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index f859df558ca..212a1742c70 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -2328,12 +2328,24 @@ static void ui_but_copy_operator(bContext *C, uiBut *but, char *output, int outp
MEM_freeN(str);
}
-static void ui_but_copy_menu(uiBut *but, char *output, int output_len_max)
+static bool ui_but_copy_menu(uiBut *but, char *output, int output_len_max)
{
MenuType *mt = UI_but_menutype_get(but);
if (mt) {
BLI_snprintf(output, output_len_max, "bpy.ops.wm.call_menu(name=\"%s\")", mt->idname);
+ return true;
}
+ return false;
+}
+
+static bool ui_but_copy_popover(uiBut *but, char *output, int output_len_max)
+{
+ PanelType *pt = UI_but_paneltype_get(but);
+ if (pt) {
+ BLI_snprintf(output, output_len_max, "bpy.ops.wm.call_panel(name=\"%s\")", pt->idname);
+ return true;
+ }
+ return false;
}
static void ui_but_copy(bContext *C, uiBut *but, const bool copy_array)
@@ -2398,8 +2410,14 @@ static void ui_but_copy(bContext *C, uiBut *but, const bool copy_array)
case UI_BTYPE_MENU:
case UI_BTYPE_PULLDOWN:
- ui_but_copy_menu(but, buf, buf_max_len);
- is_buf_set = true;
+ if (ui_but_copy_menu(but, buf, buf_max_len)) {
+ is_buf_set = true;
+ }
+ break;
+ case UI_BTYPE_POPOVER:
+ if (ui_but_copy_popover(but, buf, buf_max_len)) {
+ is_buf_set = true;
+ }
break;
default: