0
$\begingroup$

I want to apply and keyframe a pose asset. The first part of applying a pose was described in this answer. However, I am not sure how to keyframe the action.

This is my code:

def apply_pose(frame, pose):
    win = bpy.context.window
    scr = win.screen
    area = scr.areas[0]
    area.type = "DOPESHEET_EDITOR"e

    with bpy.context.temp_override(area=area):
        bpy.ops.object.mode_set(mode='POSE')
        bpy.context.scene.frame_set(frame)
        bpy.data.objects['DeOne'].animation_data.action = bpy.data.actions[pose]
        for i in bpy.context.selected_objects[0].data.bones:
             i.select = True

        bpy.ops.anim.keyframe_insert_by_name(type="WholeCharacter")

I also tried bpy.ops.action.keyframe_insert() and bpy.ops.anim.keyframe_insert_by_name(type="BUILTIN_KSI_BendyBones")

Thank you for your help.

$\endgroup$

1 Answer 1

0
$\begingroup$

I am not a coder but use it for speech animation quite a bit. Have you tried the last line: bpy.ops.anim.keyframe_insert_menu(type='LocRotScale') it works in most instances for me.

$\endgroup$

You must log in to answer this question.

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