Panda3D

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
XFileDataObject Class Reference

The abstract base class for a number of different types of data elements that may be stored in the X file. More...

`#include "xFileDataObject.h"`

Inheritance diagram for XFileDataObject:

## Public Member Functions
| XFileDataObject (const XFileDataDef *data_def=nullptr)
XFileDataObject & | add_Coords2d (XFile *x_file, const LVecBase2d &coords)
| Appends a new Coords2d instance.
XFileDataObject & | add_double (double double_value)
| Appends a new floating-point value to the data object, if it makes sense to do so.
virtual bool | add_element (XFileDataObject *element)
| Adds the indicated element as a nested data element, if this data object type supports it.
XFileDataObject & | add_IndexedColor (XFile *x_file, int index, const LColor &color)
| Appends a new IndexedColor instance.
XFileDataObject & | add_int (int int_value)
| Appends a new integer value to the data object, if it makes sense to do so.
XFileDataObject & | add_MeshFace (XFile *x_file)
| Appends a new MeshFace instance.
XFileDataObject & | add_string (const std::string &string_value)
| Appends a new string value to the data object, if it makes sense to do so.
XFileDataObject & | add_Vector (XFile *x_file, const LVecBase3d &vector)
| Appends a new Vector instance.
double | d () const
| Unambiguously returns the object's representation as a double, or 0.0 if the object has no double representation.
virtual TypeHandle | force_init_type ()
const XFileDataDef * | get_data_def () const
| Returns the data object that this object is represented by, if any, or NULL if there is none.
virtual TypeHandle | get_type () const
virtual std::string | get_type_name () const
| Returns a string that represents the type of object this data object represents.
int | i () const
| Unambiguously returns the object's representation as an integer, or 0 if the object has no integer representation.
virtual bool | is_complex_object () const
| Returns true if this kind of data object is a complex object that can hold nested data elements, false otherwise.
LMatrix4d | mat4 () const
| Returns the object's representation as an LMatrix4d.
void | operator= (const LMatrix4d &mat)
| Stores the indicated Matrix value into the object, if it makes sense to do so.
void | operator= (const LVecBase2d &vec)
| Stores the indicated Vec2 value into the object, if it makes sense to do so.
void | operator= (const LVecBase3d &vec)
| Stores the indicated Vec3 value into the object, if it makes sense to do so.
void | operator= (const LVecBase4d &vec)
| Stores the indicated Vec4 value into the object, if it makes sense to do so.
void | operator= (const std::string &string_value)
| Stores the indicated string value into the object, if it makes sense to do so.
void | operator= (double double_value)
| Stores the indicated floating-point value into the object, if it makes sense to do so.
void | operator= (int int_value)
| Stores the indicated integer value into the object, if it makes sense to do so.
XFileDataObject & | operator[] (const std::string &name)
| Returns the named nested object within this object.
const XFileDataObject & | operator[] (const std::string &name) const
| Returns the named nested object within this object.
XFileDataObject & | operator[] (int n)
| Returns the nth nested object within this object.
const XFileDataObject & | operator[] (int n) const
| Returns the nth nested object within this object.
virtual void | output_data (std::ostream &out) const
| Writes a suitable representation of this node to an .x file in text mode.
std::string | s () const
| Unambiguously returns the object's representation as a string, or empty string if the object has no string representation.
void | set (const LMatrix4d &mat)
| Stores the indicated Matrix value into the object, if it makes sense to do so.
void | set (const LVecBase2d &vec)
| Stores the indicated Vec2 value into the object, if it makes sense to do so.
void | set (const LVecBase3d &vec)
| Stores the indicated Vec3 value into the object, if it makes sense to do so.
void | set (const LVecBase4d &vec)
| Stores the indicated Vec4 value into the object, if it makes sense to do so.
void | set (const std::string &string_value)
| Stores the indicated string value into the object, if it makes sense to do so.
void | set (double double_value)
| Stores the indicated floating-point value into the object, if it makes sense to do so.
void | set (int int_value)
| Stores the indicated integer value into the object, if it makes sense to do so.
int | size () const
| Returns the number of nested data objects within this object.
LVecBase2d | vec2 () const
| Returns the object's representation as an LVecBase2d.
LVecBase3d | vec3 () const
| Returns the object's representation as an LVecBase3d.
LVecBase4d | vec4 () const
| Returns the object's representation as an LVecBase4d.
virtual void | write_data (std::ostream &out, int indent_level, const char *separator) const
| Writes a suitable representation of this node to an .x file in text mode.
Public Member Functions inherited from ReferenceCount
int | get_ref_count () const
WeakReferenceList * | get_weak_list () const
| Returns the WeakReferenceList associated with this ReferenceCount object.
bool | has_weak_list () const
| Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
void | local_object ()
| This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
void | ref () const
| Explicitly increments the reference count.
bool | ref_if_nonzero () const
| Atomically increases the reference count of this object if it is not zero.
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus.
bool | test_ref_count_nonzero () const
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
virtual bool | unref () const
| Explicitly decrements the reference count.
bool | unref_if_one () const
| Atomically decreases the reference count of this object if it is one.
WeakReferenceList * | weak_ref ()
| Adds the indicated PointerToVoid as a weak reference to this object.
void | weak_unref ()
| Removes the indicated PointerToVoid as a weak reference to this object.
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)

