|
|
|
A single node of an X file.
More...
#include "xFileNode.h"
List of all members.
Public Types |
typedef pmap< const
XFileDataDef
*, XFileDataObject * > | PrevData |
Public Member Functions |
|
| XFileNode (XFile *x_file, const string &name) |
| void | add_child (XFileNode *node) |
| | Adds the indicated node as a child of this node.
|
| XFileDataNode * | add_Frame (const string &name) |
| | Creates a new Frame instance, as a child of this node.
|
| XFileDataNode * | add_FrameTransformMatrix (const LMatrix4d &mat) |
| | Creates a new FrameTransformMatrix instance, as a child of this node.
|
| XFileDataNode * | add_Material (const string &name, const Colorf &face_color, double power, const RGBColorf &specular_color, const RGBColorf &emissive_color) |
| | Creates a new Material instance, as a child of this node.
|
| XFileDataNode * | add_Mesh (const string &name) |
| | Creates a new Mesh instance, as a child of this node.
|
| XFileDataNode * | add_MeshMaterialList (const string &name) |
| | Creates a new MeshMaterialList instance, as a child of this node.
|
| XFileDataNode * | add_MeshNormals (const string &name) |
| | Creates a new MeshNormals instance, as a child of this node.
|
| XFileDataNode * | add_MeshTextureCoords (const string &name) |
| | Creates a new MeshTextureCoords instance, as a child of this node.
|
| XFileDataNode * | add_MeshVertexColors (const string &name) |
| | Creates a new MeshVertexColors instance, as a child of this node.
|
| XFileDataNode * | add_TextureFilename (const string &name, const Filename &filename) |
| | Creates a new TextureFilename instance, as a child of this node.
|
| virtual void | clear () |
| | Removes all children from the node, and otherwise resets it to its initial state.
|
| virtual bool | fill_zero_data (XFileDataObject *object) const |
| | This is similar to repack_data(), except it is used to fill the initial values for a newly-created template object to zero.
|
| XFileNode * | find_child (const string &name) const |
| | Returns the child with the indicated name, if any, or NULL if none.
|
| int | find_child_index (const XFileNode *child) const |
| | Returns the index number of the indicated child, or -1 if none.
|
| int | find_child_index (const string &name) const |
| | Returns the index number of the child with the indicated name, if any, or -1 if none.
|
| XFileNode * | find_descendent (const string &name) const |
| | Returns the first child or descendent found with the indicated name after a depth-first search, if any, or NULL if none.
|
|
virtual TypeHandle | force_init_type () |
| XFileNode * | get_child (int n) const |
| | Returns the nth child of this node.
|
| virtual const WindowsGuid & | get_guid () const |
| | If has_guid() returned true, returns the particular GUID associated with this node.
|
| int | get_num_children () const |
| | Returns the list of children of this node.
|
| int | get_num_objects () const |
| | Returns the list of child objects of this node.
|
| XFileDataNode * | get_object (int n) const |
| | Returns the nth child object of this node.
|
|
virtual TypeHandle | get_type () const |
|
XFile * | get_x_file () const |
| virtual bool | has_guid () const |
| | Returns true if this node has a GUID associated.
|
| virtual bool | is_object () const |
| | Returns true if this node represents a data object that is the instance of some template, or false otherwise.
|
| virtual bool | is_reference () const |
| | Returns true if this node represents an indirect reference to an object defined previously in the file.
|
| virtual bool | is_standard_object (const string &template_name) const |
| | Returns true if this node represents an instance of the standard template with the indicated name, or false otherwise.
|
| virtual bool | is_template_def () const |
| | Returns true if this node represents the definition of some template.
|
| virtual bool | matches (const XFileNode *other) const |
| | Returns true if the node, particularly a template node, is structurally equivalent to the other node (which must be of the same type).
|
| virtual bool | repack_data (XFileDataObject *object, const XFileParseDataList &parse_data_list, PrevData &prev_data, size_t &index, size_t &sub_index) const |
| | This is called on the template that defines an object, once the data for the object has been parsed.
|
| virtual void | write_text (ostream &out, int indent_level) const |
| | Writes a suitable representation of this node to an .x file in text mode.
|
Static Public Member Functions |
|
static TypeHandle | get_class_type () |
| static void | init_type () |
| | This function is declared non-inline to work around a compiler bug in g++ 2.96.
|
| static string | make_nice_name (const string &str) |
| | Transforms the indicated egg name to a name that is acceptable for a node in the X File format.
|
Protected Types |
|
typedef pvector< PT(XFileNode) > | Children |
|
typedef pmap< string, int > | ChildrenByName |
|
typedef pvector< XFileDataNode * > | Objects |
Protected Attributes |
|
Children | _children |
|
ChildrenByName | _children_by_name |
|
Objects | _objects |
|
XFile * | _x_file |
Friends |
|
class | XFileDataNodeReference |
Detailed Description
A single node of an X file.
This may be either a template or a data node.
Definition at line 42 of file xFileNode.h.
Member Function Documentation
| void XFileNode::add_child |
( |
XFileNode * |
node | ) |
|
Adds the indicated node as a child of this node.
Definition at line 230 of file xFileNode.cxx.
References get_guid(), has_guid(), Namable::has_name(), and TypedObject::is_of_type().
Referenced by add_Frame(), add_FrameTransformMatrix(), add_Material(), add_Mesh(), add_MeshMaterialList(), add_MeshNormals(), add_MeshTextureCoords(), add_MeshVertexColors(), and add_TextureFilename().
| XFileDataNode * XFileNode::add_MeshMaterialList |
( |
const string & |
name | ) |
|
| XFileDataNode * XFileNode::add_MeshNormals |
( |
const string & |
name | ) |
|
| XFileDataNode * XFileNode::add_MeshTextureCoords |
( |
const string & |
name | ) |
|
| XFileDataNode * XFileNode::add_MeshVertexColors |
( |
const string & |
name | ) |
|
| void XFileNode::clear |
( |
void |
| ) |
[virtual] |
| XFileNode * XFileNode::find_child |
( |
const string & |
name | ) |
const |
| int XFileNode::find_child_index |
( |
const string & |
name | ) |
const |
| int XFileNode::find_child_index |
( |
const XFileNode * |
child | ) |
const |
Returns the index number of the indicated child, or -1 if none.
Definition at line 95 of file xFileNode.cxx.
| XFileNode * XFileNode::find_descendent |
( |
const string & |
name | ) |
const |
| XFileNode * XFileNode::get_child |
( |
int |
n | ) |
const [inline] |
| const WindowsGuid & XFileNode::get_guid |
( |
| ) |
const [virtual] |
| int XFileNode::get_num_children |
( |
| ) |
const [inline] |
Returns the list of children of this node.
This list includes templates as well as data objects.
Definition at line 33 of file xFileNode.I.
Referenced by matches().
| int XFileNode::get_num_objects |
( |
| ) |
const [inline] |
| bool XFileNode::has_guid |
( |
| ) |
const [virtual] |
| static void XFileNode::init_type |
( |
| ) |
[inline, static] |
| bool XFileNode::is_object |
( |
| ) |
const [virtual] |
Returns true if this node represents a data object that is the instance of some template, or false otherwise.
This also returns true for references to objects (which are generally treated just like the objects themselves).
If this returns true, the node must be of type XFileDataNode (it is either an XFileDataNodeTemplate or an XFileDataNodeReference).
Reimplemented in XFileDataNode.
Definition at line 203 of file xFileNode.cxx.
| bool XFileNode::is_reference |
( |
| ) |
const [virtual] |
Returns true if this node represents an indirect reference to an object defined previously in the file.
References are generally transparent, so in most cases you never need to call this, unless you actually need to differentiate between references and instances; you can simply use the reference node as if it were itself the object it references.
If this returns true, the node must be of type XFileDataNodeReference.
Reimplemented in XFileDataNodeReference.
Definition at line 185 of file xFileNode.cxx.
| bool XFileNode::is_standard_object |
( |
const string & |
template_name | ) |
const [virtual] |
| bool XFileNode::is_template_def |
( |
| ) |
const [virtual] |
Returns true if this node represents the definition of some template.
This is the template definition, not an actual data object that represents an instance of the template. If the file strictly uses standard templates, the presence of template definitions is optional.
If this returns true, the node must be of type XFileTemplate.
Reimplemented in XFileTemplate.
Definition at line 166 of file xFileNode.cxx.
| string XFileNode::make_nice_name |
( |
const string & |
str | ) |
[static] |
Transforms the indicated egg name to a name that is acceptable for a node in the X File format.
Definition at line 557 of file xFileNode.cxx.
| bool XFileNode::matches |
( |
const XFileNode * |
other | ) |
const [virtual] |
| bool XFileNode::repack_data |
( |
XFileDataObject * |
object, |
|
|
const XFileParseDataList & |
parse_data_list, |
|
|
XFileNode::PrevData & |
prev_data, |
|
|
size_t & |
index, |
|
|
size_t & |
sub_index |
|
) |
| const [virtual] |
This is called on the template that defines an object, once the data for the object has been parsed.
It is responsible for identifying which component of the template owns each data element, and packing the data elements appropriately back into the object.
It returns true on success, or false on an error (e.g. not enough data elements, mismatched data type).
Reimplemented in XFileDataDef.
Definition at line 284 of file xFileNode.cxx.
| void XFileNode::write_text |
( |
ostream & |
out, |
|
|
int |
indent_level |
|
) |
| const [virtual] |
The documentation for this class was generated from the following files:
| | |