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:
@@ -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):
|
||||
|
Reference in New Issue
Block a user