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