使用bpy修改并创建节点,使用新的连接方式
2022-04-16 本文已影响0人
小沙盒工作室
#from easybpy import *
import bpy
mat = bpy.context.object.active_material
nodes = mat.node_tree.nodes
#clear all node
nodes.clear()
#create node
imageTex = nodes.new(type="ShaderNodeTexImage")
bsdf = nodes.new(type='ShaderNodeBsdfPrincipled')
node_output = nodes.new(type='ShaderNodeOutputMaterial')
#setup image
print(imageTex)
imageTex.image = bpy.data.images[0]
#link together
links = mat.node_tree.links
link_image_bsdf = links.new(imageTex.outputs[0], bsdf.inputs[0])
link_bsdf_out = links.new(bsdf.outputs[0], node_output.inputs[0])