how to add list to PropertyGroup


from bpy.props import (
            StringProperty,
            BoolProperty,
            EnumProperty,
            IntProperty,
            FloatProperty,
            CollectionProperty,
            BoolVectorProperty,
            IntVectorProperty,
            PointerProperty
            )


class ImageLayerData(bpy.types.PropertyGroup):
    name = StringProperty(name="Layer Name", default="new layer")
    is_visible = BoolProperty(name="vis tog", default=True)
    pixels =  []
    position = []


class LayersData(bpy.types.PropertyGroup):
    layers = CollectionProperty(type = ImageLayerData)


bpy.utils.register_class(ImageLayerData)
bpy.utils.register_class(LayersData)
bpy.types.Image.ldata = PointerProperty(name = "layers manager", type =  LayersData,  description = "layers manager ldata" )


image = bpy.data.images["11"]
layers = image.ldata.layers 
d1 = layers.add()
d1.position +=[5,1,2,3]
layers.add()
layers[0].position 
layers[1].position 

result is:
layers[0].position is referred to layers[1].position , they are referred to one list, not new data,why ? how to add list to PropertyGroup?

Thanks you so much ywaby , i note your very useful informations!

is it means it,s a bug? is there any way to save list data to blend?

i find a way, don’t ask me why,i don’t know.


from bpy.props import (
            StringProperty,
            BoolProperty,
            EnumProperty,
            IntProperty,
            FloatProperty,
            CollectionProperty,
            BoolVectorProperty,
            IntVectorProperty,
            PointerProperty
            )


class ImageLayerData(bpy.types.PropertyGroup):
    name = StringProperty(name="Layer Name", default="new layer")
    is_visible = BoolProperty(name="vis tog", default=True)
    #pixels =  []
    #position = []


class LayersData(bpy.types.PropertyGroup):
    layers = CollectionProperty(type = ImageLayerData)


bpy.utils.register_class(ImageLayerData)
bpy.utils.register_class(LayersData)
bpy.types.Image.ldata = PointerProperty(name = "layers manager", type =  LayersData,  description = "layers manager ldata" )
image =  bpy.data.images.new("name", 10, 10, alpha = True )
layers = image.ldata.layers 
d1 = layers.add()
d1["position"] =[5,1,2,3]
d2 = layers.add()
d2["position"] =[0,1,2,3]


layers[0]["position"]
layers[1]["position"]


for i in layers[0]["position"]:
    print(str(i))