1
$\begingroup$

I'm currently writing an Add-on for Blender 2.8 where I need to change the coordinates of the MaskSplinePoints in the Movie Clip Editor with python. During the script I'm moving along the time line and I want to save the coordinates and handle positions for each point in my mask at every time step. Since MaskSplinePoint inherits bpy_struct.keyframe_insert I thought that I could insert a keyframe for each point with the data_path co, handle_left and handle_right but I'm getting an error I don't know how to handle: TypeError: bpy_struct.keyframe_insert() could not make path to "co"

My code is executed in def execute of an operator:

def execute(self, context):
    mask = context.space_data.mask
    maskSpline = mask.layers.active.splines[0]
    points = maskSpline.points
    bpy.ops.clip.change_frame(frame=framenum+1)
    ##################
    # in this space I calculate and change the positions for the points
    # Note: I'm also adding/removing points from `points`
    ##################
    # insert keyframe
    for p in points:
        p.keyframe_insert(data_path="co")
    return {'FINISHED'}

Am I doing something wrong? Is there another way to save the state of the mask in time?

$\endgroup$

1 Answer 1

1
$\begingroup$

It seems like keyframe insertion for masks is exclusively handled by bpy.ops.mask.shape_key_insert() and cannot be done from python in a different manner. This operator only works in the right context (mask open in clip editor or image editor, or mask strip selected in sequence editor) and if the points of your mask are currently selected.

$\endgroup$

You must log in to answer this question.

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