NLA SoC: Merge from 2.5
[blender.git] / source / gameengine / Converter / BL_ActionActuator.cpp
index c08427c6d27b957bf012bc4096cf83b2d54a3b18..bed99a4f5028cdf13fb470701aaf7a1a202ea4b8 100644 (file)
 #include "BL_SkinDeformer.h"
 #include "KX_GameObject.h"
 #include "STR_HashedString.h"
-#include "DNA_action_types.h"
 #include "DNA_nla_types.h"
-#include "DNA_actuator_types.h"
 #include "BKE_action.h"
+#include "DNA_action_types.h"
 #include "DNA_armature_types.h"
+#include "DNA_scene_types.h"
 #include "MEM_guardedalloc.h"
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
 #include "BKE_utildefines.h"
 #include "FloatValue.h"
 #include "PyObjectPlus.h"
+#include "KX_PyMath.h"
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
+extern "C" {
+#include "BKE_animsys.h"
+#include "BKE_action.h"
+#include "RNA_access.h"
+#include "RNA_define.h"
+}
+
 BL_ActionActuator::~BL_ActionActuator()
 {
        if (m_pose)
@@ -66,9 +74,9 @@ BL_ActionActuator::~BL_ActionActuator()
                game_free_pose(m_blendpose);
 }
 
