code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo...
[blender-staging.git] / source / gameengine / Ketsji / KX_ArmatureSensor.h
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19  * All rights reserved.
20  *
21  * The Original Code is: all of this file.
22  *
23  * Contributor(s): none yet.
24  *
25  * ***** END GPL LICENSE BLOCK *****
26  */
27
28 /** \file KX_ArmatureSensor.h
29  *  \ingroup ketsji
30  *  \brief Property sensor
31  */
32
33 #ifndef __KX_ARMATURESENSOR_H__
34 #define __KX_ARMATURESENSOR_H__
35
36 struct bConstraint;
37
38 #include "SCA_ISensor.h"
39 #include "DNA_sensor_types.h"
40
41 class KX_ArmatureSensor : public SCA_ISensor
42 {
43         Py_Header
44         //class CExpression*    m_rightexpr;
45
46 protected:
47
48 public:
49         KX_ArmatureSensor(class SCA_EventManager* eventmgr,
50                                         SCA_IObject* gameobj,
51                                         const char *posechannel,
52                                         const char *constraintname,
53                                         int type,
54                                         float value);
55         
56         /** 
57          *  For property sensor, it is used to release the pre-calculated expression
58          *  so that self references are removed before the sensor itself is released
59          */
60         virtual ~KX_ArmatureSensor();
61         virtual CValue* GetReplica();
62         virtual void ReParent(SCA_IObject* parent);
63         virtual void Init();
64         virtual bool Evaluate();
65         virtual bool IsPositiveTrigger();
66
67         // identify the constraint that this actuator controls
68         void FindConstraint();
69
70 #ifdef WITH_PYTHON
71
72         /* --------------------------------------------------------------------- */
73         /* Python interface ---------------------------------------------------- */
74         /* --------------------------------------------------------------------- */
75         static PyObject *pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
76
77 #endif  /* WITH_PYTHON */
78
79 private:
80         struct bConstraint*     m_constraint;
81         STR_String              m_posechannel;
82         STR_String              m_constraintname;
83         int                             m_type;
84         float                   m_value;
85         bool                    m_result;
86         bool                    m_lastresult;
87 };
88
89 #endif
90