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?