Fix for node menu: Show the group input/output nodes in the Input/Output categories respectively, so they can be added with the usual UI in case the user deletes them. These nodes are polled out for

non-group trees (node trees not in the bpy.data.node_groups collection) to avoid confusion. For that purpose a new optional poll function argument has been added to NodeItem, which allows selectively
polling individual items in an otherwise static list.
This commit is contained in:
Lukas Toenne
2013-05-28 09:45:34 +00:00
parent 5486016e04
commit 81ba62e1e9
2 changed files with 23 additions and 2 deletions

View File

@@ -36,13 +36,18 @@ class NodeCategory():
elif callable(items):
self.items = items
else:
self.items = lambda context: items
def items_gen(context):
for item in items:
if item.poll is None or item.poll(context):
yield item
self.items = items_gen
class NodeItem():
def __init__(self, nodetype, label=None, settings={}):
def __init__(self, nodetype, label=None, settings={}, poll=None):
self.nodetype = nodetype
self._label = label
self.settings = settings
self.poll = poll
@property
def label(self):