Blender V2.61 - r43446

BL_ArmatureActuator.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00032 #ifndef BL_ARMATUREACTUATOR
00033 #define BL_ARMATUREACTUATOR
00034 
00035 #include "SCA_IActuator.h"
00036 #include "BL_ArmatureConstraint.h"
00037 
00047 class   BL_ArmatureActuator : public SCA_IActuator
00048 {
00049     Py_Header
00050 public:
00051     BL_ArmatureActuator(SCA_IObject* gameobj,
00052                         int type,
00053                         const char *posechannel,
00054                         const char *constraintname,
00055                         KX_GameObject* targetobj,
00056                         KX_GameObject* subtargetobj,
00057                         float weight);
00058 
00059     virtual ~BL_ArmatureActuator();
00060 
00061     virtual CValue* GetReplica() {
00062         BL_ArmatureActuator* replica = new BL_ArmatureActuator(*this);
00063         replica->ProcessReplica();
00064         return replica;
00065     };
00066     virtual void ProcessReplica();
00067     virtual bool UnlinkObject(SCA_IObject* clientobj);
00068     virtual void Relink(CTR_Map<CTR_HashedPtr, void*> *obj_map);
00069     virtual bool Update(double curtime, bool frame);
00070     virtual void ReParent(SCA_IObject* parent);
00071     
00072 #ifdef WITH_PYTHON
00073 
00074     /* These are used to get and set m_target */
00075     static PyObject* pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
00076     static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
00077     static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
00078 
00079 #endif // WITH_PYTHON
00080 
00081 private:
00082     // identify the constraint that this actuator controls
00083     void FindConstraint();
00084 
00085     BL_ArmatureConstraint*  m_constraint;
00086     KX_GameObject*  m_gametarget;
00087     KX_GameObject*  m_gamesubtarget;
00088     STR_String      m_posechannel;
00089     STR_String      m_constraintname;
00090     float           m_weight;
00091     int             m_type;
00092 };
00093 
00094 #endif //BL_ARMATUREACTUATOR
00095 
00096