0
$\begingroup$

I am trying to add a driver in a node entry in the World. The following script fail with "TypeError: bpy_struct.driver_add(): property "inputs" not animatable " I can't find sample of similar code. Any help?

import bpy
scn = bpy.context.scene

wd = scn.world
nodes = wd.node_tree.nodes
wd.node_tree.nodes.clear() 

DR1 = nodes.new('ShaderNodeMath')
drv = DR1.driver_add("inputs",0)
$\endgroup$
1
$\begingroup$

Drive the default_value property of a particular input channel.

>>> n = C.scene.world.node_tree.nodes.new("ShaderNodeMath")
>>> d = n.inputs[0].driver_add("default_value")

>>> d.driver.expression
'0.5'

>>> 
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.