Pretty sure i’m doing something wrong here, seems a bit strange to have a custom property default to read only (what would be the point in creating it if you can never set it to something other than the default?)
here’s a bare bones test script that can be run in a scene with a default cube:
import bpy from bpy.props import CollectionProperty, PointerProperty, StringProperty class CUSTOM_test(bpy.types.PropertyGroup): my_attr: StringProperty() bpy.utils.register_class(CUSTOM_test) bpy.types.Scene.my_test = CollectionProperty(type=CUSTOM_test) bpy.types.Object.my_pointer = PointerProperty(type=CUSTOM_test) bpy.context.scene.my_test.add() # AttributeError: bpy.context.active_object.my_pointer = bpy.context.scene.my_test
which results in the following exception:
AttributeError: bpy_struct: attribute "my_pointer" from "Object" is read-only
So what’s the solution here? I have a custom PropertyGroup stored on the Scene that I need to be able to keep track of on individual objects.
nb: cross-posted on ba.org