fix: material gpencil loading

This commit is contained in:
Swann 2020-10-15 18:01:54 +02:00
parent 7db3c18213
commit 5bc9b10c12
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB

View File

@ -205,22 +205,22 @@ class BlMaterial(BlDatablock):
def _load_implementation(self, data, target):
loader = Loader()
target.name = data['name']
if data['is_grease_pencil']:
is_grease_pencil = data.get('is_grease_pencil')
use_nodes = data.get('use_nodes')
loader.load(target, data)
if is_grease_pencil:
if not target.is_grease_pencil:
bpy.data.materials.create_gpencil_data(target)
loader.load(
target.grease_pencil, data['grease_pencil'])
if data["use_nodes"]:
loader.load(target.grease_pencil, data['grease_pencil'])
elif use_nodes:
if target.node_tree is None:
target.use_nodes = True
target.node_tree.nodes.clear()
loader.load(target, data)
# Load nodes
for node in data["node_tree"]["nodes"]:
load_node(data["node_tree"]["nodes"][node], target.node_tree)