Fix: Regression: Invert doesn't work with search filter in some UIList

For UILists that doesn't use `filter_items()`, search filter doesn't work
along with invert button. For filter_items, invert case is already
handled in filter_items_by_name. In absense of that function,
handle the invert case inside `UI_list_filter_and_sort_items`. Existing logic
is a bit wrong. Now flags are adjusted, i.e. when search string matches, check
for invert status to decide whether items should be in the list or not.

Pull Request: https://projects.blender.org/blender/blender/pulls/139523
This commit is contained in:
Pratik Borhade
2025-06-18 11:40:43 +02:00
committed by Pratik Borhade
parent 234ff21a7b
commit cf14be7644

View File

@@ -250,14 +250,15 @@ void UI_list_filter_and_sort_items(uiList *ui_list,
dyn_data->items_filter_flags[i] = UILST_FLT_ITEM_NEVER_SHOW;
}
else if (filter_result == UI_LIST_ITEM_FILTER_MATCHES) {
dyn_data->items_filter_flags[i] = UILST_FLT_ITEM;
if (!filter_exclude) {
dyn_data->items_filter_flags[i] = UILST_FLT_ITEM;
dyn_data->items_shown++;
do_order = order_by_name;
}
// printf("%s: '%s' matches '%s'\n", __func__, name, filter);
}
else if (filter_exclude) {
dyn_data->items_filter_flags[i] = UILST_FLT_ITEM;
dyn_data->items_shown++;
do_order = order_by_name;
}