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