## Static Public Member Functions
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from ReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()

## Additional Inherited Members
Public Attributes inherited from ReferenceCount
| get_ref_count
| Returns the current reference count.

## Detailed Description

The abstract base class for a number of different types of data elements that may be stored in the X file.

Definition at line 30 of file xFileDataObject.h.

## Constructor & Destructor Documentation

## ◆ XFileDataObject()

XFileDataObject::XFileDataObject | ( | const XFileDataDef * | data_def = nullptr | ) |
| inline

Definition at line 17 of file xFileDataObject.I.

## ◆ ~XFileDataObject()

XFileDataObject::~XFileDataObject | ( |  | ) |
| virtual

Definition at line 31 of file xFileDataObject.cxx.

## Member Function Documentation

## ◆ add_Coords2d()

XFileDataObject & XFileDataObject::add_Coords2d | ( | XFile * | x_file,
|  | const LVecBase2d & | coords )

Appends a new Coords2d instance.

Definition at line 145 of file xFileDataObject.cxx.

References add_element(), XFile::find_standard_template(), set(), and XFileDataNodeTemplate::zero_fill().

Referenced by XFileMesh::make_x_uvs().

## ◆ add_double()

XFileDataObject & XFileDataObject::add_double | ( | double | double_value | ) |

Appends a new floating-point value to the data object, if it makes sense to do so.

Normally, this is valid only for a DataObjectArray, or in certain special cases for a DataNodeTemplate.

Definition at line 71 of file xFileDataObject.cxx.

References add_element(), and get_data_def().

## ◆ add_element()

bool XFileDataObject::add_element | ( | XFileDataObject * | element | ) |
| virtual

Adds the indicated element as a nested data element, if this data object type supports it.

Returns true if added successfully, false if the data object type does not support nested data elements.

Reimplemented in XFileDataNodeTemplate, and XFileDataObjectArray.

Definition at line 164 of file xFileDataObject.cxx.

Referenced by add_Coords2d(), add_double(), add_IndexedColor(), add_int(), add_MeshFace(), add_string(), and add_Vector().

## ◆ add_IndexedColor()

XFileDataObject & XFileDataObject::add_IndexedColor | ( | XFile * | x_file,
|  | int | index,
|  | const LColor & | color )

Appends a new IndexedColor instance.

Definition at line 127 of file xFileDataObject.cxx.

References add_element(), XFile::find_standard_template(), and XFileDataNodeTemplate::zero_fill().

Referenced by XFileMesh::make_x_colors().

## ◆ add_int()

XFileDataObject & XFileDataObject::add_int | ( | int | int_value | ) |

Appends a new integer value to the data object, if it makes sense to do so.

Normally, this is valid only for a DataObjectArray, or in certain special cases for a DataNodeTemplate.

Definition at line 58 of file xFileDataObject.cxx.

References add_element(), and get_data_def().

Referenced by XFileMesh::make_x_material_list(), XFileMesh::make_x_mesh(), and XFileMesh::make_x_normals().

