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?