Get rid of c++ in blenkernel and modifiers
[blender.git] / source / gameengine / Converter / BL_ActionActuator.cpp
1 /*
2 * $Id$
3 *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
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.
10  *
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.
15  *
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *
20  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21  * All rights reserved.
22  *
23  * The Original Code is: all of this file.
24  *
25  * Contributor(s): none yet.
26  *
27  * ***** END GPL LICENSE BLOCK *****
28 */
29
30 /** \file gameengine/Converter/BL_ActionActuator.cpp
31  *  \ingroup bgeconv
32  */
33
34
35 #include "SCA_LogicManager.h"
36 #include "BL_ActionActuator.h"
37 #include "BL_ArmatureObject.h"
38 #include "BL_SkinDeformer.h"
39 #include "BL_Action.h"
40 #include "KX_GameObject.h"
41 #include "STR_HashedString.h"
42 #include "MEM_guardedalloc.h"
43 #include "DNA_nla_types.h"
44 #include "DNA_action_types.h"
45 #include "DNA_armature_types.h"
46 #include "DNA_scene_types.h"
47 #include "BLI_blenlib.h"
48 #include "BLI_math.h"
49 #include "BLI_utildefines.h"
50 #include "MT_Matrix4x4.h"
51
52 #include "BKE_action.h"
53 #include "FloatValue.h"
54 #include "PyObjectPlus.h"
55 #include "KX_PyMath.h"
56
57 extern "C" {
58 #include "BKE_animsys.h"
59 #include "BKE_action.h"
60 #include "RNA_access.h"
61 #include "RNA_define.h"
62 }
63
64 BL_ActionActuator::BL_ActionActuator(SCA_IObject* gameobj,
65                                         const STR_String& propname,
66                                         const STR_String& framepropname,
67                                         float starttime,
68                                         float endtime,
69                                         struct bAction *action,
70                                         short   playtype,
71                                         short   blendin,
72                                         short   priority,
73                                         short   layer,
74                                         float   layer_weight,
75                                         short   ipo_flags,
76                                         short   end_reset,
77                                         float   stride) 
78         : SCA_IActuator(gameobj, KX_ACT_ACTION),
79                 
80         m_lastpos(0, 0, 0),
81         m_blendframe(0),
82         m_flag(0),
83         m_startframe (starttime),
84         m_endframe(endtime) ,
85         m_starttime(0),
86         m_localtime(starttime),
87         m_lastUpdate(-1),
88         m_blendin(blendin),
89         m_blendstart(0),
90         m_stridelength(stride),
91         m_layer_weight(layer_weight),
92         m_playtype(playtype),
93         m_priority(priority),
94         m_layer(layer),
95         m_ipo_flags(ipo_flags),
96         m_pose(NULL),
97         m_blendpose(NULL),
98         m_userpose(NULL),
99         m_action(action),
100         m_propname(propname),
101         m_framepropname(framepropname)          
102 {
103         if (!end_reset)
104                 m_flag |= ACT_FLAG_CONTINUE;
105 };
106
107 BL_ActionActuator::~BL_ActionActuator()
108 {
109         if (m_pose)
110                 game_free_pose(m_pose);
111         if (m_userpose)
112                 game_free_pose(m_userpose);
113         if (m_blendpose)
114                 game_free_pose(m_blendpose);
115 }
116
117 void BL_ActionActuator::ProcessReplica()
118 {
119         SCA_IActuator::ProcessReplica();
120         
121         m_pose = NULL;
122         m_blendpose = NULL;
123         m_localtime=m_startframe;
124         m_lastUpdate=-1;
125         
126 }
127
128 void BL_ActionActuator::SetBlendTime (float newtime){
129         m_blendframe = newtime;
130 }
131
132 void BL_ActionActuator::SetLocalTime(float curtime)
133 {
134         float dt = (curtime-m_starttime)*KX_KetsjiEngine::GetAnimFrameRate();
135
136         if (m_endframe < m_startframe)
137                 dt = -dt;
138
139         m_localtime = m_startframe + dt;
140         
141         // Handle wrap around
142         if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe))
143         {
144                 switch(m_playtype)
145                 {
146                 case ACT_ACTION_PLAY:
147                         // Clamp
148                         m_localtime = m_endframe;
149                         break;
150                 case ACT_ACTION_LOOP_END:
151                         // Put the time back to the beginning
152                         m_localtime = m_startframe;
153                         m_starttime = curtime;
154                         break;
155                 case ACT_ACTION_PINGPONG:
156                         // Swap the start and end frames
157                         float temp = m_startframe;
158                         m_startframe = m_endframe;
159                         m_endframe = temp;
160
161                         m_starttime = curtime;
162
163                         break;
164                 }
165         }
166 }
167
168 void BL_ActionActuator::ResetStartTime(float curtime)
169 {
170         float dt = m_localtime - m_startframe;
171
172         m_starttime = curtime - dt / (KX_KetsjiEngine::GetAnimFrameRate());
173         //SetLocalTime(curtime);
174 }
175
176 CValue* BL_ActionActuator::GetReplica() {
177         BL_ActionActuator* replica = new BL_ActionActuator(*this);//m_float,GetName());
178         replica->ProcessReplica();
179         return replica;
180 }
181
182 bool BL_ActionActuator::Update(double curtime, bool frame)
183 {
184         bool bNegativeEvent = false;
185         bool bPositiveEvent = false;
186         bool bUseContinue = false;
187         KX_GameObject *obj = (KX_GameObject*)GetParent();
188         short playtype = BL_Action::ACT_MODE_PLAY;
189         float start = m_startframe;
190         float end = m_endframe;
191
192         // If we don't have an action, we can't do anything
193         if (!m_action)
194                 return false;
195
196         // Convert our playtype to one that BL_Action likes
197         switch(m_playtype)
198         {
199                 case ACT_ACTION_LOOP_END:
200                 case ACT_ACTION_LOOP_STOP:
201                         playtype = BL_Action::ACT_MODE_LOOP;
202                         break;
203
204                 case ACT_ACTION_PINGPONG:
205                         // We handle ping pong ourselves to increase compabitility
206                         // with files made prior to animation changes from GSoC 2011.
207                         playtype = BL_Action::ACT_MODE_PLAY;
208                 
209                         if (m_flag & ACT_FLAG_REVERSE)
210                         {
211                                 m_localtime = start;
212                                 start = end;
213                                 end = m_localtime;
214                         }
215
216                         break;
217                 case ACT_ACTION_FROM_PROP:
218                         CValue* prop = GetParent()->GetProperty(m_propname);
219
220                         // If we don't have a property, we can't do anything, so just bail
221                         if (!prop) return false;
222
223                         playtype = BL_Action::ACT_MODE_PLAY;
224                         start = end = prop->GetNumber();
225
226                         break;
227         }
228
229         // Continue only really makes sense for play stop and flipper. All other modes go until they are complete.
230         if (m_flag & ACT_FLAG_CONTINUE &&
231                 (m_playtype == ACT_ACTION_LOOP_STOP ||
232                 m_playtype == ACT_ACTION_FLIPPER))
233                 bUseContinue = true;
234         
235         
236         // Handle events
237         if (frame)
238         {
239                 bNegativeEvent = m_negevent;
240                 bPositiveEvent = m_posevent;
241                 RemoveAllEvents();
242         }
243
244         if (m_flag & ACT_FLAG_ATTEMPT_PLAY)
245                 SetLocalTime(curtime);
246
247         if (bUseContinue && (m_flag & ACT_FLAG_ACTIVE))
248         {
249                 m_localtime = obj->GetActionFrame(m_layer);
250                 ResetStartTime(curtime);
251         }
252
253         // Handle a frame property if it's defined
254         if ((m_flag & ACT_FLAG_ACTIVE) && m_framepropname[0] != 0)
255         {
256                 CValue* oldprop = obj->GetProperty(m_framepropname);
257                 CValue* newval = new CFloatValue(obj->GetActionFrame(m_layer));
258                 if (oldprop)
259                         oldprop->SetValue(newval);
260                 else
261                         obj->SetProperty(m_framepropname, newval);
262
263                 newval->Release();
264         }
265
266         // Handle a finished animation
267         if ((m_flag & ACT_FLAG_PLAY_END) && obj->IsActionDone(m_layer))
268         {
269                 m_flag &= ~ACT_FLAG_ACTIVE;
270                 m_flag &= ~ACT_FLAG_ATTEMPT_PLAY;
271                 obj->StopAction(m_layer);
272                 return false;
273         }
274         
275         // If a different action is playing, we've been overruled and are no longer active
276         if (obj->GetCurrentAction(m_layer) != m_action)
277                 m_flag &= ~ACT_FLAG_ACTIVE;
278
279         if (bPositiveEvent || (m_flag & ACT_FLAG_ATTEMPT_PLAY && !(m_flag & ACT_FLAG_ACTIVE)))
280         {
281                 if (bPositiveEvent)
282                         ResetStartTime(curtime);
283
284                 if (obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, m_blendin, playtype, m_layer_weight, m_ipo_flags))
285                 {
286                         m_flag |= ACT_FLAG_ACTIVE;
287                         if (bUseContinue)
288                                 obj->SetActionFrame(m_layer, m_localtime);
289
290                         if (m_playtype == ACT_ACTION_PLAY)
291                                 m_flag |= ACT_FLAG_PLAY_END;
292                         else
293                                 m_flag &= ~ACT_FLAG_PLAY_END;
294                 }
295                 m_flag |= ACT_FLAG_ATTEMPT_PLAY;
296         }
297         else if ((m_flag & ACT_FLAG_ACTIVE) && bNegativeEvent)
298         {       
299                 m_flag &= ~ACT_FLAG_ATTEMPT_PLAY;
300                 bAction *curr_action = obj->GetCurrentAction(m_layer);
301                 if (curr_action && curr_action != m_action)
302                 {
303                         // Someone changed the action on us, so we wont mess with it
304                         // Hopefully there wont be too many problems with two actuators using
305                         // the same action...
306                         m_flag &= ~ACT_FLAG_ACTIVE;
307                         return false;
308                 }
309
310                 
311                 m_localtime = obj->GetActionFrame(m_layer);
312                 if (m_localtime < min(m_startframe, m_endframe) || m_localtime > max(m_startframe, m_endframe))
313                         m_localtime = m_startframe;
314
315                 switch(m_playtype)
316                 {
317                         case ACT_ACTION_LOOP_STOP:
318                                 obj->StopAction(m_layer); // Stop the action after getting the frame
319
320                                 // We're done
321                                 m_flag &= ~ACT_FLAG_ACTIVE;
322                                 return false;
323                         case ACT_ACTION_PINGPONG:
324                                 m_flag ^= ACT_FLAG_REVERSE;
325                                 // Now fallthrough to LOOP_END code
326                         case ACT_ACTION_LOOP_END:
327                                 // Convert into a play and let it finish
328                                 obj->SetPlayMode(m_layer, BL_Action::ACT_MODE_PLAY);
329
330                                 m_flag |= ACT_FLAG_PLAY_END;
331                                 break;
332         
333                         case ACT_ACTION_FLIPPER:
334                                 // Convert into a play action and play back to the beginning
335                                 end = start;
336                                 start = obj->GetActionFrame(m_layer);
337                                 obj->PlayAction(m_action->id.name+2, start, end, m_layer, m_priority, 0, BL_Action::ACT_MODE_PLAY, m_layer_weight, m_ipo_flags);
338
339                                 m_flag |= ACT_FLAG_PLAY_END;
340                                 break;
341                 }
342         }
343
344         return true;
345 }
346
347 #ifdef WITH_PYTHON
348
349 /* ------------------------------------------------------------------------- */
350 /* Python functions                                                          */
351 /* ------------------------------------------------------------------------- */
352
353 PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) {
354         char *string= _PyUnicode_AsString(value);
355         
356         if (!string) {
357                 PyErr_SetString(PyExc_TypeError, "expected a single string");
358                 return NULL;
359         }
360         
361         bPoseChannel *pchan;
362         
363         if(m_userpose==NULL && m_pose==NULL) {
364                 BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent();
365                 obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
366         }
367         
368         // get_pose_channel accounts for NULL pose, run on both incase one exists but
369         // the channel doesnt
370         if(             !(pchan=get_pose_channel(m_userpose, string)) &&
371                         !(pchan=get_pose_channel(m_pose, string))  )
372         {
373                 PyErr_SetString(PyExc_ValueError, "channel doesnt exist");
374                 return NULL;
375         }
376
377         PyObject *ret = PyTuple_New(3);
378         
379         PyObject *list = PyList_New(3); 
380         PyList_SET_ITEM(list, 0, PyFloat_FromDouble(pchan->loc[0]));
381         PyList_SET_ITEM(list, 1, PyFloat_FromDouble(pchan->loc[1]));
382         PyList_SET_ITEM(list, 2, PyFloat_FromDouble(pchan->loc[2]));
383         PyTuple_SET_ITEM(ret, 0, list);
384         
385         list = PyList_New(3);
386         PyList_SET_ITEM(list, 0, PyFloat_FromDouble(pchan->size[0]));
387         PyList_SET_ITEM(list, 1, PyFloat_FromDouble(pchan->size[1]));
388         PyList_SET_ITEM(list, 2, PyFloat_FromDouble(pchan->size[2]));
389         PyTuple_SET_ITEM(ret, 1, list);
390         
391         list = PyList_New(4);
392         PyList_SET_ITEM(list, 0, PyFloat_FromDouble(pchan->quat[0]));
393         PyList_SET_ITEM(list, 1, PyFloat_FromDouble(pchan->quat[1]));
394         PyList_SET_ITEM(list, 2, PyFloat_FromDouble(pchan->quat[2]));
395         PyList_SET_ITEM(list, 3, PyFloat_FromDouble(pchan->quat[3]));
396         PyTuple_SET_ITEM(ret, 2, list);
397
398         return ret;
399 /*
400         return Py_BuildValue("([fff][fff][ffff])",
401                 pchan->loc[0], pchan->loc[1], pchan->loc[2],
402                 pchan->size[0], pchan->size[1], pchan->size[2],
403                 pchan->quat[0], pchan->quat[1], pchan->quat[2], pchan->quat[3] );
404 */
405 }
406
407 /*     setChannel                                                         */
408 KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
409 "setChannel(channel, matrix)\n"
410 "\t - channel   : A string specifying the name of the bone channel.\n"
411 "\t - matrix    : A 4x4 matrix specifying the overriding transformation\n"
412 "\t               as an offset from the bone's rest position.\n")
413 {
414         BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent();
415         char *string;
416         PyObject *pymat= NULL;
417         PyObject *pyloc= NULL, *pysize= NULL, *pyquat= NULL;
418         bPoseChannel *pchan;
419         
420         if(PyTuple_Size(args)==2) {
421                 if (!PyArg_ParseTuple(args,"sO:setChannel", &string, &pymat)) // matrix
422                         return NULL;
423         }
424         else if(PyTuple_Size(args)==4) {
425                 if (!PyArg_ParseTuple(args,"sOOO:setChannel", &string, &pyloc, &pysize, &pyquat)) // loc/size/quat
426                         return NULL;
427         }
428         else {
429                 PyErr_SetString(PyExc_ValueError, "Expected a string and a 4x4 matrix (2 args) or a string and loc/size/quat sequences (4 args)");
430                 return NULL;
431         }
432         
433         if(pymat) {
434                 float matrix[4][4];
435                 MT_Matrix4x4 mat;
436                 
437                 if(!PyMatTo(pymat, mat))
438                         return NULL;
439                 
440                 mat.getValue((float*)matrix);
441                 
442                 BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent();
443                 
444                 if (!m_userpose) {
445                         if(!m_pose)
446                                 obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
447                         game_copy_pose(&m_userpose, m_pose, 0);
448                 }
449                 // pchan= verify_pose_channel(m_userpose, string); // adds the channel if its not there.
450                 pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there.
451                 
452                 if(pchan) {
453                         VECCOPY (pchan->loc, matrix[3]);
454                         mat4_to_size( pchan->size,matrix);
455                         mat4_to_quat( pchan->quat,matrix);
456                 }
457         }
458         else {
459                 MT_Vector3 loc;
460                 MT_Vector3 size;
461                 MT_Quaternion quat;
462                 
463                 if (!PyVecTo(pyloc, loc) || !PyVecTo(pysize, size) || !PyQuatTo(pyquat, quat))
464                         return NULL;
465                 
466                 // same as above
467                 if (!m_userpose) {
468                         if(!m_pose)
469                                 obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
470                         game_copy_pose(&m_userpose, m_pose, 0);
471                 }
472                 // pchan= verify_pose_channel(m_userpose, string);
473                 pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there.
474                 
475                 // for some reason loc.setValue(pchan->loc) fails
476                 if(pchan) {
477                         pchan->loc[0]= loc[0]; pchan->loc[1]= loc[1]; pchan->loc[2]= loc[2];
478                         pchan->size[0]= size[0]; pchan->size[1]= size[1]; pchan->size[2]= size[2];
479                         pchan->quat[0]= quat[3]; pchan->quat[1]= quat[0]; pchan->quat[2]= quat[1]; pchan->quat[3]= quat[2]; /* notice xyzw -> wxyz is intentional */
480                 }
481         }
482         
483         if(pchan==NULL) {
484                 PyErr_SetString(PyExc_ValueError, "Channel could not be found, use the 'channelNames' attribute to get a list of valid channels");
485                 return NULL;
486         }
487         
488         Py_RETURN_NONE;
489 }
490
491 /* ------------------------------------------------------------------------- */
492 /* Python Integration Hooks                                                                      */
493 /* ------------------------------------------------------------------------- */
494
495 PyTypeObject BL_ActionActuator::Type = {
496         PyVarObject_HEAD_INIT(NULL, 0)
497         "BL_ActionActuator",
498         sizeof(PyObjectPlus_Proxy),
499         0,
500         py_base_dealloc,
501         0,
502         0,
503         0,
504         0,
505         py_base_repr,
506         0,0,0,0,0,0,0,0,0,
507         Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
508         0,0,0,0,0,0,0,
509         Methods,
510         0,
511         0,
512         &SCA_IActuator::Type,
513         0,0,0,0,0,0,
514         py_base_new
515 };
516
517 PyMethodDef BL_ActionActuator::Methods[] = {
518         {"getChannel", (PyCFunction) BL_ActionActuator::sPyGetChannel, METH_O},
519         KX_PYMETHODTABLE(BL_ActionActuator, setChannel),
520         {NULL,NULL} //Sentinel
521 };
522
523 PyAttributeDef BL_ActionActuator::Attributes[] = {
524         KX_PYATTRIBUTE_FLOAT_RW("frameStart", 0, MAXFRAMEF, BL_ActionActuator, m_startframe),
525         KX_PYATTRIBUTE_FLOAT_RW("frameEnd", 0, MAXFRAMEF, BL_ActionActuator, m_endframe),
526         KX_PYATTRIBUTE_FLOAT_RW("blendIn", 0, MAXFRAMEF, BL_ActionActuator, m_blendin),
527         KX_PYATTRIBUTE_RW_FUNCTION("action", BL_ActionActuator, pyattr_get_action, pyattr_set_action),
528         KX_PYATTRIBUTE_RO_FUNCTION("channelNames", BL_ActionActuator, pyattr_get_channel_names),
529         KX_PYATTRIBUTE_SHORT_RW("priority", 0, 100, false, BL_ActionActuator, m_priority),
530         KX_PYATTRIBUTE_RW_FUNCTION("frame", BL_ActionActuator, pyattr_get_frame, pyattr_set_frame),
531         KX_PYATTRIBUTE_STRING_RW("propName", 0, 31, false, BL_ActionActuator, m_propname),
532         KX_PYATTRIBUTE_STRING_RW("framePropName", 0, 31, false, BL_ActionActuator, m_framepropname),
533         KX_PYATTRIBUTE_RW_FUNCTION("useContinue", BL_ActionActuator, pyattr_get_use_continue, pyattr_set_use_continue),
534         KX_PYATTRIBUTE_FLOAT_RW_CHECK("blendTime", 0, MAXFRAMEF, BL_ActionActuator, m_blendframe, CheckBlendTime),
535         KX_PYATTRIBUTE_SHORT_RW_CHECK("mode",0,100,false,BL_ActionActuator,m_playtype,CheckType),
536         { NULL }        //Sentinel
537 };
538
539 PyObject* BL_ActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
540 {
541         BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
542         return PyUnicode_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
543 }
544
545 int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
546 {
547         BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
548         
549         if (!PyUnicode_Check(value))
550         {
551                 PyErr_SetString(PyExc_ValueError, "actuator.action = val: Action Actuator, expected the string name of the action");
552                 return PY_SET_ATTR_FAIL;
553         }
554
555         bAction *action= NULL;
556         STR_String val = _PyUnicode_AsString(value);
557         
558         if (val != "")
559         {
560                 action= (bAction*)SCA_ILogicBrick::m_sCurrentLogicManager->GetActionByName(val);
561                 if (!action)
562                 {
563                         PyErr_SetString(PyExc_ValueError, "actuator.action = val: Action Actuator, action not found!");
564                         return PY_SET_ATTR_FAIL;
565                 }
566         }
567         
568         self->SetAction(action);
569         return PY_SET_ATTR_SUCCESS;
570
571 }
572
573 PyObject* BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
574 {
575         BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
576         PyObject *ret= PyList_New(0);
577         PyObject *item;
578         
579         bPose *pose= ((BL_ArmatureObject*)self->GetParent())->GetOrigPose();
580         
581         if(pose) {
582                 bPoseChannel *pchan;
583                 for(pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
584                         item= PyUnicode_FromString(pchan->name);
585                         PyList_Append(ret, item);
586                         Py_DECREF(item);
587                 }
588         }
589         
590         return ret;
591 }
592
593 PyObject* BL_ActionActuator::pyattr_get_use_continue(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
594 {
595         BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
596         return PyBool_FromLong(self->m_flag & ACT_FLAG_CONTINUE);
597 }
598
599 int BL_ActionActuator::pyattr_set_use_continue(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
600 {
601         BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
602         
603         if (PyObject_IsTrue(value))
604                 self->m_flag |= ACT_FLAG_CONTINUE;
605         else
606                 self->m_flag &= ~ACT_FLAG_CONTINUE;
607         
608         return PY_SET_ATTR_SUCCESS;
609 }
610
611 PyObject* BL_ActionActuator::pyattr_get_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
612 {
613         BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
614         return PyFloat_FromDouble(((KX_GameObject*)self->m_gameobj)->GetActionFrame(self->m_layer));
615 }
616
617 int BL_ActionActuator::pyattr_set_frame(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
618 {
619         BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
620         
621         ((KX_GameObject*)self->m_gameobj)->SetActionFrame(self->m_layer, PyFloat_AsDouble(value));
622         
623         return PY_SET_ATTR_SUCCESS;
624 }
625
626 #endif // WITH_PYTHON