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']

**<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


1 Answer 1

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.

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

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