Fix #127434: copying node does not work in many cases

The issue was that the ctrl+C event was consumed by a uiBut that did not even support copying.
The old behavior was broken in 749433f20b.

Pull Request: https://projects.blender.org/blender/blender/pulls/127460
This commit is contained in:
Jacques Lucke
2024-09-12 14:21:33 +02:00
parent c07c9d5729
commit 2ca5a65add

View File

@@ -2767,10 +2767,11 @@ static bool ui_but_copy_popover(uiBut *but, char *output, int output_maxncpy)
return false;
}
static void ui_but_copy(bContext *C, uiBut *but, const bool copy_array)
/** Returns true if any data was copied. */
static bool ui_but_copy(bContext *C, uiBut *but, const bool copy_array)
{
if (ui_but_contains_password(but)) {
return;
return false;
}
/* Arbitrary large value (allow for paths: 'PATH_MAX') */
@@ -2861,6 +2862,7 @@ static void ui_but_copy(bContext *C, uiBut *but, const bool copy_array)
if (is_buf_set) {
WM_clipboard_text_set(buf, false);
}
return is_buf_set;
}
static void ui_but_paste(bContext *C, uiBut *but, uiHandleButtonData *data, const bool paste_array)
@@ -8142,8 +8144,9 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
/* do copy first, because it is the only allowed operator when disabled */
if (do_copy) {
ui_but_copy(C, but, event->modifier & KM_ALT);
return WM_UI_HANDLER_BREAK;
if (ui_but_copy(C, but, event->modifier & KM_ALT)) {
return WM_UI_HANDLER_BREAK;
}
}
/* handle menu */