Go to the documentation of this file.
38 AnimGroup(
const string &name) :
40 _children(get_class_type()),
53 _children(get_class_type())
55 if (parent !=
nullptr) {
56 parent->_children.push_back(
this);
57 _root = parent->_root;
68 AnimGroup(
AnimGroup *parent,
const string &name) :
70 _children(get_class_type())
72 nassertv(parent !=
nullptr);
74 parent->_children.push_back(
this);
75 _root = parent->_root;
91 return _children.size();
100 nassertr(n >= 0 && n < (
int)_children.size(),
nullptr);
112 Children::const_iterator ci;
113 for (ci = _children.begin(); ci != _children.end(); ++ci) {
115 if (child->get_name() == name) {
130 Children::const_iterator ci;
131 for (ci = _children.begin(); ci != _children.end(); ++ci) {
133 if (child->get_name() == name) {
137 if (result !=
nullptr) {
146 class AnimGroupAlphabeticalOrder {
149 return a->get_name() < b->get_name();
161 sort(_children.begin(), _children.end(), AnimGroupAlphabeticalOrder());
163 Children::iterator ci;
164 for (ci = _children.begin(); ci != _children.end(); ++ci) {
165 (*ci)->sort_descendants();
177 return TypeHandle::none();
184 output(std::ostream &out)
const {
185 out << get_type() <<
" " << get_name();
192 write(std::ostream &out,
int indent_level)
const {
193 indent(out, indent_level) << *
this;
194 if (!_children.empty()) {
196 write_descendants(out, indent_level + 2);
197 indent(out, indent_level) <<
"}";
206 write_descendants(std::ostream &out,
int indent_level)
const {
207 Children::const_iterator ci;
209 for (ci = _children.begin(); ci != _children.end(); ++ci) {
210 (*ci)->write(out, indent_level);
230 PT(
AnimGroup) new_group = make_copy(parent);
231 nassertr(new_group->get_type() == get_type(), (
AnimGroup *)
this);
233 Children::const_iterator ci;
234 for (ci = _children.begin(); ci != _children.end(); ++ci) {
235 (*ci)->copy_subtree(new_group);
251 for(
int i = 0; i < (int)_children.size(); i++) {
266 for(
int i = 0; i < _num_children; i++)
279 for (
int i = 1; i < _num_children+1; i++) {
280 if (p_list[i] == TypedWritable::Null) {
281 chan_cat->warning() << get_type().
get_name()
282 <<
" Ignoring null child" << std::endl;
284 _children.push_back(DCAST(
AnimGroup, p_list[i]));
287 return _num_children+1;
300 me->fillin(scan, manager);
virtual void write_datagram(BamWriter *manager, Datagram &me)
Writes the contents of this object to the datagram for shipping out to a Bam file.
std::string get_string()
Extracts a variable-length string.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
get_name
Returns the name of the type.
This is the root of an AnimChannel hierarchy.
static void register_with_read_factory()
Factory method to generate a AnimGroup object.
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
get_child
Returns the nth child of the group.
A class to retrieve the individual data elements previously stored in a Datagram.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Base class for objects that can be written to and read from Bam files.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void add_string(const std::string &str)
Adds a variable-length string to the datagram.
TypeHandle is the identifier used to differentiate C++ class types.
void add_uint16(uint16_t value)
Adds an unsigned 16-bit integer to the datagram.
AnimGroup * get_child_named(const std::string &name) const
Returns the first child found with the indicated name, or NULL if no such child exists.
get_num_children
Returns the number of child nodes of the group.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
virtual void write(std::ostream &out, int indent_level) const
Writes a brief description of the group and all of its descendants.
PT(AnimGroup) AnimGroup
Returns a full copy of the subtree at this node and below.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the base class for AnimChannel and AnimBundle.
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual TypeHandle get_value_type() const
Returns the TypeHandle associated with the ValueType we are concerned with.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void output(std::ostream &out) const
Writes a one-line description of the group.
bool read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.
A base class for all things which can have a name.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static TypedWritable * make_AnimGroup(const FactoryParams ¶ms)
Factory method to generate a AnimGroup object.
AnimGroup * find_child(const std::string &name) const
Returns the first descendant found with the indicated name, or NULL if no such descendant exists.
void sort_descendants()
Sorts the children nodes at each level of the hierarchy into alphabetical order.
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Takes in a vector of pointes to TypedWritable objects that correspond to all the requests for pointer...
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...