diff options
author | Alexander Romanov <a.romanov@blend4web.com> | 2017-04-13 13:02:39 +0300 |
---|---|---|
committer | Alexander Romanov <a.romanov@blend4web.com> | 2017-04-13 13:02:39 +0300 |
commit | 6f268ac55d834ca9ba098b321dc101fbba93d773 (patch) | |
tree | 6a18624d0c7940af708c69103322fdcaaf5126fc /source/blender/editors/interface/interface_regions.c | |
parent | 0a62e971b2413dee218f43e8ba01b14c3a005b7f (diff) | |
parent | f5bc8ad4ce87165fc0648f1cd8c0ae1fb5f07281 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/interface/interface_regions.c')
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index c5557a400ae..6ec0c39a76d 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -813,11 +813,11 @@ int UI_searchbox_size_x(void) return 12 * UI_UNIT_X; } -int UI_search_items_find_index(uiSearchItems *items, const char *name) +int UI_search_items_find_index(uiSearchItems *items, const char *name, const size_t offset) { int i; for (i = 0; i < items->totitem; i++) { - if (STREQ(name, items->names[i])) { + if (STREQ(name, items->names[i] + offset)) { return i; } } @@ -896,7 +896,7 @@ static void ui_searchbox_butrect(rcti *r_rect, uiSearchboxData *data, int itemnr int ui_searchbox_find_index(ARegion *ar, const char *name) { uiSearchboxData *data = ar->regiondata; - return UI_search_items_find_index(&data->items, name); + return UI_search_items_find_index(&data->items, name, 0); } /* x and y in screencoords */ @@ -1425,14 +1425,14 @@ void ui_searchbox_free(bContext *C, ARegion *ar) /* sets red alert if button holds a string it can't find */ /* XXX weak: search_func adds all partial matches... */ -void ui_but_search_refresh(uiBut *but) +void ui_but_search_refresh(uiBut *but, const bool is_template_ID) { uiSearchItems *items; int x1; - /* possibly very large lists (such as ID datablocks) only - * only validate string RNA buts (not pointers) */ - if (but->rnaprop && RNA_property_type(but->rnaprop) != PROP_STRING) { + /* possibly very large lists (such as ID datablocks), + * only validate string and pointer RNA buts */ + if (but->rnaprop && !ELEM(RNA_property_type(but->rnaprop), PROP_STRING, PROP_POINTER)) { return; } @@ -1452,7 +1452,8 @@ void ui_but_search_refresh(uiBut *but) UI_but_flag_enable(but, UI_BUT_REDALERT); } else if (items->more == 0) { - if (UI_search_items_find_index(items, but->drawstr) == -1) { + const size_t offset = is_template_ID ? 3 : 0; + if (UI_search_items_find_index(items, but->drawstr, offset) == -1) { UI_but_flag_enable(but, UI_BUT_REDALERT); } } |