98 nassertr(xtemplate !=
nullptr, *
this);
115 nassertr(xtemplate !=
nullptr, *
this);
130 nassertr(xtemplate !=
nullptr, *
this);
136 (*node)[
"index"] = index;
137 (*node)[
"indexColor"] = LCAST(
double, color);
148 nassertr(xtemplate !=
nullptr, *
this);
174 out <<
"(" << get_type() <<
"::output_data() not implemented.)";
181write_data(std::ostream &out,
int indent_level,
const char *)
const {
183 <<
"(" << get_type() <<
"::write_data() not implemented.)\n";
189void XFileDataObject::
190set_int_value(
int int_value) {
198void XFileDataObject::
199set_double_value(
double double_value) {
201 <<
get_type_name() <<
" does not support floating-point values.\n";
207void XFileDataObject::
208set_string_value(
const string &string_value) {
218void XFileDataObject::
219store_double_array(
int num_elements,
const double *values) {
220 if (get_num_elements() != num_elements) {
223 << num_elements <<
" values.\n";
227 for (
int i = 0;
i < num_elements;
i++) {
228 get_element(
i)->set_double_value(values[
i]);
237get_int_value()
const {
244double XFileDataObject::
245get_double_value()
const {
252string XFileDataObject::
253get_string_value()
const {
262void XFileDataObject::
263get_double_array(
int num_elements,
double *values)
const {
264 if (get_num_elements() != num_elements) {
267 << num_elements <<
" values.\n";
271 for (
int i = 0;
i < num_elements;
i++) {
281get_num_elements()
const {
291 <<
"Looking for [" << n <<
"] within data object of type "
292 <<
get_type_name() <<
", does not support nested objects.\n";
301get_element(
const string &name) {
303 <<
"Looking for [\"" << name <<
"\"] within data object of type "
304 <<
get_type_name() <<
", does not support nested objects.\n";
TypeHandle is the identifier used to differentiate C++ class types.
get_name
Returns the name of the type.
This is a node which contains all of the data elements defined by a template.
void zero_fill()
Fills the data node with zero-valued elements appropriate to the template.
An double-valued data element.
An integer-valued data element.
An string-valued data element.
The abstract base class for a number of different types of data elements that may be stored in the X ...
const XFileDataDef * get_data_def() const
Returns the data object that this object is represented by, if any, or NULL if there is none.
void set(int int_value)
Stores the indicated integer value into the object, if it makes sense to do so.
virtual std::string get_type_name() const
Returns a string that represents the type of object this data object represents.
XFileDataObject & add_int(int int_value)
Appends a new integer value to the data object, if it makes sense to do so.
virtual bool is_complex_object() const
Returns true if this kind of data object is a complex object that can hold nested data elements,...
int i() const
Unambiguously returns the object's representation as an integer, or 0 if the object has no integer re...
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.
XFileDataObject & add_MeshFace(XFile *x_file)
Appends a new MeshFace instance.
virtual void output_data(std::ostream &out) const
Writes a suitable representation of this node to an .x file in text mode.
XFileDataObject & add_Vector(XFile *x_file, const LVecBase3d &vector)
Appends a new Vector instance.
XFileDataObject & add_double(double double_value)
Appends a new floating-point value to the data object, if it makes sense to do so.
XFileDataObject & add_IndexedColor(XFile *x_file, int index, const LColor &color)
Appends a new IndexedColor 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.
virtual bool add_element(XFileDataObject *element)
Adds the indicated element as a nested data element, if this data object type supports it.
XFileDataObject & add_Coords2d(XFile *x_file, const LVecBase2d &coords)
Appends a new Coords2d instance.
A template definition in the X file.
This represents the complete contents of an X file (file.x) in memory.
static XFileTemplate * find_standard_template(const std::string &name)
Returns the standard template associated with the indicated name, if any, or NULL if none.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.