Added filter to the node group items callback to remove recursive node groups right from the start. These tree pointers would be polled out internally as well, but this way they don't show up in the menus in the first place.

This commit is contained in:
Lukas Toenne
2013-05-08 15:41:07 +00:00
parent 8863222a90
commit d7c74acab1

View File

@@ -61,9 +61,24 @@ def node_group_items(context):
if not ntree:
return
def contains_group(nodetree, group):
if nodetree == group:
return True
else:
for node in nodetree.nodes:
if node.bl_idname in node_tree_group_type.values() and node.node_tree is not None:
if contains_group(node.node_tree, group):
return True
return False
for group in context.blend_data.node_groups:
if group.bl_idname == ntree.bl_idname:
yield NodeItem(node_tree_group_type[group.bl_idname], group.name, { "node_tree" : "bpy.data.node_groups['%s']" % group.name })
if group.bl_idname != ntree.bl_idname:
continue
# filter out recursive groups
if contains_group(ntree, group):
continue
yield NodeItem(node_tree_group_type[group.bl_idname], group.name, { "node_tree" : "bpy.data.node_groups['%s']" % group.name })
# All standard node categories currently used in nodes.