Cycles material What is the syntax to access texture mapping location?

I have scripted texture offset through script for blender internal material

loc = bpy.data.objects["RigName"].pose.bones["BoneName"].location.x
bpy.data.materials["MaterialName"].texture_slots[7].offset[0] = loc


What is the syntax to access texture mapping location in Cycles Material

I have the idea of setting up drivers but as i have already scripted it like above showed example for many of the characters so it will help to know the syntax in speeding change to cycles

Let's assume Mapping is the unique name/identifier for the Mapping node in question. To find the unique node name, select the node and view the Side panel (N key).

The code to access the Location vector for Mapping is:

>>> bpy.data.materials['Material'].node_tree.nodes['Mapping'].translation
Vector((0.0, 0.0, 0.0))


or more structured

mat = bpy.data.materials['Material']
nodes = mat.node_tree.nodes
mapping = nodes['Mapping']
mapping.translation = 1.0, 0, 0   # accepts tuple


Hover over the properties and the tooltip will give a hint as to where to find most properties. But for materials, the path is via data.materials and not data.node_groups as the tooltip suggests.

• Thanks great help. Please add clarification saying 'mapping' is node-name. And in case of many textures mapped to same material like in my case, one needs to refer to the appropriate node-name of that particular mapping node. Please add screenshot of where to find the node-name. Please correct me if wrong. – ashwin May 24 '15 at 11:49
• I think finding the unique node name would have been an excellent separate question, as it will be generic and apply to many many other cases. Whereas now, someone might still ask that question, not knowing that the answer is also in this question. messy. – zeffii May 24 '15 at 12:20