Skip to main content
edited body
Source Link

I'm trying to add a driver to a Cycles Value node using Python. So far my code is:

node = material.node_tree.nodes.new("ShaderNodeValue")
node.driver_newdriver_add("default_value")

However, this just gives me a 'property "default_value" not found' error. I've also tried:

node.driver_newdriver_add("value")
node.driver_newdriver_add("outputs", 0)
node.driver_newdriver_add("outputs[0].default_value")
node.driver_newdriver_add("nodes['Value'].outputs[0].default_value")

None of these work either. So my question is: how do I exactly add a driver to a Cycles Value node? It can be done via the UI right-click menu, but I can't find a data path that driver_newdriver_add() will accept.

I'm trying to add a driver to a Cycles Value node using Python. So far my code is:

node = material.node_tree.nodes.new("ShaderNodeValue")
node.driver_new("default_value")

However, this just gives me a 'property "default_value" not found' error. I've also tried:

node.driver_new("value")
node.driver_new("outputs", 0)
node.driver_new("outputs[0].default_value")
node.driver_new("nodes['Value'].outputs[0].default_value")

None of these work either. So my question is: how do I exactly add a driver to a Cycles Value node? It can be done via the UI right-click menu, but I can't find a data path that driver_new() will accept.

I'm trying to add a driver to a Cycles Value node using Python. So far my code is:

node = material.node_tree.nodes.new("ShaderNodeValue")
node.driver_add("default_value")

However, this just gives me a 'property "default_value" not found' error. I've also tried:

node.driver_add("value")
node.driver_add("outputs", 0)
node.driver_add("outputs[0].default_value")
node.driver_add("nodes['Value'].outputs[0].default_value")

None of these work either. So my question is: how do I exactly add a driver to a Cycles Value node? It can be done via the UI right-click menu, but I can't find a data path that driver_add() will accept.

Tweeted twitter.com/#!/StackBlender/status/439576450157805568
Source Link

Adding a driver to a Cycles node via Python

I'm trying to add a driver to a Cycles Value node using Python. So far my code is:

node = material.node_tree.nodes.new("ShaderNodeValue")
node.driver_new("default_value")

However, this just gives me a 'property "default_value" not found' error. I've also tried:

node.driver_new("value")
node.driver_new("outputs", 0)
node.driver_new("outputs[0].default_value")
node.driver_new("nodes['Value'].outputs[0].default_value")

None of these work either. So my question is: how do I exactly add a driver to a Cycles Value node? It can be done via the UI right-click menu, but I can't find a data path that driver_new() will accept.