## ◆ add_MeshFace()

XFileDataObject & XFileDataObject::add_MeshFace | ( | XFile * | x_file | ) |

Appends a new MeshFace instance.

Definition at line 112 of file xFileDataObject.cxx.

References add_element(), XFile::find_standard_template(), and XFileDataNodeTemplate::zero_fill().

Referenced by XFileMesh::make_x_mesh(), and XFileMesh::make_x_normals().

## ◆ add_string()

XFileDataObject & XFileDataObject::add_string | ( | const std::string & | string_value | ) |

Appends a new string value to the data object, if it makes sense to do so.

Normally, this is valid only for a DataObjectArray, or in certain special cases for a DataNodeTemplate.

Definition at line 84 of file xFileDataObject.cxx.

References add_element(), and get_data_def().

## ◆ add_Vector()

XFileDataObject & XFileDataObject::add_Vector | ( | XFile * | x_file,
|  | const LVecBase3d & | vector )

Appends a new Vector instance.

Definition at line 95 of file xFileDataObject.cxx.

References add_element(), XFile::find_standard_template(), set(), and XFileDataNodeTemplate::zero_fill().

Referenced by XFileMesh::make_x_mesh(), and XFileMesh::make_x_normals().

## ◆ d()

double XFileDataObject::d | ( |  | ) | const
| inline

Unambiguously returns the object's representation as a double, or 0.0 if the object has no double representation.

See also get_data_def() to determine what kind of representation this object has.

Definition at line 187 of file xFileDataObject.I.

Referenced by XFileMesh::fill_skin_weights().

## ◆ force_init_type()

virtual TypeHandle XFileDataObject::force_init_type | ( |  | ) |
| inline virtual

Definition at line 123 of file xFileDataObject.h.

## ◆ get_class_type()

static TypeHandle XFileDataObject::get_class_type | ( |  | ) |
| inline static

Definition at line 112 of file xFileDataObject.h.

## ◆ get_data_def()

const XFileDataDef * XFileDataObject::get_data_def | ( |  | ) | const
| inline

Returns the data object that this object is represented by, if any, or NULL if there is none.

Definition at line 27 of file xFileDataObject.I.

Referenced by add_double(), add_int(), and add_string().

## ◆ get_type()

virtual TypeHandle XFileDataObject::get_type | ( |  | ) | const
| inline virtual

Definition at line 120 of file xFileDataObject.h.

## ◆ get_type_name()

string XFileDataObject::get_type_name | ( |  | ) | const
| virtual

Returns a string that represents the type of object this data object represents.

Reimplemented in XFileDataNode.

Definition at line 48 of file xFileDataObject.cxx.

## ◆ i()

int XFileDataObject::i | ( |  | ) | const
| inline

Unambiguously returns the object's representation as an integer, or 0 if the object has no integer representation.

See also get_data_def() to determine what kind of representation this object has.

Definition at line 177 of file xFileDataObject.I.

Referenced by XFileMesh::fill_colors(), XFileMesh::fill_material_list(), XFileMesh::fill_mesh(), XFileMesh::fill_normals(), XFileMesh::fill_skin_weights(), XFileDataNodeTemplate::write_data(), and XFileDataObjectArray::write_data().

## ◆ init_type()

static void XFileDataObject::init_type | ( |  | ) |
| inline static

Definition at line 115 of file xFileDataObject.h.

## ◆ is_complex_object()

bool XFileDataObject::is_complex_object | ( |  | ) | const
| virtual

Returns true if this kind of data object is a complex object that can hold nested data elements, false otherwise.

Reimplemented in XFileDataNodeReference, XFileDataNodeTemplate, and XFileDataObjectArray.

Definition at line 39 of file xFileDataObject.cxx.

Referenced by XFileDataNodeTemplate::write_data(), and XFileDataObjectArray::write_data().

## ◆ mat4()

LMatrix4d XFileDataObject::mat4 | ( |  | ) | const
| inline

Returns the object's representation as an LMatrix4d.

It is an error if the object does not have sixteen nested objects that store a double value.

Definition at line 239 of file xFileDataObject.I.

## ◆ operator=() [1/7]

