how to debug NodePAth/PythonTag deletion.

Hi all,

I use wrappers on NodePaths and and set a pythontag on each NodePath to get back the corresponding wrapper.

My problem is that the pythonTag is there at the beginning of a method and not there at the end.

This is likely due to the framework I am using. I suspect some objects are created instead of using the ones already present.

I am wondering if there is a way to install a callback on a node or nodepath to track/debug its deletion/modification. or Any best practive/trick to do that.

That would be very useful.

    def replace_nodes(self, nodes):
        print "nodes %s, %s" %(nodes, map(type, nodes))
        nn   = [] 
        for n in nodes:
            po= n.getPythonTag("mesh_view")
            assert_(po) # works
            self.npos.append(po)
            nn.append(po.source.get_value())
        #==
        self.source.replace(nn, self)
        for p in nodes:
            assert_(p.getPythonTag( "mesh_view" )) # don't work
        self.pos = self.npos
        self.npos = []

nobody ?

Have you read the manual page on garbage collection? It includes some discussion of python tags and the del method, which can be used to see if a class instance is being garbage collected by python.

http://www.panda3d.org/manual/index.php/Removing_Custom_Class_Instances

I just reread the page myself, and the mention of python tags is only an offhand reference, but the bit about the del method at the bottom sounds like what you’re looking for.