Destroying CardMaker Cards

How do you destroy a card? I have the following setup:

 self.card = NodePath(cm.generate()) 

Calling self.card.detachNode() doesn’t destroy the Geom.

The Geom is destroyed, like any other Python or Panda3D object, when the last reference to it goes away. So you can destroy it completely with the sequence:

self.card = None

The function:


is provided as a convenience to do basically these two steps.

But why is it important to you when the Geom is destroyed?


Thanks. I was using cards as part of a drag and drop GUI, however, the cards weren’t being destroyed when the objects wrapping them were.

The problem was that even though those objects were destroyed, I continued to reference the cards in another section of my code.