3
$\begingroup$

I'm creating a script to automate copying keyframes of an object, I'm using

bpy.ops.screen.keyframe_jump(next=True)

to jump to next keyframe, what I need as a next step is to copy the keyframes at the current frame which I'm getting using:

current_frame = bpy.context.scene.frame_current

Reading the documentation, I found ways to select all keyframes:

bpy.ops.action.select_all()

Which obviously select all keyframes QUESTION: How to select keyframes at current frame only?

$\endgroup$

1 Answer 1

4
$\begingroup$

Looking at the documentation:

bpy.ops.action.select_column(mode='KEYS')
Select all keyframes on the specified frame(s)

Parameters
mode (enum in ['KEYS', 'CFRA', 'MARKERS_COLUMN', 'MARKERS_BETWEEN'], (optional)) – Mode

Should select all keyframes at a specified frame. KEYS didn't do a thing for me, CFRA at first sight looked like some kind of a foreign language, however at a second glance, looks like it stands for Current Frame, it would really be very helpful in my opinion to use a descriptive enum, such as 'CURRENT FRAME" but it is what it is. So the answer is:
bpy.ops.action.select_column(mode='CFRA')
will select all keyframes at the current frame.

$\endgroup$

You must log in to answer this question.

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