1

I'm supporting blender 2.80, And I want to move to blender 2.81 - 2.83. I encountered an issue while trying moving to blender 2.81 In my script for blender 2.80 I ran these command lines.

scn = bpy.context.scene
wd = scn.world
envnt = bpy.data.worlds[wd.name].node_tree
map_node = envnt.nodes['Mapping']
map_node.rotation.x = <x value of rotation>
map_node.rotation.y = <y value of rotation>
map_node.rotation.z = <z value of rotation>
map_node.keyframe_insert(data_path="rotation", frame=<frame number>)

But for blender 2.81 I needed to do some changes.

scn = bpy.context.scene
wd = scn.world
envnt = bpy.data.worlds[wd.name].node_tree
map_node = envnt.nodes['Mapping']
map_node.inputs['Rotation'].default_value.x = <x value of rotation>
map_node.inputs['Rotation'].default_value.y = <y value of rotation>
map_node.inputs['Rotation'].default_value.z = <z value of rotation>
map_node.keyframe_insert(data_path="rotation", frame=<frame number>) --> problem

Here I didn't manage to add a rotation to the key frame. In the end I need to save a scene file that include the rotation to each key frame.

What is the right command here?

Gal Katzir
  • 21
  • 2
  • Related https://blender.stackexchange.com/questions/185921/what-is-the-correct-data-path-to-animate-the-colour-of-a-principled-bsdf-node – batFINGER Jul 22 '20 at 16:07

1 Answers1

1
scn = bpy.context.scene
wd = scn.world
envnt = bpy.data.worlds[wd.name].node_tree
map_node = envnt.nodes['Mapping']
map_node.inputs['Rotation'].default_value.x = <x value of rotation>
map_node.inputs['Rotation'].default_value.y = <y value of rotation>
map_node.inputs['Rotation'].default_value.z = <z value of rotation>
map_node.inputs['Rotation'].keyframe_insert("default_value", frame=<frame number>)
Gal Katzir
  • 21
  • 2