Browse Source

expose interfaces for constructing Characters and associated joint hierarchies via Python

David Rose 17 years ago
parent
commit
440746d3a4

+ 1 - 0
panda/src/chan/animChannelMatrixXfmTable.cxx

@@ -273,6 +273,7 @@ set_table(char table_id, const CPTA_float &table) {
   if (table.size() > 1 && (int)table.size() < num_frames) {
     // The new table has an invalid number of frames--it doesn't match
     // the bundle's requirement.
+    nassertv(false);
     return;
   }
 

+ 3 - 3
panda/src/chan/animChannelMatrixXfmTable.h

@@ -36,11 +36,11 @@ protected:
   AnimChannelMatrixXfmTable();
   AnimChannelMatrixXfmTable(AnimGroup *parent, const AnimChannelMatrixXfmTable &copy);
 
-public:
+PUBLISHED:
   AnimChannelMatrixXfmTable(AnimGroup *parent, const string &name);
   virtual ~AnimChannelMatrixXfmTable();
   
-
+public:
   virtual bool has_changed(int last_frame, double last_frac, 
                            int this_frame, double this_frac);
   virtual void get_value(int frame, LMatrix4f &mat);
@@ -52,12 +52,12 @@ public:
   virtual void get_pos(int frame, LVecBase3f &pos);
   virtual void get_shear(int frame, LVecBase3f &shear);
 
+PUBLISHED:
   static INLINE bool is_valid_id(char table_id);
 
   void set_table(char table_id, const CPTA_float &table);
   INLINE CPTA_float get_table(char table_id) const;
 
-PUBLISHED:
   void clear_all_tables();
   INLINE bool has_table(char table_id) const;
   INLINE void clear_table(char table_id);

+ 11 - 0
panda/src/chan/animChannelScalarTable.I

@@ -13,6 +13,17 @@
 ////////////////////////////////////////////////////////////////////
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: AnimChannelScalarTable::get_table
+//       Access: Public
+//  Description: Returns a pointer to the table's data,
+//               if it exists, or NULL if it does not.
+////////////////////////////////////////////////////////////////////
+INLINE CPTA_float AnimChannelScalarTable::
+get_table() const {
+  return _table;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: AnimChannelScalarTable::has_table
 //       Access: Published

+ 1 - 0
panda/src/chan/animChannelScalarTable.cxx

@@ -120,6 +120,7 @@ set_table(const CPTA_float &table) {
   if (table.size() > 1 && (int)table.size() < num_frames) {
     // The new table has an invalid number of frames--it doesn't match
     // the bundle's requirement.
+    nassertv(false);
     return;
   }
 

+ 2 - 1
panda/src/chan/animChannelScalarTable.h

@@ -40,9 +40,10 @@ public:
                            int this_frame, double this_frac);
   virtual void get_value(int frame, float &value);
 
+PUBLISHED:
   void set_table(const CPTA_float &table);
+  INLINE CPTA_float get_table() const;
 
-PUBLISHED:
   INLINE bool has_table() const;
   INLINE void clear_table();
 

+ 1 - 3
panda/src/chan/animGroup.h

@@ -38,19 +38,17 @@ protected:
   AnimGroup(const string &name = "");
   AnimGroup(AnimGroup *parent, const AnimGroup &copy);
 
-public:
+PUBLISHED:
   // This is the normal AnimGroup constructor.
   AnimGroup(AnimGroup *parent, const string &name);
   virtual ~AnimGroup();
 
-PUBLISHED:
   int get_num_children() const;
   AnimGroup *get_child(int n) const;
   AnimGroup *find_child(const string &name) const;
 
 public:
   virtual TypeHandle get_value_type() const;
-
   void sort_descendants();
 
 PUBLISHED:

+ 1 - 2
panda/src/chan/partBundle.h

@@ -57,11 +57,10 @@ protected:
   // The copy constructor is protected; use make_copy() or copy_subgraph().
   PartBundle(const PartBundle &copy);
 
-public:
+PUBLISHED:
   PartBundle(const string &name = "");
   virtual PartGroup *make_copy() const;
 
-PUBLISHED:
   INLINE CPT(AnimPreloadTable) get_anim_preload() const;
   INLINE PT(AnimPreloadTable) modify_anim_preload();
   INLINE void set_anim_preload(AnimPreloadTable *table);

+ 1 - 1
panda/src/chan/partBundleNode.h

@@ -31,7 +31,7 @@
 //               make it easy to store PartBundles in the scene graph.
 ////////////////////////////////////////////////////////////////////
 class EXPCL_PANDA_CHAN PartBundleNode : public PandaNode {
-public:
+PUBLISHED:
   INLINE PartBundleNode(const string &name, PartBundle *bundle);
 
 protected:

+ 2 - 3
panda/src/chan/partGroup.h

@@ -57,12 +57,12 @@ public:
 protected:
   // The default constructor is protected: don't try to create a
   // PartGroup without a parent.  To create a PartGroup hierarchy, you
-  // must first create a PartBundle, and use that to create any
+  // must first create a PartBundle, and use that as the parent of any
   // subsequent children.
   INLINE PartGroup(const string &name = "");
   INLINE PartGroup(const PartGroup &copy);
 
-public:
+PUBLISHED:
   // This is the normal PartGroup constructor.
   PartGroup(PartGroup *parent, const string &name);
   virtual ~PartGroup();
@@ -70,7 +70,6 @@ public:
   virtual PartGroup *make_copy() const;
   PartGroup *copy_subgraph() const;
 
-PUBLISHED:
   int get_num_children() const;
   PartGroup *get_child(int n) const;
   PartGroup *find_child(const string &name) const;

+ 2 - 3
panda/src/char/character.h

@@ -42,10 +42,11 @@ class EXPCL_PANDA_CHAR Character : public PartBundleNode {
 protected:
   Character(const Character &copy, bool copy_bundles);
 
-public:
+PUBLISHED:
   Character(const string &name);
   virtual ~Character();
 
+public:
   virtual PandaNode *make_copy() const;
   virtual PandaNode *dupe_for_flatten() const;
 
@@ -163,8 +164,6 @@ public:
 
 private:
   static TypeHandle _type_handle;
-
-  friend class CharacterMaker;
 };
 
 #include "character.I"

+ 2 - 1
panda/src/char/characterJoint.h

@@ -34,12 +34,13 @@ protected:
   CharacterJoint();
   CharacterJoint(const CharacterJoint &copy);
 
-public:
+PUBLISHED:
   CharacterJoint(Character *character,
                  PartBundle *root, PartGroup *parent, const string &name,
                  const LMatrix4f &initial_value);
   virtual ~CharacterJoint();
 
+public:
   virtual PartGroup *make_copy() const;
 
   virtual bool update_internals(PartBundle *root, PartGroup *parent, 

+ 3 - 1
panda/src/char/characterJointBundle.cxx

@@ -23,7 +23,9 @@ TypeHandle CharacterJointBundle::_type_handle;
 ////////////////////////////////////////////////////////////////////
 //     Function: CharacterJointBundle::Constructor
 //       Access: Public
-//  Description:
+//  Description: Normally, there is no need to create a
+//               CharacterJointBundle directly.  The Character node
+//               will automatically create one for itself.
 ////////////////////////////////////////////////////////////////////
 CharacterJointBundle::
 CharacterJointBundle(const string &name) : PartBundle(name) {

+ 1 - 1
panda/src/char/characterJointBundle.h

@@ -32,7 +32,7 @@ class EXPCL_PANDA_CHAR CharacterJointBundle : public PartBundle {
 protected:
   INLINE CharacterJointBundle(const CharacterJointBundle &copy);
 
-public:
+PUBLISHED:
   CharacterJointBundle(const string &name = "");
   virtual ~CharacterJointBundle();
 

+ 1 - 1
panda/src/char/characterSlider.h

@@ -33,7 +33,7 @@ protected:
   CharacterSlider();
   CharacterSlider(const CharacterSlider &copy);
 
-public:
+PUBLISHED:
   CharacterSlider(PartGroup *parent, const string &name);
   virtual ~CharacterSlider();
 

+ 6 - 6
panda/src/express/Sources.pp

@@ -43,7 +43,7 @@
     pointerToVoid.I pointerToVoid.h \
     profileTimer.I profileTimer.h \
     pStatCollectorForwardBase.h \
-    pta_uchar.h \
+    pta_uchar.h pta_float.h \
     ramfile.I ramfile.h \
     referenceCount.I referenceCount.h \
     stringDecoder.h stringDecoder.I \
@@ -54,7 +54,7 @@
     trueClock.I trueClock.h \
     typedReferenceCount.I typedReferenceCount.h typedef.h \
     unicodeLatinMap.h \
-    vector_uchar.h \
+    vector_uchar.h vector_float.h \
     virtualFileComposite.h virtualFileComposite.I virtualFile.h \
     virtualFile.I virtualFileList.I virtualFileList.h virtualFileMount.h \
     virtualFileMount.I virtualFileMountMultifile.h \
@@ -93,7 +93,7 @@
     pointerToVoid.cxx \
     profileTimer.cxx \
     pStatCollectorForwardBase.cxx \
-    pta_uchar.cxx \
+    pta_uchar.cxx pta_float.cxx \
     ramfile.cxx \
     referenceCount.cxx \
     stringDecoder.cxx \
@@ -104,7 +104,7 @@
     trueClock.cxx \
     typedReferenceCount.cxx \
     unicodeLatinMap.cxx \
-    vector_uchar.cxx \
+    vector_uchar.cxx vector_float.cxx \
     virtualFileComposite.cxx virtualFile.cxx virtualFileList.cxx \
     virtualFileMount.cxx \
     virtualFileMountMultifile.cxx virtualFileMountSystem.cxx \
@@ -151,7 +151,7 @@
     pointerToVoid.I pointerToVoid.h \
     profileTimer.I profileTimer.h \
     pStatCollectorForwardBase.h \
-    pta_uchar.h \
+    pta_uchar.h pta_float.h \
     ramfile.I ramfile.h \
     referenceCount.I referenceCount.h \
     stringDecoder.h stringDecoder.I \
@@ -162,7 +162,7 @@
     trueClock.I trueClock.h \
     typedReferenceCount.I typedReferenceCount.h typedef.h \
     unicodeLatinMap.h \
-    vector_uchar.h \
+    vector_uchar.h vector_float.h \
     virtualFileComposite.h virtualFileComposite.I virtualFile.h \
     virtualFile.I virtualFileList.I virtualFileList.h virtualFileMount.h \
     virtualFileMount.I virtualFileMountMultifile.h \

+ 5 - 1
panda/src/express/config_express.N

@@ -45,6 +45,10 @@ forcetype iostream
 
 forcetype PointerToArray<unsigned char>
 forcetype ConstPointerToArray<unsigned char>
-
 renametype PointerToArray<unsigned char> PTAUchar
 renametype ConstPointerToArray<unsigned char> CPTAUchar
+
+forcetype PointerToArray<float>
+forcetype ConstPointerToArray<float>
+renametype PointerToArray<float> PTAFloat
+renametype ConstPointerToArray<float> CPTAFloat

+ 2 - 0
panda/src/express/express_composite2.cxx

@@ -1,4 +1,5 @@
 #include "pta_uchar.cxx"
+#include "pta_float.cxx"
 #include "ramfile.cxx"
 #include "referenceCount.cxx"
 #include "stringDecoder.cxx"
@@ -11,6 +12,7 @@
 #include "typedReferenceCount.cxx"
 #include "unicodeLatinMap.cxx"
 #include "vector_uchar.cxx"
+#include "vector_float.cxx"
 #include "virtualFile.cxx"
 #include "virtualFileComposite.cxx"
 #include "virtualFileList.cxx"

+ 0 - 0
panda/src/putil/pta_float.cxx → panda/src/express/pta_float.cxx


+ 4 - 4
panda/src/putil/pta_float.h → panda/src/express/pta_float.h

@@ -29,10 +29,10 @@
 //               rather than defining the pta again.
 ////////////////////////////////////////////////////////////////////
 
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, RefCountObj<vector_float>);
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, PointerToBase<RefCountObj<vector_float> >);
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, PointerToArray<float>)
-EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_PUTIL, EXPTP_PANDA_PUTIL, ConstPointerToArray<float>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS, RefCountObj<vector_float>);
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS, PointerToBase<RefCountObj<vector_float> >);
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS, PointerToArray<float>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS, ConstPointerToArray<float>)
 
 typedef PointerToArray<float> PTA_float;
 typedef ConstPointerToArray<float> CPTA_float;

