1
$\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 Answer 1

2
$\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$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .