1
$\begingroup$

I'm trying to change the values of Wave Texture (Shader Editor) by python: I mean that I what to change the value of Distortion or Detail Scale by python code.

wave_texture = bpy.data.objects['plane'].active_material.node_tree.nodes['Wave Texture']

I stack at this point, how I get and set Distortion for example.

$\endgroup$
2
$\begingroup$

You can access a node input sockets by either their name or their rank using their inputs property:

distortion_socket = wave_texture.inputs['Distortion']

or

distortion_socket = wave_texture.inputs[2]

Then you can set the value using default_value (the value not given by a link):

distortion_socket.default_value = 2
| improve this answer | |
$\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.