BlenderBIM filter Git messages, remove sort #3096

This commit is contained in:
Bruno Postle
2023-07-27 16:35:10 +01:00
parent df699de97d
commit 66d4f04ba2
@@ -211,6 +211,33 @@ class COMMIT_UL_List(bpy.types.UIList):
layout.label(text=refs + commit.message.split("\n")[0], icon="DECORATE_ANIMATE")
layout.label(text=time.strftime("%c", time.localtime(commit.committed_date)))
def draw_filter(self, context, layout):
# We only need filtering and reverse sort, not reordering by name
row = layout.row(align=True)
row.prop(self, "filter_name", text="")
row.prop(self, "use_filter_invert", text="", icon="ARROW_LEFTRIGHT")
row.prop(self, "use_filter_sort_reverse", text="", icon="SORT_DESC")
def filter_items(self, context, data, propname):
commits = getattr(data, propname)
helper_funcs = bpy.types.UI_UL_list
# Default return values.
flt_flags = []
flt_neworder = list(range(len(commits)))
# Filtering by commit message
if self.filter_name:
flt_flags = helper_funcs.filter_items_by_name(
self.filter_name, self.bitflag_filter_item, commits, "message", reverse=False
)
if not flt_flags:
flt_flags = [self.bitflag_filter_item] * len(commits)
return flt_flags, flt_neworder
class IFCGIT_PT_revision_inspector(bpy.types.Panel):
"""Tool panel to interact with revision history"""