Simple UV scrolling nodes in place. Simple approach will probably remain since the only interaction will be with image textures nodes

This commit is contained in:
William Herald Snyder 2022-10-02 16:30:11 -04:00
parent ea82d24356
commit 9a344d0652
1 changed files with 18 additions and 1 deletions

View File

@ -125,12 +125,15 @@ to provide an exact emulation"""
material.node_tree.nodes.clear() material.node_tree.nodes.clear()
bsdf = material.node_tree.nodes.new("ShaderNodeBsdfPrincipled") bsdf = material.node_tree.nodes.new("ShaderNodeBsdfPrincipled")
texImage = material.node_tree.nodes.new('ShaderNodeTexImage') texImage = material.node_tree.nodes.new('ShaderNodeTexImage')
texImage.image = bpy.data.images.load(diffuse_texture_path) texImage.image = bpy.data.images.load(diffuse_texture_path)
texImage.image.alpha_mode = 'CHANNEL_PACKED' texImage.image.alpha_mode = 'CHANNEL_PACKED'
material.node_tree.links.new(bsdf.inputs['Base Color'], texImage.outputs['Color']) material.node_tree.links.new(bsdf.inputs['Base Color'], texImage.outputs['Color'])
texture_input_nodes.append(texImage)
bsdf.inputs["Roughness"].default_value = 1.0 bsdf.inputs["Roughness"].default_value = 1.0
bsdf.inputs["Specular"].default_value = 0.0 bsdf.inputs["Specular"].default_value = 0.0
@ -174,6 +177,20 @@ to provide an exact emulation"""
material.node_tree.links.new(output.inputs['Surface'], surfaces_output.outputs[0]) material.node_tree.links.new(output.inputs['Surface'], surfaces_output.outputs[0])
if "SCROLL" in mat_props.rendertype:
uv_input = material.node_tree.nodes.new("ShaderNodeUVMap")
vector_add = material.node_tree.nodes.new("ShaderNodeVectorMath")
material.node_tree.links.new(vector_add.inputs[0], uv_input.outputs[0])
for texture_node in texture_input_nodes:
material.node_tree.links.new(texture_node.inputs["Vector"], vector_add.outputs[0])
''' '''
else: else: