ModelPool
from panda3d.core import ModelPool
- class ModelPool
Bases:
DTOOL_SUPER_BASE
This class unifies all references to the same filename, so that multiple attempts to load the same model will return the same pointer. Note that the default behavior is thus to make instances: use with caution. Use the copy_subgraph() method on Node (or use NodePath::copy_to) to make modifiable copies of the node.
Unlike TexturePool, this class does not automatically resolve the model filenames before loading, so a relative path and an absolute path to the same model will appear to be different filenames.
However, see the Loader class, which is now the preferred interface for loading models. The Loader class can resolve filenames, supports threaded loading, and can automatically consult the ModelPool, according to the supplied LoaderOptions.
Inheritance diagram
- __init__(*args, **kwargs)
- addModel()
C++ Interface: add_model(ModelRoot model) add_model(const Filename filename, ModelRoot model)
- /**
Adds the indicated already-loaded model to the pool. The model will
replace any previously-loaded model in the pool that had the same filename.
@deprecated Use the one-parameter add_model(model) instead.
*/
- /**
Adds the indicated already-loaded model to the pool. The model will
replace any previously-loaded model in the pool that had the same filename.
*/
- add_model()
C++ Interface: add_model(ModelRoot model) add_model(const Filename filename, ModelRoot model)
- /**
Adds the indicated already-loaded model to the pool. The model will
replace any previously-loaded model in the pool that had the same filename.
@deprecated Use the one-parameter add_model(model) instead.
*/
- /**
Adds the indicated already-loaded model to the pool. The model will
replace any previously-loaded model in the pool that had the same filename.
*/
- garbageCollect()
C++ Interface: garbage_collect()
- /**
Releases only those models in the pool that have a reference count of
exactly 1; i.e. only those models that are not being used outside of the
pool. Returns the number of models released.
*/
- garbage_collect()
C++ Interface: garbage_collect()
- /**
Releases only those models in the pool that have a reference count of
exactly 1; i.e. only those models that are not being used outside of the
pool. Returns the number of models released.
*/
- getModel()
C++ Interface: get_model(const Filename filename, bool verify)
- /**
Returns the model that has already been previously loaded, or NULL
otherwise. If verify is true, it will check if the file is still up-to-
date (and hasn’t been modified in the meantime), and if not, will still
return NULL.
*/
- get_model()
C++ Interface: get_model(const Filename filename, bool verify)
- /**
Returns the model that has already been previously loaded, or NULL
otherwise. If verify is true, it will check if the file is still up-to-
date (and hasn’t been modified in the meantime), and if not, will still
return NULL.
*/
- hasModel()
C++ Interface: has_model(const Filename filename)
- /**
Returns true if the model has ever been loaded, false otherwise. Note that
this does not guarantee that the model is still up-to-date.
*/
- has_model()
C++ Interface: has_model(const Filename filename)
- /**
Returns true if the model has ever been loaded, false otherwise. Note that
this does not guarantee that the model is still up-to-date.
*/
- listContents()
C++ Interface: list_contents() list_contents(ostream out)
- list_contents()
C++ Interface: list_contents() list_contents(ostream out)
- loadModel()
C++ Interface: load_model(const Filename filename, const LoaderOptions options)
- /**
Loads the given filename up as a model, if it has not already been loaded,
and returns the new model. If a model with the same filename was
previously loaded, returns that one instead (unless cache-check-timestamps
is true and the file has recently changed). If the model file cannot be
found, or cannot be loaded for some reason, returns NULL.
*/
- load_model()
C++ Interface: load_model(const Filename filename, const LoaderOptions options)
- /**
Loads the given filename up as a model, if it has not already been loaded,
and returns the new model. If a model with the same filename was
previously loaded, returns that one instead (unless cache-check-timestamps
is true and the file has recently changed). If the model file cannot be
found, or cannot be loaded for some reason, returns NULL.
*/
- releaseAllModels()
C++ Interface: release_all_models()
- /**
Releases all models in the pool and restores the pool to the empty state.
*/
- releaseModel()
C++ Interface: release_model(ModelRoot model)
- /**
Removes the indicated model from the pool, indicating it will never be
loaded again; the model may then be freed. If this function is never
called, a reference count will be maintained on every model every loaded,
and models will never be freed.
@deprecated Use release_model(model) instead.
*/
- /**
Removes the indicated model from the pool, indicating it will never be
loaded again; the model may then be freed. If this function (and
garbage_collect()) is never called, a reference count will be maintained on
every model every loaded, and models will never be freed.
The model’s get_fullpath() value should not have been changed during its
lifetime, or this function may fail to locate it in the pool.
*/
- release_all_models()
C++ Interface: release_all_models()
- /**
Releases all models in the pool and restores the pool to the empty state.
*/
- release_model()
C++ Interface: release_model(ModelRoot model)
- /**
Removes the indicated model from the pool, indicating it will never be
loaded again; the model may then be freed. If this function is never
called, a reference count will be maintained on every model every loaded,
and models will never be freed.
@deprecated Use release_model(model) instead.
*/
- /**
Removes the indicated model from the pool, indicating it will never be
loaded again; the model may then be freed. If this function (and
garbage_collect()) is never called, a reference count will be maintained on
every model every loaded, and models will never be freed.
The model’s get_fullpath() value should not have been changed during its
lifetime, or this function may fail to locate it in the pool.
*/
- verifyModel()
C++ Interface: verify_model(const Filename filename)
- /**
Loads the given filename up as a model, if it has not already been loaded,
and returns true to indicate success, or false to indicate failure. If
this returns true, it is probable that a subsequent call to load_model()
with the same model name will return a valid PandaNode.
However, even if this returns true, it is still possible for a subsequent
call to load_model() to fail. This can happen if cache-check-timestamps is
true, and the on-disk file is subsequently modified to replace it with an
invalid model.
*/
- verify_model()
C++ Interface: verify_model(const Filename filename)
- /**
Loads the given filename up as a model, if it has not already been loaded,
and returns true to indicate success, or false to indicate failure. If
this returns true, it is probable that a subsequent call to load_model()
with the same model name will return a valid PandaNode.
However, even if this returns true, it is still possible for a subsequent
call to load_model() to fail. This can happen if cache-check-timestamps is
true, and the on-disk file is subsequently modified to replace it with an
invalid model.
*/