Fix #116011: Sorting Attributes by Name in UILists does not work

Whenever custom `filter_items` is used, everything regarding filtering
and sorting has to be implemented "by hand" here, this was just not done
for the sorting (which is now added).

Pull Request: https://projects.blender.org/blender/blender/pulls/116629
This commit is contained in:
Philipp Oeser
2024-01-09 09:26:06 +01:00
committed by Philipp Oeser
parent 71af74622f
commit fb90654964
3 changed files with 16 additions and 0 deletions

View File

@@ -112,6 +112,10 @@ class CURVES_UL_attributes(UIList):
for idx, item in enumerate(attributes):
flags[idx] = 0 if item.is_internal else flags[idx]
# Reorder by name.
if self.use_filter_sort_alpha:
indices = bpy.types.UI_UL_list.sort_items_by_name(attributes, "name")
return flags, indices
def draw_item(self, _context, layout, _data, attribute, _icon, _active_data, _active_propname, _index):

View File

@@ -495,6 +495,10 @@ class MESH_UL_attributes(UIList):
for idx, item in enumerate(attributes):
flags[idx] = 0 if item.is_internal else flags[idx]
# Reorder by name.
if self.use_filter_sort_alpha:
indices = bpy.types.UI_UL_list.sort_items_by_name(attributes, "name")
return flags, indices
def draw_item(self, _context, layout, _data, attribute, _icon, _active_data, _active_propname, _index):
@@ -609,6 +613,10 @@ class ColorAttributesListBase():
)
flags[idx] = 0 if skip else flags[idx]
# Reorder by name.
if self.use_filter_sort_alpha:
indices = bpy.types.UI_UL_list.sort_items_by_name(attributes, "name")
return flags, indices

View File

@@ -89,6 +89,10 @@ class POINTCLOUD_UL_attributes(UIList):
for idx, item in enumerate(attributes):
flags[idx] = 0 if item.is_internal else flags[idx]
# Reorder by name.
if self.use_filter_sort_alpha:
indices = bpy.types.UI_UL_list.sort_items_by_name(attributes, "name")
return flags, indices
def draw_item(self, _context, layout, _data, attribute, _icon, _active_data, _active_propname, _index):