Fix #35640, part 2. Check id.lib in poll functions for operators which do critical modification of node trees (create nodes, link, etc.). Transform operators and hide/show type operators are still

allowed, this does not modify actual behavior of the nodes and can be useful for inspecting linked nodes.
This commit is contained in:
Lukas Toenne
2013-06-05 19:06:33 +00:00
parent 4c2a51e1f9
commit f681ce08c4
9 changed files with 63 additions and 28 deletions

View File

@@ -100,7 +100,7 @@ class NodeAddOperator():
def poll(cls, context):
space = context.space_data
# needs active node editor and a tree to add nodes to
return (space.type == 'NODE_EDITOR' and space.edit_tree)
return (space.type == 'NODE_EDITOR' and space.edit_tree and not space.edit_tree.library)
# Default execute simply adds a node
def execute(self, context):
@@ -231,7 +231,7 @@ class NODE_OT_collapse_hide_unused_toggle(Operator):
def poll(cls, context):
space = context.space_data
# needs active node editor and a tree
return (space.type == 'NODE_EDITOR' and space.edit_tree)
return (space.type == 'NODE_EDITOR' and space.edit_tree and not space.edit_tree.library)
def execute(self, context):
space = context.space_data