Blender  V2.59
KX_ArmatureSensor.h
Go to the documentation of this file.
00001 /*
00002  * $Id: KX_ArmatureSensor.h 35063 2011-02-22 10:33:14Z jesterking $
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 
00035 #ifndef __KX_ARMATURESENSOR
00036 #define __KX_ARMATURESENSOR
00037 
00038 struct bConstraint;
00039 
00040 #include "SCA_ISensor.h"
00041 #include "DNA_sensor_types.h"
00042 
00043 class KX_ArmatureSensor : public SCA_ISensor
00044 {
00045         Py_Header;
00046         //class CExpression*    m_rightexpr;
00047 
00048 protected:
00049 
00050 public:
00051         KX_ArmatureSensor(class SCA_EventManager* eventmgr,
00052                                         SCA_IObject* gameobj,
00053                                         const char *posechannel,
00054                                         const char *constraintname,
00055                                         int type,
00056                                         float value);
00057         
00062         virtual ~KX_ArmatureSensor();
00063         virtual CValue* GetReplica();
00064         virtual void ReParent(SCA_IObject* parent);
00065         virtual void Init();
00066         virtual bool Evaluate();
00067         virtual bool IsPositiveTrigger();
00068 
00069         // identify the constraint that this actuator controls
00070         void FindConstraint();
00071 
00072 #ifdef WITH_PYTHON
00073 
00074         /* --------------------------------------------------------------------- */
00075         /* Python interface ---------------------------------------------------- */
00076         /* --------------------------------------------------------------------- */
00077         static PyObject* pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
00078 
00079 #endif // WITH_PYTHON
00080 
00081 private:
00082         struct bConstraint*     m_constraint;
00083         STR_String              m_posechannel;
00084         STR_String              m_constraintname;
00085         int                             m_type;
00086         float                   m_value;
00087         bool                    m_result;
00088         bool                    m_lastresult;
00089 };
00090 
00091 #endif
00092