Panda3D
Loading...
Searching...
No Matches
animGroup.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file animGroup.h
10 * @author drose
11 * @date 1999-02-21
12 */
13
14#ifndef ANIMGROUP_H
15#define ANIMGROUP_H
16
17#include "pandabase.h"
18
20#include "pointerTo.h"
21#include "namable.h"
22#include "luse.h"
23
24class AnimBundle;
25class BamReader;
26class FactoryParams;
27
28/**
29 * This is the base class for AnimChannel and AnimBundle. It implements a
30 * hierarchy of AnimChannels. The root of the hierarchy must be an
31 * AnimBundle.
32 */
33class EXPCL_PANDA_CHAN AnimGroup : public TypedWritableReferenceCount, public Namable {
34protected:
35 AnimGroup(const std::string &name = "");
36 AnimGroup(AnimGroup *parent, const AnimGroup &copy);
37
38PUBLISHED:
39 // This is the normal AnimGroup constructor.
40 explicit AnimGroup(AnimGroup *parent, const std::string &name);
41 virtual ~AnimGroup();
42
43 int get_num_children() const;
44 AnimGroup *get_child(int n) const;
45 MAKE_SEQ(get_children, get_num_children, get_child);
46
47 AnimGroup *get_child_named(const std::string &name) const;
48 AnimGroup *find_child(const std::string &name) const;
49 void sort_descendants();
50
51 MAKE_SEQ_PROPERTY(children, get_num_children, get_child);
52
53public:
54 virtual TypeHandle get_value_type() const;
55
56PUBLISHED:
57 virtual void output(std::ostream &out) const;
58 virtual void write(std::ostream &out, int indent_level) const;
59
60protected:
61 void write_descendants(std::ostream &out, int indent_level) const;
62
63 virtual AnimGroup *make_copy(AnimGroup *parent) const;
64 PT(AnimGroup) copy_subtree(AnimGroup *parent) const;
65
66protected:
67 typedef pvector< PT(AnimGroup) > Children;
68 Children _children;
69 AnimBundle *_root;
70
71public:
72 static void register_with_read_factory();
73 virtual void write_datagram(BamWriter* manager, Datagram &me);
74 virtual int complete_pointers(TypedWritable **p_list,
75 BamReader *manager);
76
77 static TypedWritable *make_AnimGroup(const FactoryParams &params);
78
79protected:
80 void fillin(DatagramIterator& scan, BamReader* manager);
81
82private:
83 typedef pvector< std::string > frozenJoints;
84 int _num_children;
85
86public:
87 virtual TypeHandle get_type() const {
88 return get_class_type();
89 }
90 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
91
92 static TypeHandle get_class_type() {
93 return _type_handle;
94 }
95 static void init_type() {
96 TypedWritableReferenceCount::init_type();
97 register_type(_type_handle, "AnimGroup",
98 TypedWritableReferenceCount::get_class_type());
99 }
100
101private:
102 static TypeHandle _type_handle;
103};
104
105inline std::ostream &operator << (std::ostream &out, const AnimGroup &anim) {
106 anim.output(out);
107 return out;
108}
109
110#include "animGroup.I"
111
112#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the root of an AnimChannel hierarchy.
Definition animBundle.h:29
This is the base class for AnimChannel and AnimBundle.
Definition animGroup.h:33
static TypedWritable * make_AnimGroup(const FactoryParams &params)
Factory method to generate a AnimGroup object.
get_child
Returns the nth child of the group.
Definition animGroup.h:45
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.
Definition animGroup.h:45
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...
Definition bamReader.h:110
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition datagram.h:38
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void output(std::ostream &out) const
Outputs the Namable.
Definition namable.I:61
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
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.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.