I want to create a new Object property containing a reference to another reference object.
As an example look at the “Object” field of the Boolean Modifier.
This is how I show the property in the panel:
row = layout.row() row.prop_search(element,"my_reference_object",bpy.data,"objects")
This is how I create the property:
bpy.types.Object.my_reference_object = StringProperty(name="Reference object")
This works, but if I change the name of the reference object the “my_reference_object” property is not updated, unlike what happens in the “Object” field of the Boolean Modifier.
This is because I am just storing the name and not a pointer to the object.
I tried this:
bpy.types.Object.my_reference_object = PointerProperty(name="Reference object",type=bpy.types.Object)
but it does not work…
Is there a way to store the object reference (as a pointer) in the property and obtain the same behaviour as in the Boolean Modifier?
Thank you in advance.