I'm trying to add a pointer property to the FCurve type, which has to point to a specific GPencilLayer type.
So far, here's what i tried without success :
i firstly tried to add a single attribute to the FCurve type :
bpy.types.FCurve.layer = bpy.props.PointerProperty(type = bpy.types.GPencilLayer
but while assigning a GPencilLayer to it i have :
AttributeError: 'FCurve' object attribute 'layer2' is read-only
So i tried to use a property group :
class DS_TARGET(PropertyGroup):
bl_label = "gp dopesheet targets"
bl_idname = "ds.target"
layer : bpy.props.PointerProperty(type = bpy.types.GPencilLayer)
but this classe won't register because of the "layer" property so i think i will use list then append / pop the GPLayer in it :
class DS_TARGET(PropertyGroup):
bl_label = "gp dopesheet targets"
bl_idname = "ds.target"
layer = []
While trying to add the target attribute to my FCurve type i tried :
bpy.types.FCurve.target = bpy.props.PointerProperty(type=DS_TARGET)
But this will result in a read-only thing and i can't even access my .layer attribute :
<_PropertyDeferred, <built-in function PointerProperty>, {'type': <class 'GP_Dopesheets.DS_TARGET'>}>
This logic used to work with other types like Scene or Object, but not for Fcurves ? Thanks for your help !