I need to access the points of a curve object (at the current frame) using the Python API.

If the object doesn't have shape keys, it's easy enough, object.data.splines has all the info I need.

If the object has shape keys, I know the shape key info is in object.data.shape_keys.key_blocks but I'm not entirely sure how to get the final position of each point/tangent in the bezier curves out of this.

First of all, the data in there is not split into splines.

Then if I know the value of each ShapeKey object I'm not sure what's the correct formula to interpolate them.

It would be great if there's some way to get for each spline in the curve, the position of each point and handles, taking into account all the shape keys that are into effect at the current frame.


1 Answer 1


You can create a shape key that is the mix of the current shape keys (as it is accessible from the shape key menu).

From it get spline info.

Then delete this shape key which was created only for that purpose.

Something like:

import bpy

curve = bpy.context.object

# Add a new shape key that is a mix of the existing one

# Get the last shape key
shape_key = curve.data.shape_keys.key_blocks[len(curve.data.shape_keys.key_blocks)-1]

# Get the info you want
for sk in shape_key.data:
    print( sk.co )
    print( sk.handle_left )
    print( sk.radius )

# Remove the shape key 
bpy.ops.object.shape_key_remove( all = False )
  • 1
    $\begingroup$ Works great, I just had to change the call to shape_key_remove to be shape_key_remove(shape_key). $\endgroup$
    – MattBas
    Aug 11, 2019 at 8:30

You must log in to answer this question.

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