UI: Nodes: Sort packed groups below assets in add menu search

Previously items in the "Group" list would usually show up first because
their menu path is shorter. Now, adjust their search weight so they show
up lower than the corresponding asset. That this is just a heuristic,
because we don't have a good way to directly deduplicate groups
that are just packed assets in the add menu currently.

Pull Request: https://projects.blender.org/blender/blender/pulls/147629
This commit is contained in:
Hans Goudey
2025-10-08 16:15:03 +02:00
committed by Hans Goudey
parent e5f13a727a
commit 085276d8ba

View File

@@ -315,7 +315,11 @@ class NodeMenu(Menu):
if groups:
layout.separator()
for group in groups:
props = cls.node_operator(layout, node_tree_group_type[group.bl_idname], label=group.name)
search_weight = -1.0 if group.is_linked_packed else 0.0
props = cls.node_operator(layout,
node_tree_group_type[group.bl_idname],
label=group.name,
search_weight=search_weight)
ops = props.settings.add()
ops.name = "node_tree"
ops.value = "bpy.data.node_groups[{!r}]".format(group.name)