Panda3D
|
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...
#include <pandadoc.hpp>
Classes | |
class | Results |
Public Member Functions | |
__init__ (const Loader) | |
__init__ (str name) | |
str | getTaskChain () |
Returns the task chain that is used for asynchronous loads. | |
AsyncTaskManager | getTaskManager () |
Returns the task manager that is used for asynchronous loads. | |
loadAsync (AsyncTask request) | |
Begins an asynchronous load request. | |
PandaNode | loadBamStream (Istream in) |
Attempts to read a bam file from the indicated stream and return the scene graph defined there. | |
PandaNode | loadSync (const Filename filename, const LoaderOptions options) |
Loads the file immediately, waiting for it to complete. | |
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. | |
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. | |
output (Ostream out) | |
bool | remove (AsyncTask task) |
Removes a pending asynchronous load request. | |
saveAsync (AsyncTask request) | |
Begins an asynchronous save request. | |
bool | saveSync (const Filename filename, const LoaderOptions options, PandaNode node) |
Saves the file immediately, waiting for it to complete. | |
setTaskChain (str task_chain) | |
Specifies the task chain that is used for asynchronous loads. | |
setTaskManager (AsyncTaskManager task_manager) | |
Specifies the task manager that is used for asynchronous loads. | |
stopThreads () | |
Stop any threads used for asynchronous loads. | |
![]() | |
TypeHandle | getType () |
int | getTypeIndex () |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
bool | isExactType (TypeHandle handle) |
Returns true if the current object is the indicated type exactly. | |
bool | isOfType (TypeHandle handle) |
Returns true if the current object is or derives from the indicated type. | |
![]() | |
int | getRefCount () |
Returns the current reference count. | |
ref () | |
Explicitly increments the reference count. | |
bool | testRefCountIntegrity () |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | testRefCountNonzero () |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. | |
bool | unref () |
Explicitly decrements the reference count. | |
![]() | |
__init__ (const Namable) | |
__init__ (str initial_name) | |
clearName () | |
Resets the Namable's name to empty. | |
str | getName () |
bool | hasName () |
Returns true if the Namable has a nonempty name set, false if the name is empty. | |
output (Ostream out) | |
Outputs the Namable. | |
setName (str name) | |
Static Public Member Functions | |
static TypeHandle | getClassType () |
static Loader | getGlobalPtr () |
Returns a pointer to the global Loader. | |
![]() | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
![]() | |
static TypeHandle | getClassType () |
Additional Inherited Members | |
![]() | |
TypeHandle | type |
Returns the TypeHandle representing this object's type. | |
![]() | |
int | ref_count |
The current reference count. | |
![]() | |
const String | 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.
__init__ | ( | const Loader | ) |
__init__ | ( | str | name | ) |
|
static |
|
static |
str getTaskChain | ( | ) |
Returns the task chain that is used for asynchronous loads.
AsyncTaskManager getTaskManager | ( | ) |
Returns the task manager that is used for asynchronous loads.
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.
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().
Attempts to read a bam file from the indicated stream and return the scene graph defined there.
PandaNode loadSync | ( | const Filename | filename, |
const LoaderOptions | options ) |
Loads the file immediately, waiting for it to complete.
If search is true, the file is searched for along the model path; otherwise, only the exact filename is loaded.
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.
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.
output | ( | Ostream | out | ) |
bool remove | ( | AsyncTask | task | ) |
Removes a pending asynchronous load request.
Returns true if successful, false otherwise.
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.
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().
bool saveSync | ( | const Filename | filename, |
const LoaderOptions | options, | ||
PandaNode | node ) |
Saves the file immediately, waiting for it to complete.
setTaskChain | ( | str | task_chain | ) |
Specifies the task chain that is used for asynchronous loads.
The default is the initial name of the Loader object.
setTaskManager | ( | AsyncTaskManager | task_manager | ) |
Specifies the task manager that is used for asynchronous loads.
The default is the global task manager.
stopThreads | ( | ) |
Stop any threads used for asynchronous loads.