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