+ 0 - 0
panda/src/putil/vector_float.cxx → panda/src/express/vector_float.cxx


+ 2 - 2
panda/src/putil/vector_float.h → panda/src/express/vector_float.h

@@ -28,8 +28,8 @@
 //               rather than defining the vector again.
 ////////////////////////////////////////////////////////////////////
 
-#define EXPCL EXPCL_PANDA_PUTIL
-#define EXPTP EXPTP_PANDA_PUTIL
+#define EXPCL EXPCL_PANDAEXPRESS
+#define EXPTP EXPTP_PANDAEXPRESS
 #define TYPE float
 #define NAME vector_float
 

+ 6 - 6
panda/src/putil/Sources.pp

@@ -55,7 +55,7 @@
     pbitops.I pbitops.h \
     portalMask.h \
     pta_double.h \
-    pta_float.h pta_int.h \
+    pta_int.h \
     simpleHashMap.I simpleHashMap.h \
     sparseArray.I sparseArray.h \
     string_utils.I string_utils.N string_utils.h \
@@ -63,7 +63,7 @@
     typedWritable.h typedWritableReferenceCount.I \
     typedWritableReferenceCount.h updateSeq.I updateSeq.h \
     uniqueIdAllocator.h \
-    vector_double.h vector_float.h vector_typedWritable.h \
+    vector_double.h vector_typedWritable.h \
     vector_ushort.h vector_writable.h \
     writableConfigurable.h \
     writableParam.I writableParam.h 
