Page MenuHome

LinkNodeBug.py

File Metadata

Author
Nick Keeline (nrk)
Created
Nov 13 2013, 4:28 PM

LinkNodeBug.py

#Select default cube and run this script
import bpy
MatObj = bpy.context.active_object
Mat = bpy.data.materials.new("Test_Material")
if len(MatObj.material_slots) == 0:
bpy.ops.object.material_slot_add()
Slot = MatObj.material_slots[0]
Slot.material = Mat
Mat.use_nodes = True
Nodes = Mat.node_tree
Nodes.nodes.clear()
#Create a Node
MathPower = Nodes.nodes.new('MATH')
MathPower.location = [100,100]
#Create another node Node
MathPower2 = Nodes.nodes.new('MATH')
MathPower2.location = [100,400]
#Create an output Node
MathPower3 = Nodes.nodes.new('MATH')
MathPower3.location = [300,250]
#This is weird that this works??????
Nodes.links.new(MathPower3.inputs[0],MathPower.outputs[0])
Nodes.links.new(MathPower3.inputs[0],MathPower2.outputs[0])
#But this doesn't
#Create a Node
MathPower4 = Nodes.nodes.new('MATH')
MathPower4.location = [600,100]
#Create another node Node
MathPower5 = Nodes.nodes.new('MATH')
MathPower5.location = [600,400]
#Create an output Node
MathPower6 = Nodes.nodes.new('MATH')
MathPower6.location = [450,250]
#This should tie one output to two inputs but it doesn't!!!!!
Nodes.links.new(MathPower4.inputs[0],MathPower6.outputs[0])
#this one deletes the one above it and it doesn't
Nodes.links.new(MathPower4.inputs[0],MathPower6.outputs[0])

Event Timeline