[Bf-extensions-cvs] [ba19a9a7] master: Fix T75393: Archipack thumbs find shader node by type
Robert Guetzkow
noreply at git.blender.org
Sun Apr 5 14:26:09 CEST 2020
Commit: ba19a9a74770a39fb23d96a99a0abe30d154a8f2
Author: Robert Guetzkow
Date: Sun Apr 5 12:03:33 2020 +0200
Branches: master
https://developer.blender.org/rBAba19a9a74770a39fb23d96a99a0abe30d154a8f2
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
===================================================================
M archipack/archipack_thumbs.py
===================================================================
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)
More information about the Bf-extensions-cvs
mailing list