Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/chan/animGroup.h

Go to the documentation of this file.
00001 // Filename: animGroup.h
00002 // Created by:  drose (21Feb99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef ANIMGROUP_H
00020 #define ANIMGROUP_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "typedWritableReferenceCount.h"
00025 #include "pointerTo.h"
00026 #include "namable.h"
00027 
00028 class AnimBundle;
00029 class BamReader;
00030 class FactoryParams;
00031 
00032 ////////////////////////////////////////////////////////////////////
00033 //       Class : AnimGroup
00034 // Description : This is the base class for AnimChannel and
00035 //               AnimBundle.  It implements a hierarchy of
00036 //               AnimChannels.  The root of the hierarchy must be an
00037 //               AnimBundle.
00038 ////////////////////////////////////////////////////////////////////
00039 class EXPCL_PANDA AnimGroup : public TypedWritableReferenceCount, public Namable {
00040 protected:
00041   // The default constructor is protected: don't try to create an
00042   // AnimGroup without a parent.  To create an AnimChannel hierarchy,
00043   // you must first create an AnimBundle, and use that to create any
00044   // subsequent children.
00045   AnimGroup(const string &name = "") : Namable(name) { }
00046 
00047 public:
00048   // This is the normal AnimGroup constructor.
00049   AnimGroup(AnimGroup *parent, const string &name);
00050 
00051 PUBLISHED:
00052   int get_num_children() const;
00053   AnimGroup *get_child(int n) const;
00054   AnimGroup *find_child(const string &name) const;
00055 
00056 public:
00057   virtual TypeHandle get_value_type() const;
00058 
00059   void sort_descendants();
00060 
00061 PUBLISHED:
00062   virtual void output(ostream &out) const;
00063   virtual void write(ostream &out, int indent_level) const;
00064 
00065 protected:
00066   void write_descendants(ostream &out, int indent_level) const;
00067 
00068 protected:
00069   typedef pvector< PT(AnimGroup) > Children;
00070   Children _children;
00071   AnimBundle *_root;
00072 
00073 public:
00074   static void register_with_read_factory(void);
00075   virtual void write_datagram(BamWriter* manager, Datagram &me);
00076   virtual int complete_pointers(TypedWritable **p_list,
00077                                 BamReader *manager);
00078 
00079   static TypedWritable *make_AnimGroup(const FactoryParams &params);
00080 
00081 protected:
00082   void fillin(DatagramIterator& scan, BamReader* manager);
00083 
00084 private:
00085   int _num_children;
00086 
00087 public:
00088   virtual TypeHandle get_type() const {
00089     return get_class_type();
00090   }
00091   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00092 
00093   static TypeHandle get_class_type() {
00094     return _type_handle;
00095   }
00096   static void init_type() {
00097     TypedWritableReferenceCount::init_type();
00098     register_type(_type_handle, "AnimGroup",
00099                   TypedWritableReferenceCount::get_class_type());
00100   }
00101 
00102 private:
00103   static TypeHandle _type_handle;
00104 };
00105 
00106 inline ostream &operator << (ostream &out, const AnimGroup &anim) {
00107   anim.output(out);
00108   return out;
00109 }
00110 
00111 #include "animGroup.I"
00112 
00113 #endif
00114 
00115 

Generated on Fri May 2 00:35:05 2003 for Panda by doxygen1.3