void XFileDataObject::operator= | ( | const LMatrix4d & | mat | ) |
| inline

Stores the indicated Matrix value into the object, if it makes sense to do so.

It is an error to call this on an object that does not store sixteen floating-point values.

Definition at line 97 of file xFileDataObject.I.

References set().

## ◆ operator=() [2/7]

void XFileDataObject::operator= | ( | const LVecBase2d & | vec | ) |
| inline

Stores the indicated Vec2 value into the object, if it makes sense to do so.

It is an error to call this on an object that does not store two floating-point values.

Definition at line 67 of file xFileDataObject.I.

References set().

## ◆ operator=() [3/7]

void XFileDataObject::operator= | ( | const LVecBase3d & | vec | ) |
| inline

Stores the indicated Vec3 value into the object, if it makes sense to do so.

It is an error to call this on an object that does not store three floating-point values.

Definition at line 77 of file xFileDataObject.I.

References set().

## ◆ operator=() [4/7]

void XFileDataObject::operator= | ( | const LVecBase4d & | vec | ) |
| inline

Stores the indicated Vec4 value into the object, if it makes sense to do so.

It is an error to call this on an object that does not store four floating-point values.

Definition at line 87 of file xFileDataObject.I.

References set().

## ◆ operator=() [5/7]

void XFileDataObject::operator= | ( | const std::string & | string_value | ) |
| inline

Stores the indicated string value into the object, if it makes sense to do so.

It is an error to call this on an object that cannot accept a string value.

Definition at line 57 of file xFileDataObject.I.

References set().

## ◆ operator=() [6/7]

void XFileDataObject::operator= | ( | double | double_value | ) |
| inline

Stores the indicated floating-point value into the object, if it makes sense to do so.

It is an error to call this on an object that cannot accept a floating-point value.

Definition at line 47 of file xFileDataObject.I.

References set().

## ◆ operator=() [7/7]

void XFileDataObject::operator= | ( | int | int_value | ) |
| inline

Stores the indicated integer value into the object, if it makes sense to do so.

It is an error to call this on an object that cannot accept an integer value.

Definition at line 37 of file xFileDataObject.I.

References set().

## ◆ operator[]() [1/4]

XFileDataObject & XFileDataObject::operator[] | ( | const std::string & | name | ) |
| inline

Returns the named nested object within this object.

It is an error if the named object does not exist. Call find_child() instead if there is any doubt.

Definition at line 293 of file xFileDataObject.I.

## ◆ operator[]() [2/4]

const XFileDataObject & XFileDataObject::operator[] | ( | const std::string & | name | ) | const
| inline

Returns the named nested object within this object.

It is an error if the named object does not exist. Call find_child() instead if there is any doubt.

Definition at line 270 of file xFileDataObject.I.

## ◆ operator[]() [3/4]

XFileDataObject & XFileDataObject::operator[] | ( | int | n | ) |
| inline

Returns the nth nested object within this object.

Call get_num_children() to determine the number of nested objects.

Definition at line 281 of file xFileDataObject.I.

## ◆ operator[]() [4/4]

const XFileDataObject & XFileDataObject::operator[] | ( | int | n | ) | const
| inline

Returns the nth nested object within this object.

Call get_num_children() to determine the number of nested objects.

Definition at line 258 of file xFileDataObject.I.

## ◆ output_data()

void XFileDataObject::output_data | ( | std::ostream & | out | ) | const
| virtual

Writes a suitable representation of this node to an .x file in text mode.

Reimplemented in XFileDataObjectDouble, XFileDataObjectInteger, and XFileDataObjectString.

Definition at line 172 of file xFileDataObject.cxx.

## ◆ s()

std::string XFileDataObject::s | ( |  | ) | const
| inline

Unambiguously returns the object's representation as a string, or empty string if the object has no string representation.

See also get_data_def() to determine what kind of representation this object has.

Definition at line 197 of file xFileDataObject.I.

## ◆ set() [1/7]

void XFileDataObject::set | ( | const LMatrix4d & | mat | ) |
| inline

Stores the indicated Matrix value into the object, if it makes sense to do so.

It is an error to call this on an object that does not store sixteen floating-point values.

