How to disable model cache dir?

I don’t want to change the default model dir in code, but instead disable it completely.
How can that be done?

I understand that for most use cases you want the cache folder but my program is only using procedurally generated geometry and the folder keeps filling up with junk that is not going to be used again.

Just put this on a line by itself in the Config.prc:

model-cache-dir

Thank you.
Can the Config.prc file be overran and this set in code?

The following should work:

from panda3d.core import load_prc_file_data

load_prc_file_data("", "model-cache-dir")

A more direct way to disable the model-cache from code:

cache = BamCache.get_global_ptr()
cache.set_cache_models(False)

Or you could deactivate any kind of caching (including textures and shaders):

cache = BamCache.get_global_ptr()
cache.set_active(False)

It’s also possible to decide on a per-model basis whether to consider the cache or not.

1 Like