38AnimGroup(
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;
68AnimGroup(
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) {
146class 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();
184output(std::ostream &out)
const {
185 out << get_type() <<
" " << get_name();
192write(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) <<
"}";
206write_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);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the root of an AnimChannel hierarchy.
This is the base class for AnimChannel and AnimBundle.
static TypedWritable * make_AnimGroup(const FactoryParams ¶ms)
Factory method to generate a AnimGroup object.
get_child
Returns the nth child of the group.
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 sort_descendants()
Sorts the children nodes at each level of the hierarchy into alphabetical order.
virtual void output(std::ostream &out) const
Writes a one-line description of the group.
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.
AnimGroup * find_child(const std::string &name) const
Returns the first descendant found with the indicated name, or NULL if no such descendant exists.
virtual void write(std::ostream &out, int indent_level) const
Writes a brief description of the group and all of its descendants.
static void register_with_read_factory()
Factory method to generate a AnimGroup object.
get_num_children
Returns the number of child nodes of the group.
virtual TypeHandle get_value_type() const
Returns the TypeHandle associated with the ValueType we are concerned with.
virtual void write_datagram(BamWriter *manager, Datagram &me)
Writes the contents of this object to the datagram for shipping out to a Bam file.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
bool read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
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.
A class to retrieve the individual data elements previously stored in a Datagram.
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
std::string get_string()
Extracts a variable-length string.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void add_uint16(uint16_t value)
Adds an unsigned 16-bit integer to the datagram.
void add_string(const std::string &str)
Adds a variable-length string to the datagram.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
A base class for all things which can have a name.
TypeHandle is the identifier used to differentiate C++ class types.
get_name
Returns the name of the type.
Base class for objects that can be written to and read from Bam files.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.