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