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
19#include "typedWritableReferenceCount.h"
20#include "pointerTo.h"
21#include "namable.h"
22#include "luse.h"
23
24 class AnimBundle;
25 class BamReader;
26 class 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 */
33 class EXPCL_PANDA_CHAN AnimGroup : public TypedWritableReferenceCount, public Namable {
34 protected:
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
53 public:
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
60 protected:
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
66 protected:
67 typedef pvector< PT(AnimGroup) > Children;
68 Children _children;
69 AnimBundle *_root;
70
71 public:
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
79 protected:
80 void fillin(DatagramIterator& scan, BamReader* manager);
81
82 private:
83 typedef pvector< std::string > frozenJoints;
84 int _num_children;
85
86 public:
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
101 private:
102 static TypeHandle _type_handle;
103};
104
105 inline 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
animGroup.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
AnimBundle
This is the root of an AnimChannel hierarchy.
Definition animBundle.h:29
AnimGroup
This is the base class for AnimChannel and AnimBundle.
Definition animGroup.h:33
AnimGroup::make_AnimGroup
static TypedWritable * make_AnimGroup(const FactoryParams &params)
Factory method to generate a AnimGroup object.
Definition animGroup.cxx:294
AnimGroup::get_child
get_child
Returns the nth child of the group.
Definition animGroup.h:45
AnimGroup::sort_descendants
void sort_descendants()
Sorts the children nodes at each level of the hierarchy into alphabetical order.
Definition animGroup.cxx:160
AnimGroup::output
virtual void output(std::ostream &out) const
Writes a one-line description of the group.
Definition animGroup.cxx:184
AnimGroup::get_child_named
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.
Definition animGroup.cxx:111
AnimGroup::find_child
AnimGroup * find_child(const std::string &name) const
Returns the first descendant found with the indicated name, or NULL if no such descendant exists.
Definition animGroup.cxx:129
AnimGroup::write
virtual void write(std::ostream &out, int indent_level) const
Writes a brief description of the group and all of its descendants.
Definition animGroup.cxx:192
AnimGroup::register_with_read_factory
static void register_with_read_factory()
Factory method to generate a AnimGroup object.
Definition animGroup.cxx:308
AnimGroup::get_num_children
get_num_children
Returns the number of child nodes of the group.
Definition animGroup.h:45
AnimGroup::get_value_type
virtual TypeHandle get_value_type() const
Returns the TypeHandle associated with the ValueType we are concerned with.
Definition animGroup.cxx:176
AnimGroup::write_datagram
virtual void write_datagram(BamWriter *manager, Datagram &me)
Writes the contents of this object to the datagram for shipping out to a Bam file.
BamReader
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition bamReader.h:110
DatagramIterator
A class to retrieve the individual data elements previously stored in a Datagram.
Definition datagramIterator.h:30
Datagram
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition datagram.h:38
FactoryParams
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition factoryParams.h:36
Namable::output
void output(std::ostream &out) const
Outputs the Namable.
Definition namable.I:61
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
TypedWritable::fillin
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...
Definition typedWritable.cxx:103
TypedWritable::complete_pointers
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().
Definition typedWritable.cxx:81
pvector< std::string >
luse.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
namable.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition register_type.I:22
typedWritableReferenceCount.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.