0

I was wondering how you would unload a model. I am using Panda3D and loading in .bam files as my models in the game. Would you do something like this:

ModelName = loader.loadModel(where the model is.bam)
ModelName = loader.unloadModel(where the model is.bam)

I want to unload a model and then load in another model in the same space if that helps any.

1
  • What is a "model" in this context? What do you mean by "load"? Commented Aug 5, 2014 at 11:39

1 Answer 1

1

The syntax you described is (almost) correct. When using loadModel, Panda3D will cache the model in memory, so that the model doesn't have to be reloaded from disk the next time you use loadModel.

If you wish to free up this memory because you no longer need this model, then you can use the unloadModel function with the return value you received from loadModel, which will release the model from the in-memory cache. However, note that it will not actually remove any instances of that model that you have in the scene graph - you will still need to detach those.

If you want to remove a model from the scene graph, then simply calling removeNode() will do. Orphaning a section of the scene graph like that will cause it to be garbage collected, given that you drop all references to it (and there are no circular references.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.