diff options
Diffstat (limited to 'source/gameengine/Converter/BL_ArmatureObject.h')
-rw-r--r-- | source/gameengine/Converter/BL_ArmatureObject.h | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/source/gameengine/Converter/BL_ArmatureObject.h b/source/gameengine/Converter/BL_ArmatureObject.h index af0b7dc201c..b7ef38468bb 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.h +++ b/source/gameengine/Converter/BL_ArmatureObject.h @@ -31,21 +31,34 @@ #define BL_ARMATUREOBJECT #include "KX_GameObject.h" +#include "BL_ArmatureConstraint.h" +#include "BL_ArmatureChannel.h" #include "SG_IObject.h" +#include <vector> +#include <algorithm> struct bArmature; struct Bone; +struct bConstraint; class BL_ActionActuator; +class BL_ArmatureActuator; class MT_Matrix4x4; struct Object; +class KX_BlenderSceneConverter; class BL_ArmatureObject : public KX_GameObject { + Py_Header; public: + double GetLastFrame (); short GetActivePriority(); virtual void ProcessReplica(); + virtual void ReParentLogic(); + virtual void Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map); + virtual bool UnlinkObject(SCA_IObject* clientobj); + class BL_ActionActuator * GetActiveAction(); BL_ArmatureObject( @@ -73,6 +86,19 @@ public: Object* GetArmatureObject() {return m_objArma;} + // for constraint python API + void LoadConstraints(KX_BlenderSceneConverter* converter); + size_t GetConstraintNumber() const { return m_constraintNumber; } + BL_ArmatureConstraint* GetConstraint(const char* posechannel, const char* constraint); + BL_ArmatureConstraint* GetConstraint(const char* posechannelconstraint); + BL_ArmatureConstraint* GetConstraint(int index); + // for pose channel python API + void LoadChannels(); + size_t GetChannelNumber() const { return m_constraintNumber; } + BL_ArmatureChannel* GetChannel(bPoseChannel* channel); + BL_ArmatureChannel* GetChannel(const char* channel); + BL_ArmatureChannel* GetChannel(int index); + /// Retrieve the pose matrix for the specified bone. /// Returns true on success. bool GetBoneMatrix(Bone* bone, MT_Matrix4x4& matrix); @@ -81,7 +107,21 @@ public: float GetBoneLength(Bone* bone) const; virtual int GetGameObjectType() { return OBJ_ARMATURE; } + +#ifndef DISABLE_PYTHON + + // PYTHON + static PyObject* pyattr_get_constraints(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + static PyObject* pyattr_get_channels(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef); + KX_PYMETHOD_DOC_NOARGS(BL_ArmatureObject, update); + +#endif // DISABLE_PYTHON + protected: + /* list element: BL_ArmatureConstraint. Use SG_DListHead to have automatic list replication */ + SG_DListHead<BL_ArmatureConstraint> m_controlledConstraints; + /* list element: BL_ArmatureChannel. Use SG_DList to avoid list replication */ + SG_DList m_poseChannels; Object *m_objArma; struct bArmature *m_armature; struct bPose *m_pose; @@ -89,18 +129,23 @@ protected: struct bPose *m_framePose; struct Scene *m_scene; // need for where_is_pose double m_lastframe; + double m_timestep; // delta since last pose evaluation. class BL_ActionActuator *m_activeAct; short m_activePriority; + size_t m_constraintNumber; + size_t m_channelNumber; + // store the original armature object matrix + float m_obmat[4][4]; double m_lastapplyframe; +}; +/* Pose function specific to the game engine */ +void game_blend_poses(struct bPose *dst, struct bPose *src, float srcweight/*, short mode*/); /* was blend_poses */ +//void extract_pose_from_pose(struct bPose *pose, const struct bPose *src); +void game_copy_pose(struct bPose **dst, struct bPose *src, int copy_con); +void game_free_pose(struct bPose *pose); -#ifdef WITH_CXX_GUARDEDALLOC -public: - void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_ArmatureObject"); } - void operator delete( void *mem ) { MEM_freeN(mem); } -#endif -}; #endif |