feat: material node cleanup on load

This commit is contained in:
Swann Martinez 2019-07-11 16:12:38 +02:00
parent e4bc9fc0e2
commit 24613e8045
No known key found for this signature in database
GPG Key ID: 414CCAFD8DA720E1

View File

@ -470,11 +470,16 @@ def load_material(target=None, data=None, create=False):
# load nodes
if data["use_nodes"]:
if target.node_tree is None:
target.use_nodes = True
target.node_tree.nodes.clear()
for node in data["node_tree"]["nodes"]:
# fix None node tree error
if target.node_tree is None:
target.use_nodes = True
index = target.node_tree.nodes.find(node)
if index is -1: