svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r22701:22704
[blender.git] / source / gameengine / Ketsji / KX_GameActuator.cpp
index 48d7dcd84a29e8b7f09418c0b0c81e4aac52cd3f..3f67de1e9a9b8e136bd5e45541a35c9fc82836e7 100644 (file)
@@ -49,9 +49,8 @@ KX_GameActuator::KX_GameActuator(SCA_IObject *gameobj,
                                                                   const STR_String& filename,
                                                                   const STR_String& loadinganimationname,
                                                                   KX_Scene* scene,
-                                                                  KX_KetsjiEngine* ketsjiengine,
-                                                                  PyTypeObject* T)
-                                                                  : SCA_IActuator(gameobj, T)
+                                                                  KX_KetsjiEngine* ketsjiengine)
+                                                                  : SCA_IActuator(gameobj)
 {
        m_mode = mode;
        m_filename = filename;
@@ -149,6 +148,8 @@ bool KX_GameActuator::Update()
                                } else {
                                        printf("Warning: could not create marshal buffer\n");
                                }
+                               if (marshal_buffer)
+                                       delete [] marshal_buffer;
                        }
                        break;
                }
@@ -206,72 +207,42 @@ bool KX_GameActuator::Update()
 
 /* Integration hooks ------------------------------------------------------- */
 PyTypeObject KX_GameActuator::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
-               "KX_GameActuator",
-               sizeof(PyObjectPlus_Proxy),
-               0,
-               py_base_dealloc,
-               0,
-               0,
-               0,
-               0,
-               py_base_repr,
-               0,0,0,0,0,0,
-               py_base_getattro,
-               py_base_setattro,
-               0,0,0,0,0,0,0,0,0,
-               Methods
+       "KX_GameActuator",
+       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
 };
 
-
-
-PyParentObject KX_GameActuator::Parents[] =
-{
-       &KX_GameActuator::Type,
-               &SCA_IActuator::Type,
-               &SCA_ILogicBrick::Type,
-               &CValue::Type,
-               NULL
-};
-
-
-
 PyMethodDef KX_GameActuator::Methods[] =
 {
        // Deprecated ----->
-       {"getFile",     (PyCFunction) KX_GameActuator::sPyGetFile, METH_VARARGS, (PY_METHODCHAR)GetFile_doc},
-       {"setFile", (PyCFunction) KX_GameActuator::sPySetFile, METH_VARARGS, (PY_METHODCHAR)SetFile_doc},
+       {"getFile",     (PyCFunction) KX_GameActuator::sPyGetFile, METH_VARARGS, (const char *)GetFile_doc},
+       {"setFile", (PyCFunction) KX_GameActuator::sPySetFile, METH_VARARGS, (const char *)SetFile_doc},
        // <-----
        {NULL,NULL} //Sentinel
 };
 
 PyAttributeDef KX_GameActuator::Attributes[] = {
-       KX_PYATTRIBUTE_STRING_RW("file",0,100,false,KX_GameActuator,m_filename),
-       //KX_PYATTRIBUTE_TODO("mode"),
+       KX_PYATTRIBUTE_STRING_RW("fileName",0,100,false,KX_GameActuator,m_filename),
+       KX_PYATTRIBUTE_INT_RW("mode", KX_GAME_NODEF+1, KX_GAME_MAX-1, true, KX_GameActuator, m_mode),
        { NULL }        //Sentinel
 };
 
-PyObject* KX_GameActuator::py_getattro(PyObject *attr)
-{
-       py_getattro_up(SCA_IActuator);
-}
-
-PyObject* KX_GameActuator::py_getattro_dict() {
-       py_getattro_dict_up(SCA_IActuator);
-}
-
-int KX_GameActuator::py_setattro(PyObject *attr, PyObject *value)
-{
-       py_setattro_up(SCA_IActuator);
-}
-
-
 // Deprecated ----->
 /* getFile */
 const char KX_GameActuator::GetFile_doc[] = 
@@ -279,8 +250,8 @@ const char KX_GameActuator::GetFile_doc[] =
 "get the name of the file to start.\n";
 PyObject* KX_GameActuator::PyGetFile(PyObject* args, PyObject* kwds)
 {      
-       ShowDeprecationWarning("getFile()", "the file property");
-       return PyString_FromString(m_filename);
+       ShowDeprecationWarning("getFile()", "the fileName property");
+       return PyUnicode_FromString(m_filename);
 }
 
 /* setFile */
@@ -291,7 +262,7 @@ PyObject* KX_GameActuator::PySetFile(PyObject* args, PyObject* kwds)
 {
        char* new_file;
 
-       ShowDeprecationWarning("setFile()", "the file property");
+       ShowDeprecationWarning("setFile()", "the fileName property");
        
        if (!PyArg_ParseTuple(args, "s:setFile", &new_file))
        {