diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-05-28 13:45:34 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-05-28 13:45:34 +0400 |
commit | 81ba62e1e9fae21d7dc9a68e60751865243bb5f5 (patch) | |
tree | 82a61a2d4ebf0fb109a81574b86ade8206f14050 /release/scripts/modules/nodeitems_utils.py | |
parent | 5486016e04386cf00550ac9ede8615d1daf281b9 (diff) |
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.
Diffstat (limited to 'release/scripts/modules/nodeitems_utils.py')
-rw-r--r-- | release/scripts/modules/nodeitems_utils.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/release/scripts/modules/nodeitems_utils.py b/release/scripts/modules/nodeitems_utils.py index e97e97684c3..cb574b72853 100644 --- a/release/scripts/modules/nodeitems_utils.py +++ b/release/scripts/modules/nodeitems_utils.py @@ -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): |