0
$\begingroup$

I need to access Mapping Node via python to edit Location\Rotation\Scale

enter image description here

mat = bpy.data.materials['MaterialName']
mat_nodes = mat.node_tree.nodes
map = mat_nodes['Mapping']

map.inputs[0]
print(map.inputs[0])
**<bpy_struct, NodeSocketVector("Vector")>**

But there are no other inputs, and I have noidea what [0] input does

PS I know that my node named Cracks_Mapping

Found an answer here : Access Mapping node with python

$\endgroup$
0
$\begingroup$
bpy.data.materials['Material'].node_tree.nodes['Cracks_Mapping'].rotation[2] = some value

That's how you do it. input[0] is the only input of the node, the Vector. The 0 is the index. For example rotation has 3 index, 0, 1, and 2 for X, Y, and Z. Knowing that, if you assign a value to .rotation[2] like in my code example you'll modify Z rotation value of the mapping node. It's pretty straightforward really.

$\endgroup$
  • $\begingroup$ Yeh, I've already found it in the link provided in my question, but thanks anyway $\endgroup$ – cxnt1 Oct 21 at 9:17

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.