materials.py: Set blend method, use principled alpha
This commit is contained in:
parent
2a85865d31
commit
67d08f760a
29
materials.py
29
materials.py
@ -24,43 +24,34 @@ for mat in bpy.data.materials:
|
||||
|
||||
# Create texture coordinate node
|
||||
coord = nodes.new("ShaderNodeTexCoord")
|
||||
coord.location = -600, 0
|
||||
coord.location = -400, 0
|
||||
|
||||
# Create mapping node
|
||||
map = nodes.new("ShaderNodeMapping")
|
||||
map.location = -400, 0
|
||||
map.location = -200, 0
|
||||
|
||||
# Create principled shader
|
||||
prin = nodes.new("ShaderNodeBsdfPrincipled")
|
||||
prin.location = 200, 0
|
||||
prin.location = 300, 0
|
||||
prin.inputs["Specular"].default_value = 0
|
||||
|
||||
# Create transparent shader
|
||||
trans = nodes.new("ShaderNodeBsdfTransparent")
|
||||
trans.location = 400, -150
|
||||
|
||||
# Create mix shader
|
||||
mix = nodes.new("ShaderNodeMixShader")
|
||||
mix.location = 600, 0
|
||||
|
||||
# Create output
|
||||
out = nodes.new("ShaderNodeOutputMaterial")
|
||||
out.location = 800, 0
|
||||
out.location = 600, 0
|
||||
|
||||
# Link everything
|
||||
links.new(coord.outputs[2], map.inputs[0]) # Coord > Map
|
||||
links.new(map.outputs[0], tex.inputs[0]) # Map > Texture
|
||||
links.new(tex.outputs[0], prin.inputs[0]) # Texture > Principled
|
||||
links.new(prin.outputs[0], mix.inputs[2]) # Principled > Mix
|
||||
|
||||
links.new(trans.outputs[0], mix.inputs[1]) # Transparent > Mix
|
||||
links.new(tex.outputs[1], mix.inputs[0]) # Texture alpha > Mix factor
|
||||
|
||||
links.new(mix.outputs[0], out.inputs[0]) # Mix > Output
|
||||
links.new(tex.outputs[0], prin.inputs[0]) # Texture Color > Principled Color
|
||||
links.new(tex.outputs[1], prin.inputs[19]) # Texture Alpha > Principled Alpha
|
||||
links.new(prin.outputs[0], out.inputs[0]) # Principled > Output
|
||||
|
||||
# Deselect all
|
||||
for node in nodes:
|
||||
node.select = False
|
||||
|
||||
# Set blend mode
|
||||
mat.blend_method = "CLIP"
|
||||
|
||||
except:
|
||||
continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user