-void BL_ActionActuator::ProcessReplica(){
-//     bPose *oldpose = m_pose;
-//     bPose *oldbpose = m_blendpose;
+void BL_ActionActuator::ProcessReplica()
+{
+       SCA_IActuator::ProcessReplica();
        
        m_pose = NULL;
        m_blendpose = NULL;
@@ -84,9 +92,6 @@ void BL_ActionActuator::SetBlendTime (float newtime){
 CValue* BL_ActionActuator::GetReplica() {
        BL_ActionActuator* replica = new BL_ActionActuator(*this);//m_float,GetName());
        replica->ProcessReplica();
-       
-       // this will copy properties and so on...
-       CValue::AddDataToReplica(replica);
        return replica;
 }
 
@@ -159,16 +164,9 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
        // maybe there are events for us in the queue !
        if (frame)
        {
-               for (vector<CValue*>::iterator i=m_events.begin(); !(i==m_events.end());i++)
-               {
-                       if ((*i)->GetNumber() == 0.0f)
-                               bNegativeEvent = true;
-                       else
-                               bPositiveEvent= true;
-                       (*i)->Release();
-               
-               }
-               m_events.clear();
+               bNegativeEvent = m_negevent;
+               bPositiveEvent = m_posevent;
+               RemoveAllEvents();
                
                if (bPositiveEvent)
                        m_flag |= ACT_FLAG_ACTIVE;
@@ -369,15 +367,35 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
                        
                        /* Get the underlying pose from the armature */
                        obj->GetPose(&m_pose);
-                       
+
+// 2.4x function, 
                        /* Override the necessary channels with ones from the action */
-                       extract_pose_from_action(m_pose, m_action, m_localtime);
+                       // XXX extract_pose_from_action(m_pose, m_action, m_localtime);
+                       
+                       
+// 2.5x - replacement for extract_pose_from_action(...) above.
+                       {
+                               struct PointerRNA id_ptr;
+                               Object *arm= obj->GetArmatureObject();
+                               bPose *pose_back= arm->pose;
+                               
+                               arm->pose= m_pose;
+                               RNA_id_pointer_create((ID *)arm, &id_ptr);
+                               animsys_evaluate_action(&id_ptr, m_action, NULL, m_localtime);
+                               
+                               arm->pose= pose_back;
+                       
+// 2.5x - could also do this but looks too high level, constraints use this, it works ok.
+//                             Object workob; /* evaluate using workob */
+//                             what_does_obaction((Scene *)obj->GetScene(), obj->GetArmatureObject(), &workob, m_pose, m_action, NULL, m_localtime);
+                       }
 
+                       // done getting the pose from the action
+                       
                        /* Perform the user override (if any) */
                        if (m_userpose){
                                extract_pose_from_pose(m_pose, m_userpose);
-//                             clear_pose(m_userpose);
-                               MEM_freeN(m_userpose);
+                               game_free_pose(m_userpose); //cant use MEM_freeN(m_userpose) because the channels need freeing too.
                                m_userpose = NULL;
                        }
 #if 1
@@ -391,7 +409,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
                                
                                /* Find percentages */
                                newweight = (m_blendframe/(float)m_blendin);
-                               blend_poses(m_pose, m_blendpose, 1.0 - newweight, ACTSTRIPMODE_BLEND);
+                               game_blend_poses(m_pose, m_blendpose, 1.0 - newweight);
 
                                /* Increment current blending percentage */
                                m_blendframe = (curtime - m_blendstart)*KX_KetsjiEngine::GetAnimFrameRate();
@@ -418,89 +436,30 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
 /* Python functions                                                          */
 /* ------------------------------------------------------------------------- */
 
-/* Integration hooks ------------------------------------------------------- */
-
-PyTypeObject BL_ActionActuator::Type = {
-       PyObject_HEAD_INIT(&PyType_Type)
-               0,
-               "BL_ActionActuator",
-               sizeof(BL_ActionActuator),
-               0,
-               PyDestructor,
-               0,
-               __getattr,
-               __setattr,
-               0, //&MyPyCompare,
-               __repr,
-               0, //&cvalue_as_number,
-               0,
-               0,
-               0,
-               0
-};
-
-PyParentObject BL_ActionActuator::Parents[] = {
-       &BL_ActionActuator::Type,
-               &SCA_IActuator::Type,
-               &SCA_ILogicBrick::Type,
-               &CValue::Type,
-               NULL
-};
-
-PyMethodDef BL_ActionActuator::Methods[] = {
-       {"setAction", (PyCFunction) BL_ActionActuator::sPySetAction, METH_VARARGS, SetAction_doc},
-       {"setStart", (PyCFunction) BL_ActionActuator::sPySetStart, METH_VARARGS, SetStart_doc},
-       {"setEnd", (PyCFunction) BL_ActionActuator::sPySetEnd, METH_VARARGS, SetEnd_doc},
-       {"setBlendin", (PyCFunction) BL_ActionActuator::sPySetBlendin, METH_VARARGS, SetBlendin_doc},
-       {"setPriority", (PyCFunction) BL_ActionActuator::sPySetPriority, METH_VARARGS, SetPriority_doc},
-       {"setFrame", (PyCFunction) BL_ActionActuator::sPySetFrame, METH_VARARGS, SetFrame_doc},
-       {"setProperty", (PyCFunction) BL_ActionActuator::sPySetProperty, METH_VARARGS, SetProperty_doc},
-       {"setFrameProperty", (PyCFunction) BL_ActionActuator::sPySetFrameProperty, METH_VARARGS, SetFrameProperty_doc},
-       {"setBlendtime", (PyCFunction) BL_ActionActuator::sPySetBlendtime, METH_VARARGS, SetBlendtime_doc},
-
-       {"getAction", (PyCFunction) BL_ActionActuator::sPyGetAction, METH_VARARGS, GetAction_doc},
-       {"getStart", (PyCFunction) BL_ActionActuator::sPyGetStart, METH_VARARGS, GetStart_doc},
-       {"getEnd", (PyCFunction) BL_ActionActuator::sPyGetEnd, METH_VARARGS, GetEnd_doc},
-       {"getBlendin", (PyCFunction) BL_ActionActuator::sPyGetBlendin, METH_VARARGS, GetBlendin_doc},
-       {"getPriority", (PyCFunction) BL_ActionActuator::sPyGetPriority, METH_VARARGS, GetPriority_doc},
-       {"getFrame", (PyCFunction) BL_ActionActuator::sPyGetFrame, METH_VARARGS, GetFrame_doc},
-       {"getProperty", (PyCFunction) BL_ActionActuator::sPyGetProperty, METH_VARARGS, GetProperty_doc},
-       {"getFrameProperty", (PyCFunction) BL_ActionActuator::sPyGetFrameProperty, METH_VARARGS, GetFrameProperty_doc},
-       {"setChannel", (PyCFunction) BL_ActionActuator::sPySetChannel, METH_VARARGS, SetChannel_doc},
-//     {"getChannel", (PyCFunction) BL_ActionActuator::sPyGetChannel, METH_VARARGS},
-       {"getType", (PyCFunction) BL_ActionActuator::sPyGetType, METH_VARARGS, GetType_doc},
-       {"setType", (PyCFunction) BL_ActionActuator::sPySetType, METH_VARARGS, SetType_doc},
-       {"getContinue", (PyCFunction) BL_ActionActuator::sPyGetContinue, METH_NOARGS, 0},       
-       {"setContinue", (PyCFunction) BL_ActionActuator::sPySetContinue, METH_O, 0},
-       {NULL,NULL} //Sentinel
-};
-
-PyObject* BL_ActionActuator::_getattr(const STR_String& attr) {
-       _getattr_up(SCA_IActuator);
-}
-
 /*     setStart                                                              */
-char BL_ActionActuator::GetAction_doc[] = 
+const char BL_ActionActuator::GetAction_doc[] = 
 "getAction()\n"
 "\tReturns a string containing the name of the current action.\n";
 
-PyObject* BL_ActionActuator::PyGetAction(PyObject* self, 
-                                                                                PyObject* args, 
+PyObject* BL_ActionActuator::PyGetAction(PyObject* args, 
                                                                                 PyObject* kwds) {
+       ShowDeprecationWarning("getAction()", "the action property");
+
        if (m_action){
-               return PyString_FromString(m_action->id.name+2);
+               return PyUnicode_FromString(m_action->id.name+2);
        }
        Py_RETURN_NONE;
 }
 
 /*     getProperty                                                             */
-char BL_ActionActuator::GetProperty_doc[] = 
+const char BL_ActionActuator::GetProperty_doc[] = 
 "getProperty()\n"
 "\tReturns the name of the property to be used in FromProp mode.\n";
 
-PyObject* BL_ActionActuator::PyGetProperty(PyObject* self, 
-                                                                                  PyObject* args, 
+PyObject* BL_ActionActuator::PyGetProperty(PyObject* args, 
                                                                                   PyObject* kwds) {
+       ShowDeprecationWarning("getProperty()", "the property property");
+
        PyObject *result;
        
        result = Py_BuildValue("s", (const char *)m_propname);
@@ -509,13 +468,14 @@ PyObject* BL_ActionActuator::PyGetProperty(PyObject* self,
 }
 
 /*     getProperty                                                             */
-char BL_ActionActuator::GetFrameProperty_doc[] = 
+const char BL_ActionActuator::GetFrameProperty_doc[] = 
 "getFrameProperty()\n"
 "\tReturns the name of the property, that is set to the current frame number.\n";
 
-PyObject* BL_ActionActuator::PyGetFrameProperty(PyObject* self, 
-                                                                                  PyObject* args, 
+PyObject* BL_ActionActuator::PyGetFrameProperty(PyObject* args, 
                                                                                   PyObject* kwds) {
+       ShowDeprecationWarning("getFrameProperty()", "the frameProperty property");
+
        PyObject *result;
        
        result = Py_BuildValue("s", (const char *)m_framepropname);
@@ -524,13 +484,14 @@ PyObject* BL_ActionActuator::PyGetFrameProperty(PyObject* self,
 }
 
 /*     getFrame                                                              */
-char BL_ActionActuator::GetFrame_doc[] = 
+const char BL_ActionActuator::GetFrame_doc[] = 
 "getFrame()\n"
 "\tReturns the current frame number.\n";
 
-PyObject* BL_ActionActuator::PyGetFrame(PyObject* self, 
-                                                                               PyObject* args, 
+PyObject* BL_ActionActuator::PyGetFrame(PyObject* args, 
                                                                                PyObject* kwds) {
+       ShowDeprecationWarning("getFrame()", "the frame property");
+
        PyObject *result;
        
        result = Py_BuildValue("f", m_localtime);
@@ -539,13 +500,14 @@ PyObject* BL_ActionActuator::PyGetFrame(PyObject* self,
 }
 
 /*     getEnd                                                                */
-char BL_ActionActuator::GetEnd_doc[] = 
+const char BL_ActionActuator::GetEnd_doc[] = 
 "getEnd()\n"
 "\tReturns the last frame of the action.\n";
 
-PyObject* BL_ActionActuator::PyGetEnd(PyObject* self, 
-                                                                         PyObject* args, 
+PyObject* BL_ActionActuator::PyGetEnd(PyObject* args, 
                                                                          PyObject* kwds) {
+       ShowDeprecationWarning("getEnd()", "the end property");
+
        PyObject *result;
        
        result = Py_BuildValue("f", m_endframe);
@@ -554,13 +516,14 @@ PyObject* BL_ActionActuator::PyGetEnd(PyObject* self,
 }
 
 /*     getStart                                                              */
-char BL_ActionActuator::GetStart_doc[] = 
+const char BL_ActionActuator::GetStart_doc[] = 
 "getStart()\n"
 "\tReturns the starting frame of the action.\n";
 
-PyObject* BL_ActionActuator::PyGetStart(PyObject* self, 
-                                                                               PyObject* args, 
+PyObject* BL_ActionActuator::PyGetStart(PyObject* args, 
                                                                                PyObject* kwds) {
+       ShowDeprecationWarning("getStart()", "the start property");
+
        PyObject *result;
        
        result = Py_BuildValue("f", m_startframe);
@@ -569,14 +532,15 @@ PyObject* BL_ActionActuator::PyGetStart(PyObject* self,
 }
 
 /*     getBlendin                                                            */
-char BL_ActionActuator::GetBlendin_doc[] = 
+const char BL_ActionActuator::GetBlendin_doc[] = 
 "getBlendin()\n"
 "\tReturns the number of interpolation animation frames to be\n"
 "\tgenerated when this actuator is triggered.\n";
 
-PyObject* BL_ActionActuator::PyGetBlendin(PyObject* self, 
-                                                                                 PyObject* args, 
+PyObject* BL_ActionActuator::PyGetBlendin(PyObject* args, 
                                                                                  PyObject* kwds) {
+       ShowDeprecationWarning("getBlendin()", "the blendin property");
+
        PyObject *result;
        
        result = Py_BuildValue("f", m_blendin);
@@ -585,14 +549,15 @@ PyObject* BL_ActionActuator::PyGetBlendin(PyObject* self,
 }
 
 /*     getPriority                                                           */
-char BL_ActionActuator::GetPriority_doc[] = 
+const char BL_ActionActuator::GetPriority_doc[] = 
 "getPriority()\n"
 "\tReturns the priority for this actuator.  Actuators with lower\n"
 "\tPriority numbers will override actuators with higher numbers.\n";
 
-PyObject* BL_ActionActuator::PyGetPriority(PyObject* self, 
-                                                                                  PyObject* args, 
+PyObject* BL_ActionActuator::PyGetPriority(PyObject* args, 
                                                                                   PyObject* kwds) {
+       ShowDeprecationWarning("getPriority()", "the priority property");
+
        PyObject *result;
        
        result = Py_BuildValue("i", m_priority);
@@ -601,7 +566,7 @@ PyObject* BL_ActionActuator::PyGetPriority(PyObject* self,
 }
 
 /*     setAction                                                             */
-char BL_ActionActuator::SetAction_doc[] = 
+const char BL_ActionActuator::SetAction_doc[] = 
 "setAction(action, (reset))\n"
 "\t - action    : The name of the action to set as the current action.\n"
 "\t - reset     : Optional parameter indicating whether to reset the\n"
@@ -610,13 +575,14 @@ char BL_ActionActuator::SetAction_doc[] =
 "\t               unchanged.  If reset is not specified, the timer will"
 "\t                  be reset.\n";
 
-PyObject* BL_ActionActuator::PySetAction(PyObject* self, 
-                                                                                PyObject* args, 
+PyObject* BL_ActionActuator::PySetAction(PyObject* args, 
                                                                                 PyObject* kwds) {
+       ShowDeprecationWarning("setAction()", "the action property");
+
        char *string;
        int     reset = 1;
 
-       if (PyArg_ParseTuple(args,"s|i",&string, &reset))
+       if (PyArg_ParseTuple(args,"s|i:setAction",&string, &reset))
        {
                bAction *action;
                
@@ -640,16 +606,17 @@ PyObject* BL_ActionActuator::PySetAction(PyObject* self,
 }
 
 /*     setStart                                                              */
-char BL_ActionActuator::SetStart_doc[] = 
+const char BL_ActionActuator::SetStart_doc[] = 
 "setStart(start)\n"
 "\t - start     : Specifies the starting frame of the animation.\n";
 
-PyObject* BL_ActionActuator::PySetStart(PyObject* self, 
-                                                                               PyObject* args, 
+PyObject* BL_ActionActuator::PySetStart(PyObject* args, 
                                                                                PyObject* kwds) {
+       ShowDeprecationWarning("setStart()", "the start property");
+
        float start;
        
-       if (PyArg_ParseTuple(args,"f",&start))
+       if (PyArg_ParseTuple(args,"f:setStart",&start))
        {
                m_startframe = start;
        }
@@ -661,16 +628,17 @@ PyObject* BL_ActionActuator::PySetStart(PyObject* self,
 }
 
 /*     setEnd                                                                */
-char BL_ActionActuator::SetEnd_doc[] = 
+const char BL_ActionActuator::SetEnd_doc[] = 
 "setEnd(end)\n"
 "\t - end       : Specifies the ending frame of the animation.\n";
 
-PyObject* BL_ActionActuator::PySetEnd(PyObject* self, 
-                                                                         PyObject* args, 
+PyObject* BL_ActionActuator::PySetEnd(PyObject* args, 
                                                                          PyObject* kwds) {
+       ShowDeprecationWarning("setEnd()", "the end property");
+
        float end;
        
-       if (PyArg_ParseTuple(args,"f",&end))
+       if (PyArg_ParseTuple(args,"f:setEnd",&end))
        {
                m_endframe = end;
        }
@@ -682,17 +650,18 @@ PyObject* BL_ActionActuator::PySetEnd(PyObject* self,
 }
 
 /*     setBlendin                                                            */
-char BL_ActionActuator::SetBlendin_doc[] = 
+const char BL_ActionActuator::SetBlendin_doc[] = 
 "setBlendin(blendin)\n"
 "\t - blendin   : Specifies the number of frames of animation to generate\n"
 "\t               when making transitions between actions.\n";
 
-PyObject* BL_ActionActuator::PySetBlendin(PyObject* self, 
-                                                                                 PyObject* args, 
+PyObject* BL_ActionActuator::PySetBlendin(PyObject* args, 
                                                                                  PyObject* kwds) {
+       ShowDeprecationWarning("setBlendin()", "the blendin property");
+
        float blendin;
        
-       if (PyArg_ParseTuple(args,"f",&blendin))
+       if (PyArg_ParseTuple(args,"f:setBlendin",&blendin))
        {
                m_blendin = blendin;
        }
@@ -704,18 +673,19 @@ PyObject* BL_ActionActuator::PySetBlendin(PyObject* self,
 }
 
 /*     setBlendtime                                                          */
-char BL_ActionActuator::SetBlendtime_doc[] = 
+const char BL_ActionActuator::SetBlendtime_doc[] = 
 "setBlendtime(blendtime)\n"
 "\t - blendtime : Allows the script to directly modify the internal timer\n"
 "\t               used when generating transitions between actions.  This\n"
 "\t               parameter must be in the range from 0.0 to 1.0.\n";
 
-PyObject* BL_ActionActuator::PySetBlendtime(PyObject* self, 
-                                                                                 PyObject* args, 
+PyObject* BL_ActionActuator::PySetBlendtime(PyObject* args, 
                                                                                  PyObject* kwds) {
+       ShowDeprecationWarning("setBlendtime()", "the blendtime property");
+
        float blendframe;
        
-       if (PyArg_ParseTuple(args,"f",&blendframe))
+       if (PyArg_ParseTuple(args,"f:setBlendtime",&blendframe))
        {
                m_blendframe = blendframe * m_blendin;
                if (m_blendframe<0)
@@ -731,18 +701,19 @@ PyObject* BL_ActionActuator::PySetBlendtime(PyObject* self,
 }
 
 /*     setPriority                                                           */
-char BL_ActionActuator::SetPriority_doc[] = 
+const char BL_ActionActuator::SetPriority_doc[] = 
 "setPriority(priority)\n"
 "\t - priority  : Specifies the new priority.  Actuators will lower\n"
 "\t               priority numbers will override actuators with higher\n"
 "\t               numbers.\n";
 
-PyObject* BL_ActionActuator::PySetPriority(PyObject* self, 
-                                                                                  PyObject* args, 
+PyObject* BL_ActionActuator::PySetPriority(PyObject* args, 
                                                                                   PyObject* kwds) {
+       ShowDeprecationWarning("setPriority()", "the priority property");
+
        int priority;
        
-       if (PyArg_ParseTuple(args,"i",&priority))
+       if (PyArg_ParseTuple(args,"i:setPriority",&priority))
        {
                m_priority = priority;
        }
@@ -754,16 +725,17 @@ PyObject* BL_ActionActuator::PySetPriority(PyObject* self,
 }
 
 /*     setFrame                                                              */
-char BL_ActionActuator::SetFrame_doc[] = 
+const char BL_ActionActuator::SetFrame_doc[] = 
 "setFrame(frame)\n"
 "\t - frame     : Specifies the new current frame for the animation\n";
 
-PyObject* BL_ActionActuator::PySetFrame(PyObject* self, 
-                                                                               PyObject* args, 
+PyObject* BL_ActionActuator::PySetFrame(PyObject* args, 
                                                                                PyObject* kwds) {
+       ShowDeprecationWarning("setFrame()", "the frame property");
+
        float frame;
        
-       if (PyArg_ParseTuple(args,"f",&frame))
+       if (PyArg_ParseTuple(args,"f:setFrame",&frame))
        {
                m_localtime = frame;
                if (m_localtime<m_startframe)
@@ -779,17 +751,18 @@ PyObject* BL_ActionActuator::PySetFrame(PyObject* self,
 }
 
 /*     setProperty                                                           */
-char BL_ActionActuator::SetProperty_doc[] = 
+const char BL_ActionActuator::SetProperty_doc[] = 
 "setProperty(prop)\n"
 "\t - prop      : A string specifying the property name to be used in\n"
 "\t               FromProp playback mode.\n";
 
-PyObject* BL_ActionActuator::PySetProperty(PyObject* self, 
-                                                                                  PyObject* args, 
+PyObject* BL_ActionActuator::PySetProperty(PyObject* args, 
                                                                                   PyObject* kwds) {
+       ShowDeprecationWarning("setProperty()", "the property property");
+
        char *string;
        
-       if (PyArg_ParseTuple(args,"s",&string))
+       if (PyArg_ParseTuple(args,"s:setProperty",&string))
        {
                m_propname = string;
        }
@@ -801,16 +774,17 @@ PyObject* BL_ActionActuator::PySetProperty(PyObject* self,
 }
 
 /*     setFrameProperty                                                          */
-char BL_ActionActuator::SetFrameProperty_doc[] = 
+const char BL_ActionActuator::SetFrameProperty_doc[] = 
 "setFrameProperty(prop)\n"
 "\t - prop      : A string specifying the property of the frame set up update.\n";
 
-PyObject* BL_ActionActuator::PySetFrameProperty(PyObject* self, 
-                                                                                  PyObject* args, 
+PyObject* BL_ActionActuator::PySetFrameProperty(PyObject* args, 
                                                                                   PyObject* kwds) {
+       ShowDeprecationWarning("setFrameProperty()", "the frameProperty property");
+
        char *string;
        
-       if (PyArg_ParseTuple(args,"s",&string))
+       if (PyArg_ParseTuple(args,"s:setFrameProperty",&string))
        {
                m_framepropname = string;
        }
@@ -821,138 +795,88 @@ PyObject* BL_ActionActuator::PySetFrameProperty(PyObject* self,
        Py_RETURN_NONE;
 }
 
-/*
-PyObject* BL_ActionActuator::PyGetChannel(PyObject* self, 
-                                                                                  PyObject* args, 
-                                                                                  PyObject* kwds) {
-       char *string;
+PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) {
+       char *string= _PyUnicode_AsString(value);
        
-       if (PyArg_ParseTuple(args,"s",&string))
-       {
-               m_propname = string;
-       }
-       else {
+       if (!string) {
+               PyErr_SetString(PyExc_TypeError, "expected a single string");
                return NULL;
        }
        
-       Py_RETURN_NONE;
-}
-*/
-
-/*     setChannel                                                            */
-char BL_ActionActuator::SetChannel_doc[] = 
-"setChannel(channel, matrix)\n"
-"\t - channel   : A string specifying the name of the bone channel.\n"
-"\t - matrix    : A 4x4 matrix specifying the overriding transformation\n"
-"\t               as an offset from the bone's rest position.\n";
-
-PyObject* BL_ActionActuator::PySetChannel(PyObject* self, 
-                                                                                  PyObject* args, 
-                                                                                  PyObject* kwds) 
-{
-       float matrix[4][4];
-       char *string;
-       PyObject* pylist;
-       bool    error = false;
-       int row,col;
-       int     mode = 0;       /* 0 for bone space, 1 for armature/world space */
+       bPoseChannel *pchan;
        
-       if (!PyArg_ParseTuple(args,"sO|i", &string, &pylist, &mode))
-               return NULL;
        
-       if (pylist->ob_type == &CListValue::Type)
-       {
-               CListValue* listval = (CListValue*) pylist;
-               if (listval->GetCount() == 4)
-               {
-                       for (row=0;row<4;row++) // each row has a 4-vector [x,y,z, w]
-                       {
-                               CListValue* vecval = (CListValue*)listval->GetValue(row);
-                               for (col=0;col<4;col++)
-                               {
-                                       matrix[row][col] = vecval->GetValue(col)->GetNumber();
-                                       
-                               }
-                       }
-               }
-               else
-               {
-                       error = true;
-               }
-       }
-       else
+       // get_pose_channel accounts for NULL pose, run on both incase one exists but
+       // the channel doesnt
+       if(             !(pchan=get_pose_channel(m_userpose, string)) &&
+                       !(pchan=get_pose_channel(m_pose, string))  )
        {
-               // assert the list is long enough...
-               int numitems = PyList_Size(pylist);
-               if (numitems == 4)
-               {
-                       for (row=0;row<4;row++) // each row has a 4-vector [x,y,z, w]
-                       {
-                               
-                               PyObject* veclist = PyList_GetItem(pylist,row); // here we have a vector4 list
-                               for (col=0;col<4;col++)
-                               {
-                                       matrix[row][col] =  PyFloat_AsDouble(PyList_GetItem(veclist,col));
-                                       
-                               }
-                       }
-               }
-               else
-               {
-                       error = true;
-               }
+               PyErr_SetString(PyExc_ValueError, "channel doesnt exist");
+               return NULL;
        }
-       
-       if (!error)
-       {
 
-/*     DO IT HERE */
-               bPoseChannel *pchan= verify_pose_channel(m_userpose, string);
-
-               Mat4ToQuat(matrix, pchan->quat);
-               Mat4ToSize(matrix, pchan->size);
-               VECCOPY (pchan->loc, matrix[3]);
-               
-               pchan->flag |= POSE_ROT|POSE_LOC|POSE_SIZE;
-
-               if (!m_userpose){
-                       m_userpose = (bPose*)MEM_callocN(sizeof(bPose), "userPose");
-               }
-       }
+       PyObject *ret = PyTuple_New(3);
        
-       Py_RETURN_NONE;
+       PyObject *list = PyList_New(3); 
+       PyList_SET_ITEM(list, 0, PyFloat_FromDouble(pchan->loc[0]));
+       PyList_SET_ITEM(list, 1, PyFloat_FromDouble(pchan->loc[1]));
+       PyList_SET_ITEM(list, 2, PyFloat_FromDouble(pchan->loc[2]));
+       PyTuple_SET_ITEM(ret, 0, list);
+       
+       list = PyList_New(3);
+       PyList_SET_ITEM(list, 0, PyFloat_FromDouble(pchan->size[0]));
+       PyList_SET_ITEM(list, 1, PyFloat_FromDouble(pchan->size[1]));
+       PyList_SET_ITEM(list, 2, PyFloat_FromDouble(pchan->size[2]));
+       PyTuple_SET_ITEM(ret, 1, list);
+       
+       list = PyList_New(4);
+       PyList_SET_ITEM(list, 0, PyFloat_FromDouble(pchan->quat[0]));
+       PyList_SET_ITEM(list, 1, PyFloat_FromDouble(pchan->quat[1]));
+       PyList_SET_ITEM(list, 2, PyFloat_FromDouble(pchan->quat[2]));
+       PyList_SET_ITEM(list, 3, PyFloat_FromDouble(pchan->quat[3]));
+       PyTuple_SET_ITEM(ret, 2, list);
+
+       return ret;
+/*
+       return Py_BuildValue("([fff][fff][ffff])",
+               pchan->loc[0], pchan->loc[1], pchan->loc[2],
+               pchan->size[0], pchan->size[1], pchan->size[2],
+               pchan->quat[0], pchan->quat[1], pchan->quat[2], pchan->quat[3] );
+*/
 }
 
 /* getType */
-char BL_ActionActuator::GetType_doc[] =
+const char BL_ActionActuator::GetType_doc[] =
 "getType()\n"
 "\tReturns the operation mode of the actuator.\n";
-PyObject* BL_ActionActuator::PyGetType(PyObject* self,
-                                       PyObject* args, 
+PyObject* BL_ActionActuator::PyGetType(PyObject* args, 
                                        PyObject* kwds) {
+       ShowDeprecationWarning("getType()", "the type property");
+
     return Py_BuildValue("h", m_playtype);
 }
 
 /* setType */
-char BL_ActionActuator::SetType_doc[] =
+const char BL_ActionActuator::SetType_doc[] =
 "setType(mode)\n"
 "\t - mode: Play (0), Flipper (2), LoopStop (3), LoopEnd (4) or Property (6)\n"
 "\tSet the operation mode of the actuator.\n";
-PyObject* BL_ActionActuator::PySetType(PyObject* self,
-                                       PyObject* args,
+PyObject* BL_ActionActuator::PySetType(PyObject* args,
                                        PyObject* kwds) {
+       ShowDeprecationWarning("setType()", "the type property");
+
        short typeArg;
                                                                                                              
-    if (!PyArg_ParseTuple(args, "h", &typeArg)) {
+    if (!PyArg_ParseTuple(args, "h:setType", &typeArg)) {
         return NULL;
     }
 
        switch (typeArg) {
-       case KX_ACT_ACTION_PLAY:
-       case KX_ACT_ACTION_FLIPPER:
-       case KX_ACT_ACTION_LOOPSTOP:
-       case KX_ACT_ACTION_LOOPEND:
-       case KX_ACT_ACTION_PROPERTY:
+       case ACT_ACTION_PLAY:
+       case ACT_ACTION_FLIPPER:
+       case ACT_ACTION_LOOP_STOP:
+       case ACT_ACTION_LOOP_END:
+       case ACT_ACTION_FROM_PROP:
                m_playtype = typeArg;
                break;
        default:
@@ -961,11 +885,15 @@ PyObject* BL_ActionActuator::PySetType(PyObject* self,
        Py_RETURN_NONE;
 }
 
-PyObject* BL_ActionActuator::PyGetContinue(PyObject* self) {
-    return PyInt_FromLong((long)(m_end_reset==0));
+PyObject* BL_ActionActuator::PyGetContinue() {
+       ShowDeprecationWarning("getContinue()", "the continue property");
+
+    return PyLong_FromSsize_t((long)(m_end_reset==0));
 }
 
-PyObject* BL_ActionActuator::PySetContinue(PyObject* self, PyObject* value) {
+PyObject* BL_ActionActuator::PySetContinue(PyObject* value) {
+       ShowDeprecationWarning("setContinue()", "the continue property");
+
        int param = PyObject_IsTrue( value );
        
        if( param == -1 ) {
@@ -981,3 +909,188 @@ PyObject* BL_ActionActuator::PySetContinue(PyObject* self, PyObject* value) {
     Py_RETURN_NONE;
 }
 
+//<-----Deprecated
+
+/*     setChannel                                                         */
+KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
+"setChannel(channel, matrix)\n"
+"\t - channel   : A string specifying the name of the bone channel.\n"
+"\t - matrix    : A 4x4 matrix specifying the overriding transformation\n"
+"\t               as an offset from the bone's rest position.\n")
+{
+       BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent();
+       char *string;
+       PyObject *pymat= NULL;
+       PyObject *pyloc= NULL, *pysize= NULL, *pyquat= NULL;
+       bPoseChannel *pchan;
+       
+       if(PyTuple_Size(args)==2) {
+               if (!PyArg_ParseTuple(args,"sO:setChannel", &string, &pymat)) // matrix
+                       return NULL;
+       }
+       else if(PyTuple_Size(args)==4) {
+               if (!PyArg_ParseTuple(args,"sOOO:setChannel", &string, &pyloc, &pysize, &pyquat)) // loc/size/quat
+                       return NULL;
+       }
+       else {
+               PyErr_SetString(PyExc_ValueError, "Expected a string and a 4x4 matrix (2 args) or a string and loc/size/quat sequences (4 args)");
+               return NULL;
+       }
+       
+       if(pymat) {
+               float matrix[4][4];
+               MT_Matrix4x4 mat;
+               
+               if(!PyMatTo(pymat, mat))
+                       return NULL;
+               
+               mat.setValue((const float *)matrix);
+               
+               BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent();
+               obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
+               
+               if (!m_userpose) {
+                       obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
+                       game_copy_pose(&m_userpose, m_pose);
+               }
+               pchan= verify_pose_channel(m_userpose, string); // adds the channel if its not there.
+               
+               VECCOPY (pchan->loc, matrix[3]);
+               Mat4ToSize(matrix, pchan->size);
+               Mat4ToQuat(matrix, pchan->quat);
+       }
+       else {
+               MT_Vector3 loc;
+               MT_Vector3 size;
+               MT_Quaternion quat;
+               
+               if (!PyVecTo(pyloc, loc) || !PyVecTo(pysize, size) || !PyQuatTo(pyquat, quat))
+                       return NULL;
+               
+               // same as above
+               if (!m_userpose) {
+                       obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
+                       game_copy_pose(&m_userpose, m_pose);
+               }
+               pchan= verify_pose_channel(m_userpose, string);
+               
+               // for some reason loc.setValue(pchan->loc) fails
+               pchan->loc[0]= loc[0]; pchan->loc[1]= loc[1]; pchan->loc[2]= loc[2];
+               pchan->size[0]= size[0]; pchan->size[1]= size[1]; pchan->size[2]= size[2];
+               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 */
+       }
+       
+       pchan->flag |= POSE_ROT|POSE_LOC|POSE_SIZE;
+       Py_RETURN_NONE;
+}
+
+/* ------------------------------------------------------------------------- */
+/* Python Integration Hooks                                                                     */
+/* ------------------------------------------------------------------------- */
+
+PyTypeObject BL_ActionActuator::Type = {
+#if (PY_VERSION_HEX >= 0x02060000)
+       PyVarObject_HEAD_INIT(NULL, 0)
+#else
+       /* python 2.5 and below */
+       PyObject_HEAD_INIT( NULL )  /* required py macro */
+       0,                          /* ob_size */
+#endif
+               "BL_ActionActuator",
+               sizeof(PyObjectPlus_Proxy),
+               0,
+               py_base_dealloc,
+               0,
+               0,
+               0,
+               0,
+               py_base_repr,
+               0,0,0,0,0,0,0,0,0,
+               Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+               0,0,0,0,0,0,0,
+               Methods,
+               0,
+               0,
+               &SCA_IActuator::Type,
+               0,0,0,0,0,0,
+               py_base_new
+};
+
+PyMethodDef BL_ActionActuator::Methods[] = {
+       //Deprecated ----->
+       {"setAction", (PyCFunction) BL_ActionActuator::sPySetAction, METH_VARARGS, (PY_METHODCHAR)SetAction_doc},
+       {"setStart", (PyCFunction) BL_ActionActuator::sPySetStart, METH_VARARGS, (PY_METHODCHAR)SetStart_doc},
+       {"setEnd", (PyCFunction) BL_ActionActuator::sPySetEnd, METH_VARARGS, (PY_METHODCHAR)SetEnd_doc},
+       {"setBlendin", (PyCFunction) BL_ActionActuator::sPySetBlendin, METH_VARARGS, (PY_METHODCHAR)SetBlendin_doc},
+       {"setPriority", (PyCFunction) BL_ActionActuator::sPySetPriority, METH_VARARGS, (PY_METHODCHAR)SetPriority_doc},
+       {"setFrame", (PyCFunction) BL_ActionActuator::sPySetFrame, METH_VARARGS, (PY_METHODCHAR)SetFrame_doc},
+       {"setProperty", (PyCFunction) BL_ActionActuator::sPySetProperty, METH_VARARGS, (PY_METHODCHAR)SetProperty_doc},
+       {"setFrameProperty", (PyCFunction) BL_ActionActuator::sPySetFrameProperty, METH_VARARGS, (PY_METHODCHAR)SetFrameProperty_doc},
+       {"setBlendtime", (PyCFunction) BL_ActionActuator::sPySetBlendtime, METH_VARARGS, (PY_METHODCHAR)SetBlendtime_doc},
+
+       {"getAction", (PyCFunction) BL_ActionActuator::sPyGetAction, METH_VARARGS, (PY_METHODCHAR)GetAction_doc},
+       {"getStart", (PyCFunction) BL_ActionActuator::sPyGetStart, METH_VARARGS, (PY_METHODCHAR)GetStart_doc},
+       {"getEnd", (PyCFunction) BL_ActionActuator::sPyGetEnd, METH_VARARGS, (PY_METHODCHAR)GetEnd_doc},
+       {"getBlendin", (PyCFunction) BL_ActionActuator::sPyGetBlendin, METH_VARARGS, (PY_METHODCHAR)GetBlendin_doc},
+       {"getPriority", (PyCFunction) BL_ActionActuator::sPyGetPriority, METH_VARARGS, (PY_METHODCHAR)GetPriority_doc},
+       {"getFrame", (PyCFunction) BL_ActionActuator::sPyGetFrame, METH_VARARGS, (PY_METHODCHAR)GetFrame_doc},
+       {"getProperty", (PyCFunction) BL_ActionActuator::sPyGetProperty, METH_VARARGS, (PY_METHODCHAR)GetProperty_doc},
+       {"getFrameProperty", (PyCFunction) BL_ActionActuator::sPyGetFrameProperty, METH_VARARGS, (PY_METHODCHAR)GetFrameProperty_doc},
+       {"getChannel", (PyCFunction) BL_ActionActuator::sPyGetChannel, METH_O},
+       {"getType", (PyCFunction) BL_ActionActuator::sPyGetType, METH_VARARGS, (PY_METHODCHAR)GetType_doc},
+       {"setType", (PyCFunction) BL_ActionActuator::sPySetType, METH_VARARGS, (PY_METHODCHAR)SetType_doc},
+       {"getContinue", (PyCFunction) BL_ActionActuator::sPyGetContinue, METH_NOARGS, 0},       
+       {"setContinue", (PyCFunction) BL_ActionActuator::sPySetContinue, METH_O, 0},
+       //<------
+       KX_PYMETHODTABLE(BL_ActionActuator, setChannel),
+       {NULL,NULL} //Sentinel
+};
+
+PyAttributeDef BL_ActionActuator::Attributes[] = {
+       KX_PYATTRIBUTE_FLOAT_RW("frameStart", 0, MAXFRAMEF, BL_ActionActuator, m_startframe),
+       KX_PYATTRIBUTE_FLOAT_RW("frameEnd", 0, MAXFRAMEF, BL_ActionActuator, m_endframe),
+       KX_PYATTRIBUTE_FLOAT_RW("blendIn", 0, MAXFRAMEF, BL_ActionActuator, m_blendin),
+       KX_PYATTRIBUTE_RW_FUNCTION("action", BL_ActionActuator, pyattr_get_action, pyattr_set_action),
+       KX_PYATTRIBUTE_SHORT_RW("priority", 0, 100, false, BL_ActionActuator, m_priority),
+       KX_PYATTRIBUTE_FLOAT_RW_CHECK("frame", 0, MAXFRAMEF, BL_ActionActuator, m_localtime, CheckFrame),
+       KX_PYATTRIBUTE_STRING_RW("propName", 0, 31, false, BL_ActionActuator, m_propname),
+       KX_PYATTRIBUTE_STRING_RW("framePropName", 0, 31, false, BL_ActionActuator, m_framepropname),
+       KX_PYATTRIBUTE_BOOL_RW("useContinue", BL_ActionActuator, m_end_reset),
+       KX_PYATTRIBUTE_FLOAT_RW_CHECK("blendTime", 0, MAXFRAMEF, BL_ActionActuator, m_blendframe, CheckBlendTime),
+       KX_PYATTRIBUTE_SHORT_RW_CHECK("mode",0,100,false,BL_ActionActuator,m_playtype,CheckType),
+       { NULL }        //Sentinel
+};
+
+PyObject* BL_ActionActuator::pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+       return PyUnicode_FromString(self->GetAction() ? self->GetAction()->id.name+2 : "");
+}
+
+int BL_ActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       BL_ActionActuator* self= static_cast<BL_ActionActuator*>(self_v);
+       
+       if (!PyUnicode_Check(value))
+       {
+               PyErr_SetString(PyExc_ValueError, "actuator.action = val: Action Actuator, expected the string name of the action");
+               return PY_SET_ATTR_FAIL;
+       }
+
+       bAction *action= NULL;
+       STR_String val = _PyUnicode_AsString(value);
+       
+       if (val != "")
+       {
+               action= (bAction*)SCA_ILogicBrick::m_sCurrentLogicManager->GetActionByName(val);
+               if (!action)
+               {
+                       PyErr_SetString(PyExc_ValueError, "actuator.action = val: Action Actuator, action not found!");
+                       return PY_SET_ATTR_FAIL;
+               }
+       }
+       
+       self->SetAction(action);
+       return PY_SET_ATTR_SUCCESS;
+
+}