cleaning up a whole scene


is there maybe a command in panda3d that destroys all nodepathes and all ode objects? so that the scene is completely empty again. just like in the beginning.

No, not any one command to do this. You have to loop through all of the objects you have created and clean them up yourself.

also, you can attach a new node and reparent your objects to it.
.removeNode() will clear up the whole scene.

This is something I am dealing with currently, too. Some feature to remove nodes automatically would be nice. During development it’s just painful right now, as you always forget something. Or, on the contrary, some crash happens because you try to work with a already deleted object.
Most stuff is parented to render, why is there no way to delete all nodes except the camera or lights?

There is. You can delete all the nodes, for instance, and then put the camera and lights back in:


But that won’t really clean everything up; all it does is remove nodes. Many objects also have other things that need to be cleaned up, like stopping tasks, or removing messenger hooks, or whatever. And a lot of times these cleanup requirements will be deep within your own code, as well; not just Panda’s requirements.

So, it usually makes more sense to clean up things explicitly. It shouldn’t be hard to keep track of things you have created. If it is hard, perhaps your design isn’t structured well enough.


ah, ok :slight_smile: i will remove the nodes and tasks i have created with a few loops. but i will also try it with the detach method. thanks for answering!