1
$\begingroup$

I have a Material that consists of a single Node Group; one of the Node Group inputs is a scalar value named Spot Z Rot.

I'd like to add a driver to the Z rotation of an object, forcing it to match the Z Rot of this Node Group input. However, when I try to do this in various ways, the property is not recognized. I am able to access Spot Z Rot from the general scripting interface:

enter image description here

But when I try to do something similar in the Add Driver menu, Spot Z Rot is not recognized as a valid property of the Material:

enter image description here

So far I have tried, without success, the following:

bpy.data.node_groups['ToonShader'].inputs['Spot Z Rot']
data.node_groups['ToonShader'].inputs['Spot Z Rot']
node_groups['ToonShader'].inputs['Spot Z Rot']
self.inputs['Spot Z Rot']

As well as driving the rotation from an added custom property on the material. The driver does not seem to recognize any of these variables.

Is there a correct way of accessing a Material's Node Group Inputs from a Scripted Expression Python Driver on an object?

(Actually, even in the general Python scripting interface, I was a bit confused; Getting the actual (not default) input value of a node group for a specific user clarifies how access should work, but node_tree.nodes.get('ToonShader').inputs['Spot Z Rot'].default_value does not work in the Driver either.)

$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.