@@ -100,7 +100,7 @@
     nameUniquifier.cxx \
     nodeCachedReferenceCount.cxx \
     pbitops.cxx \
-    pta_double.cxx pta_float.cxx \
+    pta_double.cxx \
     pta_int.cxx pta_ushort.cxx \
     simpleHashMap.cxx \
     sparseArray.cxx \
@@ -108,7 +108,7 @@
     timedCycle.cxx typedWritable.cxx \
     typedWritableReferenceCount.cxx updateSeq.cxx \
     uniqueIdAllocator.cxx \
-    vector_double.cxx vector_float.cxx \
+    vector_double.cxx \
     vector_typedWritable.cxx \
     vector_ushort.cxx vector_writable.cxx \
     writableConfigurable.cxx writableParam.cxx 
@@ -159,7 +159,7 @@
     portalMask.h \
     pbitops.I pbitops.h \
     pta_double.h \
-    pta_float.h pta_int.h pta_ushort.h \
+    pta_int.h pta_ushort.h \
     simpleHashMap.I simpleHashMap.h \
     sparseArray.I sparseArray.h \
     string_utils.I string_utils.h \
@@ -167,7 +167,7 @@
     typedWritable.h typedWritableReferenceCount.I \
     typedWritableReferenceCount.h updateSeq.I updateSeq.h \
     uniqueIdAllocator.h \
-    vector_double.h vector_float.h vector_typedWritable.h \
+    vector_double.h vector_typedWritable.h \
     vector_ushort.h vector_writable.h \
     writableConfigurable.h writableParam.I \
     writableParam.h

+ 0 - 2
panda/src/putil/putil_composite2.cxx

@@ -11,7 +11,6 @@
 #include "nodeCachedReferenceCount.cxx"
 #include "pbitops.cxx"
 #include "pta_double.cxx"
-#include "pta_float.cxx"
 #include "pta_int.cxx"
 #include "pta_ushort.cxx"
 #include "simpleHashMap.cxx"
@@ -23,7 +22,6 @@
 #include "updateSeq.cxx"
 #include "uniqueIdAllocator.cxx"
 #include "vector_double.cxx"
-#include "vector_float.cxx"
 #include "vector_typedWritable.cxx"
 #include "vector_ushort.cxx"
 #include "vector_writable.cxx"