expose interfaces for constructing Characters and associated joint hierarchies via Python

This commit is contained in:
David Rose 2008-11-05 19:33:04 +00:00
parent 32ec0dd1c6
commit 440746d3a4
23 changed files with 58 additions and 42 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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

View File

@ -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;
}

View File

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

View File

@ -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:

View File

@ -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);

View File

@ -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:

View File

@ -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;

View File

@ -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"

View File

@ -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,

View File

@ -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) {

View File

@ -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();

View File

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

View File

@ -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 \

View File

@ -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

View File

@ -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"

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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"