a shapekey's keyframes?

I can get the frame number of an object’s keyframe from keyframe_point.co[0] from fcurve.keyframe_points. But I can’t figure out how to access the frame number of keyframes belonging to shape keys. Does anyone know where they live and possibly have their home address and a list of their fears?

bpy.context.active_object.data.shape_keys.key_blocks[‘Key 1’].frame

I’ve been searching over key blocks but still can’t seem to figure out where I would fish this data out. Thanks.

Do you mean this on the mesh level?

bpy.context.object.data.shape_keys.animation_data.action.fcurves[#]…

Stellar. Thanks! I’ve been developing some pretty sweet timeline/dopesheet indicator and keyframe snapping options, works great for regular animation data but not good for shape_key keyframed things until now. For anyone stumbling across this looking how to acquire shape_key keyframes do this:


import bpy


ob = bpy.context.active_object
action = ob.data.shape_keys.animation_data.action


points=[]
for fcurve in action.fcurves:
    if fcurve.lock or (fcurve.hide and context.space_data.type == "GRAPH_EDITOR"):
        continue
    for keyframe_point in fcurve.keyframe_points:
        points.append(keyframe_point.co[0])

print('Shape key keyframes')
for p in points:
    print(p)