diff options
author | Robert Guetzkow <gitcommit@outlook.de> | 2020-04-05 13:03:33 +0300 |
---|---|---|
committer | Robert Guetzkow <gitcommit@outlook.de> | 2020-04-05 14:55:47 +0300 |
commit | ba19a9a74770a39fb23d96a99a0abe30d154a8f2 (patch) | |
tree | c2367224458a858afc6360ce3d8c61a4ee7649bf /archipack | |
parent | 34f60e3bed28d265e1f0da193c399e43e5285c65 (diff) |
Fix T75393: Archipack thumbs find shader node by type
Find the Principle BSDF by type instead of assuming that it's the node
with index 1.
Reviewed By: stephen_leger
Differential Revision: https://developer.blender.org/D7338
Diffstat (limited to 'archipack')
-rw-r--r-- | archipack/archipack_thumbs.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/archipack/archipack_thumbs.py b/archipack/archipack_thumbs.py index ce6d0b48..730cc8a5 100644 --- a/archipack/archipack_thumbs.py +++ b/archipack/archipack_thumbs.py @@ -77,7 +77,10 @@ def get_center(o): def apply_simple_material(o, name, color): m = bpy.data.materials.new(name) m.use_nodes = True - m.node_tree.nodes[1].inputs[0].default_value = color + for node in m.node_tree.nodes: + if node.bl_idname == "ShaderNodeBsdfPrincipled": + node.inputs[0].default_value = color + break o.data.materials.append(m) |