2
* $Id: BL_ShapeActionActuator.h 16689 2008-09-22 21:49:48Z ben2610 $
4
* ***** BEGIN GPL LICENSE BLOCK *****
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software Foundation,
18
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21
* All rights reserved.
23
* The Original Code is: all of this file.
25
* Contributor(s): none yet.
27
* ***** END GPL LICENSE BLOCK *****
30
#ifndef BL_SHAPEACTIONACTUATOR
31
#define BL_SHAPEACTIONACTUATOR
33
#include "GEN_HashedPtr.h"
34
#include "SCA_IActuator.h"
35
#include "MT_Point3.h"
39
class BL_ShapeActionActuator : public SCA_IActuator
43
BL_ShapeActionActuator(SCA_IObject* gameobj,
44
const STR_String& propname,
45
const STR_String& framepropname,
48
struct bAction *action,
53
PyTypeObject* T=&Type)
54
: SCA_IActuator(gameobj,T),
59
m_startframe (starttime),
62
m_localtime(starttime),
66
m_stridelength(stride),
70
m_framepropname(framepropname),
74
virtual ~BL_ShapeActionActuator();
75
virtual bool Update(double curtime, bool frame);
76
virtual CValue* GetReplica();
77
virtual void ProcessReplica();
79
void SetBlendTime (float newtime);
80
void BlendShape(struct Key* key, float weigth);
82
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetAction);
83
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetBlendin);
84
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetPriority);
85
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetStart);
86
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetEnd);
87
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetFrame);
88
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetProperty);
89
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetFrameProperty);
90
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetBlendtime);
91
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetChannel);
93
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetAction);
94
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetBlendin);
95
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetPriority);
96
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetStart);
97
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetEnd);
98
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetFrame);
99
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetProperty);
100
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetFrameProperty);
101
// KX_PYMETHOD(BL_ActionActuator,GetChannel);
102
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetType);
103
KX_PYMETHOD_DOC(BL_ShapeActionActuator,SetType);
105
virtual PyObject* _getattr(const STR_String& attr);
109
void SetStartTime(float curtime);
110
void SetLocalTime(float curtime);
111
bool ClampLocalTime();
116
/** The frame this action starts */
118
/** The frame this action ends */
120
/** The time this action started */
122
/** The current time of the action */
128
float m_stridelength;
131
struct bAction *m_action;
132
STR_String m_propname;
133
STR_String m_framepropname;
134
vector<float> m_blendshape;
2
* $Id: BL_ShapeActionActuator.h 19826 2009-04-20 23:17:52Z campbellbarton $
4
* ***** BEGIN GPL LICENSE BLOCK *****
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software Foundation,
18
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21
* All rights reserved.
23
* The Original Code is: all of this file.
25
* Contributor(s): none yet.
27
* ***** END GPL LICENSE BLOCK *****
30
#ifndef BL_SHAPEACTIONACTUATOR
31
#define BL_SHAPEACTIONACTUATOR
33
#include "GEN_HashedPtr.h"
34
#include "SCA_IActuator.h"
35
#include "BL_ActionActuator.h"
36
#include "MT_Point3.h"
40
class BL_ShapeActionActuator : public SCA_IActuator
44
BL_ShapeActionActuator(SCA_IObject* gameobj,
45
const STR_String& propname,
46
const STR_String& framepropname,
49
struct bAction *action,
54
PyTypeObject* T=&Type)
55
: SCA_IActuator(gameobj,T),
60
m_startframe (starttime),
63
m_localtime(starttime),
67
m_stridelength(stride),
71
m_framepropname(framepropname),
75
virtual ~BL_ShapeActionActuator();
76
virtual bool Update(double curtime, bool frame);
77
virtual CValue* GetReplica();
78
virtual void ProcessReplica();
80
void SetBlendTime (float newtime);
81
void BlendShape(struct Key* key, float weigth);
83
bAction* GetAction() { return m_action; }
84
void SetAction(bAction* act) { m_action= act; }
86
KX_PYMETHOD_DOC_VARARGS(BL_ShapeActionActuator,SetAction);
87
KX_PYMETHOD_DOC_VARARGS(BL_ShapeActionActuator,SetBlendin);
88
KX_PYMETHOD_DOC_VARARGS(BL_ShapeActionActuator,SetPriority);
89
KX_PYMETHOD_DOC_VARARGS(BL_ShapeActionActuator,SetStart);
90
KX_PYMETHOD_DOC_VARARGS(BL_ShapeActionActuator,SetEnd);
91
KX_PYMETHOD_DOC_VARARGS(BL_ShapeActionActuator,SetFrame);
92
KX_PYMETHOD_DOC_VARARGS(BL_ShapeActionActuator,SetProperty);
93
KX_PYMETHOD_DOC_VARARGS(BL_ShapeActionActuator,SetFrameProperty);
94
KX_PYMETHOD_DOC_VARARGS(BL_ShapeActionActuator,SetBlendtime);
95
KX_PYMETHOD_DOC_VARARGS(BL_ShapeActionActuator,SetChannel);
97
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetAction);
98
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetBlendin);
99
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetPriority);
100
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetStart);
101
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetEnd);
102
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetFrame);
103
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetProperty);
104
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetFrameProperty);
105
// KX_PYMETHOD(BL_ActionActuator,GetChannel);
106
KX_PYMETHOD_DOC_NOARGS(BL_ShapeActionActuator,GetType);
107
KX_PYMETHOD_DOC_VARARGS(BL_ShapeActionActuator,SetType);
109
virtual PyObject* py_getattro(PyObject* attr);
110
virtual PyObject* py_getattro_dict();
111
virtual int py_setattro(PyObject* attr, PyObject* value);
113
static PyObject* pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
114
static int pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
116
static int CheckBlendTime(void *self, const PyAttributeDef*)
118
BL_ShapeActionActuator* act = reinterpret_cast<BL_ShapeActionActuator*>(self);
120
if (act->m_blendframe > act->m_blendin)
121
act->m_blendframe = act->m_blendin;
125
static int CheckFrame(void *self, const PyAttributeDef*)
127
BL_ShapeActionActuator* act = reinterpret_cast<BL_ShapeActionActuator*>(self);
129
if (act->m_localtime < act->m_startframe)
130
act->m_localtime = act->m_startframe;
131
else if (act->m_localtime > act->m_endframe)
132
act->m_localtime = act->m_endframe;
136
static int CheckType(void *self, const PyAttributeDef*)
138
BL_ShapeActionActuator* act = reinterpret_cast<BL_ShapeActionActuator*>(self);
140
switch (act->m_playtype) {
141
case ACT_ACTION_PLAY:
142
case ACT_ACTION_FLIPPER:
143
case ACT_ACTION_LOOP_STOP:
144
case ACT_ACTION_LOOP_END:
145
case ACT_ACTION_FROM_PROP:
148
PyErr_SetString(PyExc_ValueError, "Shape Action Actuator, invalid play type supplied");
156
void SetStartTime(float curtime);
157
void SetLocalTime(float curtime);
158
bool ClampLocalTime();
163
/** The frame this action starts */
165
/** The frame this action ends */
167
/** The time this action started */
169
/** The current time of the action */
175
float m_stridelength;
178
struct bAction *m_action;
179
STR_String m_framepropname;
180
STR_String m_propname;
181
vector<float> m_blendshape;