TransWikia.com

Add rotation to a key frame

Blender Asked by Gal Katzir on November 27, 2021

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?

One Answer

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

Answered by Gal Katzir on November 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP