A convenient class for loading models from disk, in bam or egg format (or any of a number of other formats implemented by a LoaderFileType, such as ptloader).
More...
|
| __init__ (str name) |
|
str | getTaskChain () |
| Returns the task chain that is used for asynchronous loads. More...
|
|
AsyncTaskManager | getTaskManager () |
| Returns the task manager that is used for asynchronous loads. More...
|
|
| loadAsync (AsyncTask request) |
| Begins an asynchronous load request. To use this call, first call make_async_request() to create a new ModelLoadRequest object with the filename you wish to load, and then add that object to the Loader with load_async. This function will return immediately, and the model will be loaded in the background. More...
|
|
PandaNode | loadBamStream (Istream in) |
| Attempts to read a bam file from the indicated stream and return the scene graph defined there. More...
|
|
PandaNode | loadSync (const Filename filename, const LoaderOptions options) |
| Loads the file immediately, waiting for it to complete. More...
|
|
AsyncTask | makeAsyncRequest (const Filename filename, const LoaderOptions options) |
| Returns a new AsyncTask object suitable for adding to load_async() to start an asynchronous model load. More...
|
|
AsyncTask | makeAsyncSaveRequest (const Filename filename, const LoaderOptions options, PandaNode node) |
| Returns a new AsyncTask object suitable for adding to save_async() to start an asynchronous model save. More...
|
|
| output (Ostream out) |
|
bool | remove (AsyncTask task) |
| Removes a pending asynchronous load request. Returns true if successful, false otherwise. More...
|
|
| saveAsync (AsyncTask request) |
| Begins an asynchronous save request. To use this call, first call make_async_save_request() to create a new ModelSaveRequest object with the filename you wish to load, and then add that object to the Loader with save_async. This function will return immediately, and the model will be loaded in the background. More...
|
|
bool | saveSync (const Filename filename, const LoaderOptions options, PandaNode node) |
| Saves the file immediately, waiting for it to complete. More...
|
|
| setTaskChain (str task_chain) |
| Specifies the task chain that is used for asynchronous loads. The default is the initial name of the Loader object. More...
|
|
| setTaskManager (AsyncTaskManager task_manager) |
| Specifies the task manager that is used for asynchronous loads. The default is the global task manager. More...
|
|
| stopThreads () |
| Stop any threads used for asynchronous loads. More...
|
|
Public Member Functions inherited from TypedObject |
TypeHandle | getType () |
| Derived classes should override this function to return get_class_type(). More...
|
|
int | getTypeIndex () |
| Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index(). More...
|
|
bool | isExactType (TypeHandle handle) |
| Returns true if the current object is the indicated type exactly. More...
|
|
bool | isOfType (TypeHandle handle) |
| Returns true if the current object is or derives from the indicated type. More...
|
|
Public Member Functions inherited from ReferenceCount |
int | getRefCount () |
| Returns the current reference count. More...
|
|
| ref () |
| Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. More...
|
|
bool | testRefCountIntegrity () |
| Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise. More...
|
|
bool | testRefCountNonzero () |
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise. More...
|
|
bool | unref () |
| Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete(). More...
|
|
Public Member Functions inherited from Namable |
| __init__ (const Namable copy) |
|
| __init__ (str initial_name) |
|
| clearName () |
| Resets the Namable's name to empty. More...
|
|
str | getName () |
|
bool | hasName () |
| Returns true if the Namable has a nonempty name set, false if the name is empty. More...
|
|
Namable | operator= (const Namable other) |
|
| output (Ostream out) |
| Outputs the Namable. This function simply writes the name to the output stream; most Namable derivatives will probably redefine this. More...
|
|
| setName (str name) |
|
A convenient class for loading models from disk, in bam or egg format (or any of a number of other formats implemented by a LoaderFileType, such as ptloader).
This class supports synchronous as well as asynchronous loading. In asynchronous loading, the model is loaded in the background by a thread, and an event will be generated when the model is available. If threading is not available, the asynchronous loading interface may be used, but it loads synchronously.
Begins an asynchronous load request. To use this call, first call make_async_request() to create a new ModelLoadRequest object with the filename you wish to load, and then add that object to the Loader with load_async. This function will return immediately, and the model will be loaded in the background.
To determine when the model has completely loaded, you may poll request->is_ready() from time to time, or set the done_event on the request object and listen for that event. When the model is ready, you may retrieve it via request->get_model().
Begins an asynchronous save request. To use this call, first call make_async_save_request() to create a new ModelSaveRequest object with the filename you wish to load, and then add that object to the Loader with save_async. This function will return immediately, and the model will be loaded in the background.
To determine when the model has completely loaded, you may poll request->is_ready() from time to time, or set the done_event on the request object and listen for that event. When the request is ready, you may retrieve the success or failure via request->get_success().