Panda3D
|
A node of this type is created automatically at the root of each model file that is loaded. More...
#include "modelRoot.h"
Classes | |
class | ModelReference |
Public Member Functions | |
ModelRoot (const string &name) | |
virtual TypeHandle | force_init_type () |
const Filename & | get_fullpath () const |
Returns the full pathname of the model represented by this node, as found on disk. | |
int | get_model_ref_count () const |
Returns the number of copies that exist of this particular ModelRoot node. | |
ModelReference * | get_reference () const |
Returns the pointer that represents the object shared between all copies of this ModelRoot. | |
virtual TypeHandle | get_type () const |
virtual PandaNode * | make_copy () const |
Returns a newly-allocated Node that is a shallow copy of this one. | |
void | set_fullpath (const Filename &fullpath) |
Sets the full pathname of the model represented by this node, as found on disk. | |
void | set_reference (ModelReference *ref) |
Changes the pointer that represents the object shared between all copies of this ModelRoot. | |
virtual void | write_datagram (BamWriter *manager, Datagram &dg) |
Writes the contents of this object to the datagram for shipping out to a Bam file. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
static void | register_with_read_factory () |
Tells the BamReader how to create objects of type ModelRoot. | |
Protected Member Functions | |
ModelRoot (const ModelRoot ©) | |
void | fillin (DatagramIterator &scan, BamReader *manager) |
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new ModelRoot. | |
Static Protected Member Functions | |
static TypedWritable * | make_from_bam (const FactoryParams ¶ms) |
This function is called by the BamReader's factory when a new object of type ModelRoot is encountered in the Bam file. |
A node of this type is created automatically at the root of each model file that is loaded.
It may eventually contain some information about the contents of the model; at the moment, it contains no special information, but can be used as a flag to indicate the presence of a loaded model file.
Definition at line 31 of file modelRoot.h.
void ModelRoot::fillin | ( | DatagramIterator & | scan, |
BamReader * | manager | ||
) | [protected, virtual] |
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new ModelRoot.
Reimplemented from ModelNode.
Definition at line 83 of file modelRoot.cxx.
Referenced by make_from_bam().
const Filename & ModelRoot::get_fullpath | ( | ) | const [inline] |
Returns the full pathname of the model represented by this node, as found on disk.
This is mainly useful for reference purposes, but is also used to index the ModelRoot into the ModelPool.
Definition at line 54 of file modelRoot.I.
int ModelRoot::get_model_ref_count | ( | ) | const [inline] |
Returns the number of copies that exist of this particular ModelRoot node.
Each time ModelRoot::copy_subgraph() or make_copy() is called (or some other copying mechanism, such as NodePath.copy_to(), is used), this count will increment by one in all copies; when one of the copies is destructed, this count will decrement.
Definition at line 41 of file modelRoot.I.
ModelRoot::ModelReference * ModelRoot::get_reference | ( | ) | const [inline] |
Returns the pointer that represents the object shared between all copies of this ModelRoot.
Since there's not much associated with this object other than a reference count, normally there's not much reason to get the pointer (though it may be compared pointerwise with other ModelRoot objects).
Definition at line 87 of file modelRoot.I.
PandaNode * ModelRoot::make_copy | ( | ) | const [virtual] |
TypedWritable * ModelRoot::make_from_bam | ( | const FactoryParams & | params | ) | [static, protected] |
This function is called by the BamReader's factory when a new object of type ModelRoot is encountered in the Bam file.
It should create the ModelRoot and extract its information from the file.
Reimplemented from ModelNode.
Definition at line 64 of file modelRoot.cxx.
References fillin().
Referenced by register_with_read_factory().
void ModelRoot::register_with_read_factory | ( | ) | [static] |
Tells the BamReader how to create objects of type ModelRoot.
Reimplemented from ModelNode.
Definition at line 40 of file modelRoot.cxx.
References BamReader::get_factory(), make_from_bam(), and Factory< Type >::register_factory().
void ModelRoot::set_fullpath | ( | const Filename & | fullpath | ) | [inline] |
Sets the full pathname of the model represented by this node, as found on disk.
This is mainly useful for reference purposes, but is also used to index the ModelRoot into the ModelPool.
This is normally set automatically when a model is loaded, and should not be set directly by the user. If you change this on a loaded model, then ModelPool::release_model() may fail.
Definition at line 72 of file modelRoot.I.
void ModelRoot::set_reference | ( | ModelRoot::ModelReference * | ref | ) | [inline] |
Changes the pointer that represents the object shared between all copies of this ModelRoot.
This will disassociate this ModelRoot from all of its copies. Normally, there's no reason to do this.
Definition at line 100 of file modelRoot.I.
References ReferenceCount::ref().
void ModelRoot::write_datagram | ( | BamWriter * | manager, |
Datagram & | dg | ||
) | [virtual] |
Writes the contents of this object to the datagram for shipping out to a Bam file.
Reimplemented from ModelNode.
Definition at line 51 of file modelRoot.cxx.