I'm trying to create property groups dynamically to store a list. When I loop through property groups all I get is the objects like the output code block below. When really what I want is the test strings. At least the objects are actually created but I really need to access the string I'm hopefully setting on them. Please help. Been trying to work this out for days.
If the indents look off they are fine in my actual code.
class customPropertiesGroup(bpy.types.PropertyGroup):
customString = bpy.props.StringProperty()
bpy.utils.register_class(customPropertiesGroup)
bpy.types.Scene.customLists : bpy.props.CollectionProperty(type=customPropertiesGroup)
newCustomItem = bpy.context.scene.customLists.add()
newCustomItem.customString = "test1"
newCustomItem = bpy.context.scene.customLists.add()
newCustomItem.customString = "test2"
# These retrieve the objects OK.
bpy.context.scene.customLists[0].customString
bpy.context.scene.customLists[1].customString
# This is out of range. Which is surely good because it means something is working.
bpy.context.scene.customLists[2749].customString
count = 0
for customString in bpy.context.scene.customLists:
count += 1
print(count)
print(customString)
OUTPUT. I get a list of these with the count number. Two different mem addresses of course.
1
<bpy_struct, customPropertiesGroup("") at 0x000002311A3FE908>