diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 6dcee242f1e..d90135001c4 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2594,8 +2594,19 @@ bool ui_but_string_set(bContext *C, uiBut *but, const char *str) PointerRNA ptr = but->rnasearchpoin; PropertyRNA *prop = but->rnasearchprop; - if (prop && RNA_property_collection_lookup_string(&ptr, prop, str, &rptr)) + /* This is kind of hackish, in theory think we could only ever use the second member of + * this if/else, since ui_searchbox_apply() is supposed to always set that pointer when + * we are storing pointers... But keeping str search first for now, to try to break as little as + * possible existing code. All this is band-aids anyway. + * Fact remains, using editstr as main 'reference' over whole search button thingy is utterly weak + * and should be redesigned imho, but that's not a simple task. */ + if (prop && RNA_property_collection_lookup_string(&ptr, prop, str, &rptr)) { RNA_property_pointer_set(&but->rnapoin, but->rnaprop, rptr); + } + else if (but->func_arg2 != NULL) { + RNA_pointer_create(NULL, RNA_property_pointer_type(&but->rnapoin, but->rnaprop), but->func_arg2, &rptr); + RNA_property_pointer_set(&but->rnapoin, but->rnaprop, rptr); + } return true; }