I am trying to store the selected points of a Mask in the ClipEditor in a list, in order to retrieve it later, so to say as a temporary selection-set of mask controlpoints.
Here's what I have so far:
import bpy layer = bpy.data.masks['Mask'].layers['MaskLayer'] bpy.context.scene["mask_storage"] =  pointlist =  for p in layer.splines.active.points: if p.select == True: pointlist.append(p)
That works so far. If I print that list it has all the selected points in it, such as:
<bpy_struct, MaskSplinePoint at 0x7f7f2fbb4d88> <bpy_struct, MaskSplinePoint at 0x7f7f2fbb4e98> <bpy_struct, MaskSplinePoint at 0x7f7f2fbb4fa8>
However, when I continue to do this:
bpy.context.scene["mask_storage"] = pointlist
I get an error:
TypeError: object of type 'MaskSplinePoint' has no len() The above exception was the direct cause of the following exception: SystemError: PyEval_EvalFrameEx returned a result with an error set
At first I tried to append the points directly to the "mask_storage" list directly, but that didn't work, it gave the error
AttributeError: 'IDPropertyArray' object has no attribute 'append'
That's why I tried to work around that by first appending to the "pointlist" and then assigning that to "mask_storage". But that obviously does not work.
I did do some googling already, and it seems I might need to do something with bpy.props.CollectionProperties, but I simply couldn't figure out how to do that exactly.