Page Menu
Home
Search
Configure Global Search
Log In
Paste
P2060
UI code hack for D10623
Active
Public
Actions
Authored by
Hans Goudey (HooglyBoogly)
on Apr 8 2021, 10:25 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Tags
None
Subscribers
None
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index dfe0898a85b..61a7bc03eb0 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -209,6 +209,8 @@ enum {
UI_BUT_IMMEDIATE = 1 << 20,
UI_BUT_NO_UTF8 = 1 << 21,
+ UI_BUT_NEW_ARG1 = 1 << 22,
+
/** For popups, pressing return activates this button, overriding the highlighted button.
* For non-popups this is just used as a display hint for the user to let them
* know the action which is activated when pressing return (file selector for eg). */
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 6caee42ac33..208a37c4282 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -705,7 +705,8 @@ static bool ui_but_equals_old(const uiBut *but, const uiBut *oldbut)
if (but->funcN != oldbut->funcN) {
return false;
}
- if (!ELEM(oldbut->func_arg1, oldbut, but->func_arg1)) {
+ if ((but->flag & UI_BUT_NEW_ARG1) == 0 && (oldbut->flag & UI_BUT_NEW_ARG1) == 0 &&
+ !ELEM(oldbut->func_arg1, oldbut, but->func_arg1)) {
return false;
}
if (!ELEM(oldbut->func_arg2, oldbut, but->func_arg2)) {
@@ -823,6 +824,7 @@ static void ui_but_update_old_active_from_new(uiBut *oldbut, uiBut *but)
SWAP(uiButSearchArgFreeFn, search_oldbut->arg_free_fn, search_but->arg_free_fn);
SWAP(void *, search_oldbut->arg, search_but->arg);
+ SWAP(void *, oldbut->func_arg1, but->func_arg1);
}
/* copy hardmin for list rows to prevent 'sticking' highlight to mouse position
diff --git a/source/blender/editors/space_node/node_geometry_attribute_search.cc b/source/blender/editors/space_node/node_geometry_attribute_search.cc
index 8981ea18e55..beda07c9efd 100644
--- a/source/blender/editors/space_node/node_geometry_attribute_search.cc
+++ b/source/blender/editors/space_node/node_geometry_attribute_search.cc
@@ -196,4 +196,5 @@ void node_geometry_add_attribute_search_button(const bNodeTree *node_tree,
attribute_search_free_fn,
attribute_search_exec_fn,
nullptr);
+ UI_but_flag_enable(but, UI_BUT_NEW_ARG1);
}
Event Timeline
Hans Goudey (HooglyBoogly)
created this paste.
Apr 8 2021, 10:25 PM
Hans Goudey (HooglyBoogly)
changed the title of this paste from
Command-Line Input
to
UI code hack for D10623
.
Apr 8 2021, 10:26 PM
Hans Goudey (HooglyBoogly)
updated the paste's language from
autodetect
to
diff
.
Hans Goudey (HooglyBoogly)
mentioned this in
D10623: Geometry Nodes: Add domain and data type to attribute search
.
Log In to Comment