Adding a keyframe to the value of a shapekey through python

If I want to add a keyframe to the value of a shapekey through python,
Anyone has any clue what the code would be?

can I use:
bpy.ops.anim.keyframe_insert(type=???)
What type would work if any?

I’m trying to animate detached faces on a mesh (leaves generated by the ivy generator),
And I want to try doing this via shapekeys, which would be generated (and animated by keyframes) using a script.

So… ideas? :slight_smile:

Thanks people

Hi TheFC


>>> C.object.data.shape_keys.key_blocks['Key 1'].value = 0.3


>>> C.object.data.shape_keys.key_blocks['Key 1'].keyframe_insert('value')
True

Great, thanks man!