Fix adding certain nodes can cause python errors
Adding nodes via `NodeAddOperator` could fail if the node's poll fails in `rna_NodeTree_node_new`. Examples are trying to add a RenderLayers node or a Cryptomatte node to a nodegroup. Now except the python error and use blender error reporting only instead of throwing full python stacktraces at the user. Differential Revision: https://developer.blender.org/D14584
This commit is contained in:
parent
e7a69b438f
commit
4aac251b42
|
@ -73,7 +73,11 @@ class NodeAddOperator:
|
|||
for n in tree.nodes:
|
||||
n.select = False
|
||||
|
||||
node = tree.nodes.new(type=node_type)
|
||||
try:
|
||||
node = tree.nodes.new(type=node_type)
|
||||
except RuntimeError as e:
|
||||
self.report({'ERROR'}, str(e))
|
||||
return None
|
||||
|
||||
for setting in self.settings:
|
||||
# XXX catch exceptions here?
|
||||
|
|
Loading…
Reference in New Issue