Definition at line 167 of file xFileDataObject.I.

## ◆ set() [2/7]

void XFileDataObject::set | ( | const LVecBase2d & | vec | ) |
| inline

Stores the indicated Vec2 value into the object, if it makes sense to do so.

It is an error to call this on an object that does not store two floating-point values.

Definition at line 137 of file xFileDataObject.I.

## ◆ set() [3/7]

void XFileDataObject::set | ( | const LVecBase3d & | vec | ) |
| inline

Stores the indicated Vec3 value into the object, if it makes sense to do so.

It is an error to call this on an object that does not store three floating-point values.

Definition at line 147 of file xFileDataObject.I.

## ◆ set() [4/7]

void XFileDataObject::set | ( | const LVecBase4d & | vec | ) |
| inline

Stores the indicated Vec4 value into the object, if it makes sense to do so.

It is an error to call this on an object that does not store four floating-point values.

Definition at line 157 of file xFileDataObject.I.

## ◆ set() [5/7]

void XFileDataObject::set | ( | const std::string & | string_value | ) |
| inline

Stores the indicated string value into the object, if it makes sense to do so.

It is an error to call this on an object that cannot accept a string value.

Definition at line 127 of file xFileDataObject.I.

## ◆ set() [6/7]

void XFileDataObject::set | ( | double | double_value | ) |
| inline

Stores the indicated floating-point value into the object, if it makes sense to do so.

It is an error to call this on an object that cannot accept a floating-point value.

Definition at line 117 of file xFileDataObject.I.

## ◆ set() [7/7]

void XFileDataObject::set | ( | int | int_value | ) |
| inline

Stores the indicated integer value into the object, if it makes sense to do so.

It is an error to call this on an object that cannot accept an integer value.

Definition at line 107 of file xFileDataObject.I.

Referenced by add_Coords2d(), add_Vector(), operator=(), operator=(), operator=(), operator=(), operator=(), operator=(), and operator=().

## ◆ size()

int XFileDataObject::size | ( |  | ) | const
| inline

Returns the number of nested data objects within this object.

Definition at line 249 of file xFileDataObject.I.

Referenced by XFileMesh::fill_colors(), XFileMesh::fill_material_list(), XFileMesh::fill_mesh(), XFileMesh::fill_normals(), XFileMesh::fill_skin_weights(), XFileMesh::fill_uvs(), XFileMesh::make_x_colors(), XFileMesh::make_x_material_list(), XFileMesh::make_x_mesh(), XFileMesh::make_x_normals(), and XFileMesh::make_x_uvs().

## ◆ vec2()

LVecBase2d XFileDataObject::vec2 | ( |  | ) | const
| inline

Returns the object's representation as an LVecBase2d.

It is an error if the object does not have two nested objects that store a double value.

Definition at line 206 of file xFileDataObject.I.

Referenced by XFileMesh::fill_uvs().

## ◆ vec3()

LVecBase3d XFileDataObject::vec3 | ( |  | ) | const
| inline

Returns the object's representation as an LVecBase3d.

It is an error if the object does not have three nested objects that store a double value.

Definition at line 217 of file xFileDataObject.I.

Referenced by XFileMesh::fill_mesh(), and XFileMesh::fill_normals().

## ◆ vec4()

LVecBase4d XFileDataObject::vec4 | ( |  | ) | const
| inline

Returns the object's representation as an LVecBase4d.

It is an error if the object does not have four nested objects that store a double value.

Definition at line 228 of file xFileDataObject.I.

## ◆ write_data()

void XFileDataObject::write_data | ( | std::ostream & | out,
|  | int | indent_level,
|  | const char * | separator ) const
| virtual

Writes a suitable representation of this node to an .x file in text mode.

Reimplemented in XFileDataNodeTemplate, XFileDataObjectArray, XFileDataObjectDouble, XFileDataObjectInteger, and XFileDataObjectString.

Definition at line 180 of file xFileDataObject.cxx.

References indent().

The documentation for this class was generated from the following files:

- pandatool/src/xfile/xFileDataObject.h
- pandatool/src/xfile/xFileDataObject.cxx
- pandatool/src/xfile/xFileDataObject.I