Alphabeticallysort nodes in node sections
This commit is contained in:
parent
b31c151cf3
commit
2babf2f97b
|
@ -218,6 +218,10 @@ class ArmNodeCategory:
|
|||
if name not in self.node_sections:
|
||||
self.node_sections[name] = []
|
||||
|
||||
def sort_nodes(self):
|
||||
for node_section in self.node_sections:
|
||||
self.node_sections[node_section] = sorted(self.node_sections[node_section], key=lambda item: item.label)
|
||||
|
||||
|
||||
def category_exists(name: str) -> bool:
|
||||
for category_section in category_items:
|
||||
|
|
|
@ -87,6 +87,7 @@ def register_nodes():
|
|||
# Generate and register category menus
|
||||
for category_section in arm_nodes.category_items.values():
|
||||
for category in category_section:
|
||||
category.sort_nodes()
|
||||
menu_class = type(f'ARM_MT_{category.name}Menu', (bpy.types.Menu, ), {
|
||||
'bl_space_type': 'NODE_EDITOR',
|
||||
'bl_idname': f'ARM_MT_{category.name.lower()}_menu',
|
||||
|
|
Loading…
Reference in a new issue