On Wed, Sep 23, 2009 at 4:54 AM, Germán Diago
Hello. I'm trying to do the following thing:
1.- Create an object 2.- Put it in an scene (for a game) 3.- To be able to delete it from the scene (this is done from C++)
My problem is that if I do the following:
p = Object("blabla") Scene.addToScene("myobject", p)
//Here, the object is deleted by C++, which is causing problems p.removeFromScene("myobject")
I know a workaround for this. It would be to make a wrapper for objects created from python and not deleting the object if it was created from there.
But I would like if there is some other (more general) way to avoid this. Thanks in advance.
If you are using Boost.Python, it contains policies for defining which side owns which and how some things are linked to other things, use those and it will handle all that properly.