This line was working a couple years ago to keyframe the Mapping Node (Point) Location for X, Y, Z.

(bpy.data.materials[self.obj_mat].node_tree.nodes["Mapping"].keyframe_insert(data_path = "translation", frame = frame_set)

Now I get an error message: TypeError: bpy_struct.keyframe_insert() property "translation" not found

Seems somewhere in time an update apparently changed the "translation" data_path on the Mapping node and so if someone can help me out on this by telling me the new data_path and how to find out the data paths - as just copying the data path gives the following:


and not sure how inputs[1].default_value[1] let's me know what to put in. I checked the Actions and see "X Default Value (Location)", which was another dead-end.



1 Answer 1


It looks like the attributes that used to be under separate attrs like translation, rotation, scale are now collected under a attr called inputs with indices pointing to each one.

import bpy

D = bpy.data

mapping_node = D.materials['Material'].node_tree.nodes["Mapping"]

for inp in mapping_node.inputs:
    print(f"Input: {inp}")
    print(f"Input Name: {inp.name}")

Input: <bpy_struct, NodeSocketVector("Vector") at 0x00000167BB142C08>
Input Name: Vector
Input: <bpy_struct, NodeSocketVectorTranslation("Location") at 0x00000167BB142808>
Input Name: Location
Input: <bpy_struct, NodeSocketVectorEuler("Rotation") at 0x00000167BB142608>
Input Name: Rotation
Input: <bpy_struct, NodeSocketVectorXYZ("Scale") at 0x00000167BB141208>
Input Name: Scale 

You can also access each value by name:

>>> <bpy_struct, NodeSocketVectorTranslation("Location") at 0x00000167BB142808> 

So you can either access them by their index, starting at 0, or you can access them by name. Then you set the keyframe on the value directly.

mapping_node.inputs['Location'].keyframe_insert("default_value", frame=21)

I was able to find all this out by copying the data path of and then pasting it into the python console under the script editing window. This allows you to back up step-by-step and inspect the values of each attribute one by one.

enter image description here

  • $\begingroup$ Thanks for the info Jakemoyo! Worked well. $\endgroup$
    – Kelly
    Commented Nov 8, 2022 at 3:27
  • $\begingroup$ Awesome can you accept the answer? $\endgroup$
    – Jakemoyo
    Commented Nov 10, 2022 at 11:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .