Revision: 19427
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19427
Author:   ben2610
Date:     2009-03-27 23:11:30 +0100 (Fri, 27 Mar 2009)

Log Message:
-----------
BGE API Cleanup: GameActuator (patch from Andre)

Modified Paths:
--------------
    trunk/blender/source/gameengine/Ketsji/KX_GameActuator.cpp
    trunk/blender/source/gameengine/Ketsji/KX_GameActuator.h
    trunk/blender/source/gameengine/PyDoc/KX_GameActuator.py

Modified: trunk/blender/source/gameengine/Ketsji/KX_GameActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameActuator.cpp  2009-03-27 
21:54:16 UTC (rev 19426)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameActuator.cpp  2009-03-27 
22:11:30 UTC (rev 19427)
@@ -241,21 +241,44 @@
 
 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},
+       // <-----
        {NULL,NULL} //Sentinel
 };
 
 PyAttributeDef KX_GameActuator::Attributes[] = {
+       KX_PYATTRIBUTE_STRING_RW("file",0,100,false,KX_GameActuator,m_filename),
        { NULL }        //Sentinel
 };
 
+PyObject*
+KX_GameActuator::_getattr(const char *attr)
+{
+       PyObject* object = _getattr_self(Attributes, this, attr);
+       if (object != NULL)
+               return object;
+       _getattr_up(SCA_IActuator);
+}
+
+int KX_GameActuator::_setattr(const char *attr, PyObject *value)
+{
+       int ret = _setattr_self(Attributes, this, attr, value);
+       if (ret >= 0)
+               return ret;
+       return SCA_IActuator::_setattr(attr, value);
+}
+
+
+// Deprecated ----->
 /* getFile */
 const char KX_GameActuator::GetFile_doc[] = 
 "getFile()\n"
 "get the name of the file to start.\n";
 PyObject* KX_GameActuator::PyGetFile(PyObject* self, PyObject* args, PyObject* 
kwds)
 {      
+       ShowDeprecationWarning("getFile()", "the file property");
        return PyString_FromString(m_filename);
 }
 
@@ -266,6 +289,8 @@
 PyObject* KX_GameActuator::PySetFile(PyObject* self, PyObject* args, PyObject* 
kwds)
 {
        char* new_file;
+
+       ShowDeprecationWarning("setFile()", "the file property");
        
        if (!PyArg_ParseTuple(args, "s", &new_file))
        {
@@ -277,12 +302,4 @@
        Py_RETURN_NONE;
 
 }
-       
-
-
-PyObject* KX_GameActuator::_getattr(const char *attr)
-{
-       _getattr_up(SCA_IActuator);
-}
-
-
+// <-----      

Modified: trunk/blender/source/gameengine/Ketsji/KX_GameActuator.h
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameActuator.h    2009-03-27 
21:54:16 UTC (rev 19426)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameActuator.h    2009-03-27 
22:11:30 UTC (rev 19427)
@@ -78,8 +78,12 @@
        /* 
--------------------------------------------------------------------- */
 
        virtual PyObject* _getattr(const char *attr);
+       virtual int _setattr(const char *attr, PyObject *value);
+
+       // Deprecated functions ----->
        KX_PYMETHOD_DOC(KX_GameActuator,GetFile);
        KX_PYMETHOD_DOC(KX_GameActuator,SetFile);
+       // <-----
        
 }; /* end of class KX_GameActuator */
 

Modified: trunk/blender/source/gameengine/PyDoc/KX_GameActuator.py
===================================================================
--- trunk/blender/source/gameengine/PyDoc/KX_GameActuator.py    2009-03-27 
21:54:16 UTC (rev 19426)
+++ trunk/blender/source/gameengine/PyDoc/KX_GameActuator.py    2009-03-27 
22:11:30 UTC (rev 19427)
@@ -5,15 +5,22 @@
 class KX_GameActuator(SCA_IActuator):
        """
        The game actuator loads a new .blend file, restarts the current .blend 
file or quits the game.
+       
+       Properties:
+       
+       @ivar file: the new .blend file to load
+       @type file: string.
        """
        def getFile():
                """
+               DEPRECATED: use the file property
                Returns the filename of the new .blend file to load.
                
                @rtype: string
                """
        def setFile(filename):
                """
+               DEPRECATED: use the file property
                Sets the new .blend file to load.
                
                @param filename: The file name this actuator will load.


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to