BGE Py API
authorCampbell Barton <ideasman42@gmail.com>
Fri, 5 Sep 2008 02:53:12 +0000 (02:53 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 5 Sep 2008 02:53:12 +0000 (02:53 +0000)
added exception messages for replaceMesh.setMesh() and allowed None as an argument.
added exception messages for other BGE module functions.

source/blender/python/api2_2x/Mathutils.c
source/blender/python/api2_2x/Mathutils.h
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
source/gameengine/PyDoc/KX_SCA_ReplaceMeshActuator.py

index 217e096060f9d372fbad81a726e588d083ad2c8f..f0b51285376dac0fd775c014c0fd7cdff99ca9b7 100644 (file)
@@ -108,7 +108,7 @@ struct PyMethodDef M_Mathutils_methods[] = {
 };
 /*----------------------------MODULE INIT-------------------------*/
 /* from can be Blender.Mathutils or GameLogic.Mathutils for the BGE */
-PyObject *Mathutils_Init(char *from)
+PyObject *Mathutils_Init(const char *from)
 {
        PyObject *submodule;
 
index 76d53cb6c4cdf8b93de1852a5373eced088a77a0..0db83216178933956e5202ae0be430edf5595afd 100644 (file)
@@ -38,7 +38,7 @@
 #include "euler.h"
 #include "point.h"
 
-PyObject *Mathutils_Init( char * from );
+PyObject *Mathutils_Init( const char * from );
 PyObject *row_vector_multiplication(VectorObject* vec, MatrixObject * mat);
 PyObject *column_vector_multiplication(MatrixObject * mat, VectorObject* vec);
 PyObject *row_point_multiplication(PointObject* pt, MatrixObject * mat);
index 120311fb967b65bb941f7dc238fd2a13aa78cfce..f2902d0ef012c46d1faa13614f4ab7be22fea222 100644 (file)
@@ -123,15 +123,13 @@ static PyObject* gPyGetRandomFloat(PyObject*)
 static PyObject* gPySetGravity(PyObject*, PyObject* args)
 {
        MT_Vector3 vec = MT_Vector3(0., 0., 0.);
-       if (PyVecArgTo(args, vec))
-       {
-               if (gp_KetsjiScene)
-                       gp_KetsjiScene->SetGravity(vec);
-               
-               Py_Return;
-       }
+       if (!PyVecArgTo(args, vec))
+               return NULL;
+
+       if (gp_KetsjiScene)
+               gp_KetsjiScene->SetGravity(vec);
        
-       return NULL;
+       Py_RETURN_NONE;
 }
 
 static char gPyExpandPath_doc[] =
@@ -149,13 +147,12 @@ static PyObject* gPyExpandPath(PyObject*, PyObject* args)
        char expanded[FILE_MAXDIR + FILE_MAXFILE];
        char* filename;
        
-       if (PyArg_ParseTuple(args,"s",&filename))
-       {
-               BLI_strncpy(expanded, filename, FILE_MAXDIR + FILE_MAXFILE);
-               BLI_convertstringcode(expanded, G.sce);
-               return PyString_FromString(expanded);
-       }
-       return NULL;
+       if (!PyArg_ParseTuple(args,"s",&filename))
+               return NULL;
+
+       BLI_strncpy(expanded, filename, FILE_MAXDIR + FILE_MAXFILE);
+       BLI_convertstringcode(expanded, G.sce);
+       return PyString_FromString(expanded);
 }
 
 
@@ -183,6 +180,12 @@ static PyObject* gPyGetSpectrum(PyObject*)
                        PyList_SetItem(resultlist, index, PyFloat_FromDouble(spectrum[index]));
                }
        }
+       else {
+               for (int index = 0; index < 512; index++)
+               {
+                       PyList_SetItem(resultlist, index, PyFloat_FromDouble(0.0));
+               }
+       }
 
        return resultlist;
 }
@@ -193,16 +196,17 @@ static PyObject* gPyStartDSP(PyObject*, PyObject* args)
 {
        SND_IAudioDevice* audiodevice = SND_DeviceManager::Instance();
 
-       if (audiodevice)
-       {
-               if (!usedsp)
-               {
-                       audiodevice->StartUsingDSP();
-                       usedsp = true;
-                       Py_Return;
-               }
+       if (!audiodevice) {
+               PyErr_SetString(PyExc_RuntimeError, "no audio device available");
+               return NULL;
        }
-       return NULL;
+       
+       if (!usedsp) {
+               audiodevice->StartUsingDSP();
+               usedsp = true;
+       }
+       
+       Py_RETURN_NONE;
 }
 
 
@@ -211,28 +215,27 @@ static PyObject* gPyStopDSP(PyObject*, PyObject* args)
 {
        SND_IAudioDevice* audiodevice = SND_DeviceManager::Instance();
 
-       if (audiodevice)
-       {
-               if (usedsp)
-               {
-                       audiodevice->StopUsingDSP();
-                       usedsp = false;
-                       Py_Return;
-               }
+       if (!audiodevice) {
+               PyErr_SetString(PyExc_RuntimeError, "no audio device available");
+               return NULL;
        }
-       return NULL;
+       
+       if (usedsp) {
+               audiodevice->StopUsingDSP();
+               usedsp = true;
+       }
+       
+       Py_RETURN_NONE;
 }
 
 static PyObject* gPySetLogicTicRate(PyObject*, PyObject* args)
 {
        float ticrate;
-       if (PyArg_ParseTuple(args, "f", &ticrate))
-       {
-               KX_KetsjiEngine::SetTicRate(ticrate);
-               Py_Return;
-       }
+       if (!PyArg_ParseTuple(args, "f", &ticrate))
+               return NULL;
        
-       return NULL;
+       KX_KetsjiEngine::SetTicRate(ticrate);
+       Py_RETURN_NONE;
 }
 
 static PyObject* gPyGetLogicTicRate(PyObject*)
@@ -243,26 +246,21 @@ static PyObject* gPyGetLogicTicRate(PyObject*)
 static PyObject* gPySetPhysicsTicRate(PyObject*, PyObject* args)
 {
        float ticrate;
-       if (PyArg_ParseTuple(args, "f", &ticrate))
-       {
-
-               PHY_GetActiveEnvironment()->setFixedTimeStep(true,ticrate);
-               Py_Return;
-       }
+       if (!PyArg_ParseTuple(args, "f", &ticrate))
+               return NULL;
        
-       return NULL;
+       PHY_GetActiveEnvironment()->setFixedTimeStep(true,ticrate);
+       Py_RETURN_NONE;
 }
 
 static PyObject* gPySetPhysicsDebug(PyObject*, PyObject* args)
 {
        int debugMode;
-       if (PyArg_ParseTuple(args, "i", &debugMode))
-       {
-               PHY_GetActiveEnvironment()->setDebugMode(debugMode);
-               Py_Return;
-       }
+       if (!PyArg_ParseTuple(args, "i", &debugMode))
+               return NULL;
        
-       return NULL;
+       PHY_GetActiveEnvironment()->setDebugMode(debugMode);
+       Py_RETURN_NONE;
 }
 
 
@@ -425,22 +423,14 @@ static struct PyMethodDef game_methods[] = {
 
 static PyObject* gPyGetWindowHeight(PyObject*, PyObject* args)
 {
-       int height = (gp_Canvas ? gp_Canvas->GetHeight() : 0);
-
-               PyObject* heightval = PyInt_FromLong(height);
-               return heightval;
+       return PyInt_FromLong((gp_Canvas ? gp_Canvas->GetHeight() : 0));
 }
 
 
 
 static PyObject* gPyGetWindowWidth(PyObject*, PyObject* args)
 {
-               
-
-       int width = (gp_Canvas ? gp_Canvas->GetWidth() : 0);
-       
-               PyObject* widthval = PyInt_FromLong(width);
-               return widthval;
+       return PyInt_FromLong((gp_Canvas ? gp_Canvas->GetWidth() : 0));
 }
 
 
@@ -451,15 +441,11 @@ bool gUseVisibilityTemp = false;
 static PyObject* gPyEnableVisibility(PyObject*, PyObject* args)
 {
        int visible;
-       if (PyArg_ParseTuple(args,"i",&visible))
-       {
-           gUseVisibilityTemp = (visible != 0);
-       }
-       else
-       {
+       if (!PyArg_ParseTuple(args,"i",&visible))
                return NULL;
-       }
-   Py_Return;
+       
+       gUseVisibilityTemp = (visible != 0);
+       Py_RETURN_NONE;
 }
 
 
@@ -467,23 +453,20 @@ static PyObject* gPyEnableVisibility(PyObject*, PyObject* args)
 static PyObject* gPyShowMouse(PyObject*, PyObject* args)
 {
        int visible;
-       if (PyArg_ParseTuple(args,"i",&visible))
-       {
-           if (visible)
-               {
-                       if (gp_Canvas)
-                               gp_Canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL);
-               } else
-               {
-                       if (gp_Canvas)
-                               gp_Canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE);
-               }
-       }
-       else {
+       if (!PyArg_ParseTuple(args,"i",&visible))
                return NULL;
+       
+       if (visible)
+       {
+               if (gp_Canvas)
+                       gp_Canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL);
+       } else
+       {
+               if (gp_Canvas)
+                       gp_Canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE);
        }
        
-   Py_Return;
+       Py_RETURN_NONE;
 }
 
 
@@ -491,74 +474,81 @@ static PyObject* gPyShowMouse(PyObject*, PyObject* args)
 static PyObject* gPySetMousePosition(PyObject*, PyObject* args)
 {
        int x,y;
-       if (PyArg_ParseTuple(args,"ii",&x,&y))
-       {
-           if (gp_Canvas)
-                       gp_Canvas->SetMousePosition(x,y);
-       }
-       else {
+       if (!PyArg_ParseTuple(args,"ii",&x,&y))
                return NULL;
-       }
        
-   Py_Return;
+       if (gp_Canvas)
+               gp_Canvas->SetMousePosition(x,y);
+       
+       Py_RETURN_NONE;
 }
 
 static PyObject* gPySetEyeSeparation(PyObject*, PyObject* args)
 {
        float sep;
-       if (PyArg_ParseTuple(args, "f", &sep))
-       {
-               if (gp_Rasterizer)
-                       gp_Rasterizer->SetEyeSeparation(sep);
-                       
-               Py_Return;
+       if (!PyArg_ParseTuple(args, "f", &sep))
+               return NULL;
+
+       if (!gp_Rasterizer) {
+               PyErr_SetString(PyExc_RuntimeError, "Rasterizer not available");
+               return NULL;
        }
        
-       return NULL;
+       gp_Rasterizer->SetEyeSeparation(sep);
+       
+       Py_RETURN_NONE;
 }
 
 static PyObject* gPyGetEyeSeparation(PyObject*, PyObject*, PyObject*)
 {
-       if (gp_Rasterizer)
-               return PyFloat_FromDouble(gp_Rasterizer->GetEyeSeparation());
+       if (!gp_Rasterizer) {
+               PyErr_SetString(PyExc_RuntimeError, "Rasterizer not available");
+               return NULL;
+       }
        
-       return NULL;
+       return PyFloat_FromDouble(gp_Rasterizer->GetEyeSeparation());
 }
 
 static PyObject* gPySetFocalLength(PyObject*, PyObject* args)
 {
        float focus;
-       if (PyArg_ParseTuple(args, "f", &focus))
-       {
-               if (gp_Rasterizer)
-                       gp_Rasterizer->SetFocalLength(focus);
-               Py_Return;
+       if (!PyArg_ParseTuple(args, "f", &focus))
+               return NULL;
+       
+       if (!gp_Rasterizer) {
+               PyErr_SetString(PyExc_RuntimeError, "Rasterizer not available");
+               return NULL;
        }
+
+       gp_Rasterizer->SetFocalLength(focus);
        
-       return NULL;
+       Py_RETURN_NONE;
 }
 
 static PyObject* gPyGetFocalLength(PyObject*, PyObject*, PyObject*)
 {
-       if (gp_Rasterizer)
-               return PyFloat_FromDouble(gp_Rasterizer->GetFocalLength());
-       return NULL;
+       if (!gp_Rasterizer) {
+               PyErr_SetString(PyExc_RuntimeError, "Rasterizer not available");
+               return NULL;
+       }
+       
+       return PyFloat_FromDouble(gp_Rasterizer->GetFocalLength());
+       
+       Py_RETURN_NONE;
 }
 
 static PyObject* gPySetBackgroundColor(PyObject*, PyObject* args)
 {
        
        MT_Vector4 vec = MT_Vector4(0., 0., 0.3, 0.);
-       if (PyVecArgTo(args, vec))
+       if (!PyVecArgTo(args, vec))
+               return NULL;
+       
+       if (gp_Canvas)
        {
-               if (gp_Canvas)
-               {
-                       gp_Rasterizer->SetBackColor(vec[0], vec[1], vec[2], vec[3]);
-               }
-               Py_Return;
+               gp_Rasterizer->SetBackColor(vec[0], vec[1], vec[2], vec[3]);
        }
-       
-       return NULL;
+       Py_RETURN_NONE;
 }
 
 
@@ -567,16 +557,16 @@ static PyObject* gPySetMistColor(PyObject*, PyObject* args)
 {
        
        MT_Vector3 vec = MT_Vector3(0., 0., 0.);
-       if (PyVecArgTo(args, vec))
-       {
-               if (gp_Rasterizer)
-               {
-                       gp_Rasterizer->SetFogColor(vec[0], vec[1], vec[2]);
-               }
-               Py_Return;
-       }
+       if (!PyVecArgTo(args, vec))
+               return NULL;
        
-       return NULL;
+       if (!gp_Rasterizer) {
+               PyErr_SetString(PyExc_RuntimeError, "Rasterizer not available");
+               return NULL;
+       }       
+       gp_Rasterizer->SetFogColor(vec[0], vec[1], vec[2]);
+       
+       Py_RETURN_NONE;
 }
 
 
@@ -585,17 +575,17 @@ static PyObject* gPySetMistStart(PyObject*, PyObject* args)
 {
 
        float miststart;
-       if (PyArg_ParseTuple(args,"f",&miststart))
-       {
-               if (gp_Rasterizer)
-               {
-                       gp_Rasterizer->SetFogStart(miststart);
-               }
-       }
-       else {
+       if (!PyArg_ParseTuple(args,"f",&miststart))
+               return NULL;
+       
+       if (!gp_Rasterizer) {
+               PyErr_SetString(PyExc_RuntimeError, "Rasterizer not available");
                return NULL;
        }
-   Py_Return;
+       
+       gp_Rasterizer->SetFogStart(miststart);
+       
+       Py_RETURN_NONE;
 }
 
 
@@ -604,17 +594,17 @@ static PyObject* gPySetMistEnd(PyObject*, PyObject* args)
 {
 
        float mistend;
-       if (PyArg_ParseTuple(args,"f",&mistend))
-       {
-               if (gp_Rasterizer)
-               {
-                       gp_Rasterizer->SetFogEnd(mistend);
-               }
-       }
-       else {
+       if (!PyArg_ParseTuple(args,"f",&mistend))
+               return NULL;
+       
+       if (!gp_Rasterizer) {
+               PyErr_SetString(PyExc_RuntimeError, "Rasterizer not available");
                return NULL;
        }
-   Py_Return;
+       
+       gp_Rasterizer->SetFogEnd(mistend);
+       
+       Py_RETURN_NONE;
 }
 
 
@@ -622,16 +612,16 @@ static PyObject* gPySetAmbientColor(PyObject*, PyObject* args)
 {
        
        MT_Vector3 vec = MT_Vector3(0., 0., 0.);
-       if (PyVecArgTo(args, vec))
-       {
-               if (gp_Rasterizer)
-               {
-                       gp_Rasterizer->SetAmbientColor(vec[0], vec[1], vec[2]);
-               }
-               Py_Return;
-       }
+       if (!PyVecArgTo(args, vec))
+               return NULL;
        
-       return NULL;
+       if (!gp_Rasterizer) {
+               PyErr_SetString(PyExc_RuntimeError, "Rasterizer not available");
+               return NULL;
+       }       
+       gp_Rasterizer->SetAmbientColor(vec[0], vec[1], vec[2]);
+       
+       Py_RETURN_NONE;
 }
 
 
@@ -640,42 +630,43 @@ static PyObject* gPySetAmbientColor(PyObject*, PyObject* args)
 static PyObject* gPyMakeScreenshot(PyObject*, PyObject* args)
 {
        char* filename;
-       if (PyArg_ParseTuple(args,"s",&filename))
-       {
-               if (gp_Canvas)
-               {
-                       gp_Canvas->MakeScreenShot(filename);
-               }
-       }
-       else {
+       if (!PyArg_ParseTuple(args,"s",&filename))
                return NULL;
+       
+       if (gp_Canvas)
+       {
+               gp_Canvas->MakeScreenShot(filename);
        }
-       Py_Return;
+       
+       Py_RETURN_NONE;
 }
 
 static PyObject* gPyEnableMotionBlur(PyObject*, PyObject* args)
 {
        float motionblurvalue;
-       if (PyArg_ParseTuple(args,"f",&motionblurvalue))
-       {
-               if(gp_Rasterizer)
-               {
-                       gp_Rasterizer->EnableMotionBlur(motionblurvalue);
-               }
-       }
-       else {
+       if (!PyArg_ParseTuple(args,"f",&motionblurvalue))
+               return NULL;
+       
+       if (!gp_Rasterizer) {
+               PyErr_SetString(PyExc_RuntimeError, "Rasterizer not available");
                return NULL;
        }
-       Py_Return;
+       
+       gp_Rasterizer->EnableMotionBlur(motionblurvalue);
+       
+       Py_RETURN_NONE;
 }
 
 static PyObject* gPyDisableMotionBlur(PyObject*, PyObject* args)
 {
-       if(gp_Rasterizer)
-       {
-               gp_Rasterizer->DisableMotionBlur();
+       if (!gp_Rasterizer) {
+               PyErr_SetString(PyExc_RuntimeError, "Rasterizer not available");
+               return NULL;
        }
-       Py_Return;
+       
+       gp_Rasterizer->DisableMotionBlur();
+       
+       Py_RETURN_NONE;
 }
 
 int getGLSLSettingFlag(char *setting)
@@ -704,30 +695,33 @@ static PyObject* gPySetGLSLMaterialSetting(PyObject*,
        int enable, flag;
 
        if (PyArg_ParseTuple(args,"si",&setting,&enable))
-       {
-               flag = getGLSLSettingFlag(setting);
-
-               if(flag != -1) {
-                       if (enable)
-                               G.fileflags &= ~flag;
-                       else
-                               G.fileflags |= flag;
-
-                       /* display lists and GLSL materials need to be remade */
-                       if(gp_KetsjiEngine) {
-                               KX_SceneList *scenes = gp_KetsjiEngine->CurrentScenes();
-                               KX_SceneList::iterator it;
+               return NULL;
+       
+       flag = getGLSLSettingFlag(setting);
+       
+       if  (flag==-1) {
+               PyErr_SetString(PyExc_ValueError, "glsl setting is not known");
+               return NULL;
+       }
+       
+       if (enable)
+               G.fileflags &= ~flag;
+       else
+               G.fileflags |= flag;
 
-                               for(it=scenes->begin(); it!=scenes->end(); it++)
-                                       if((*it)->GetBucketManager())
-                                               (*it)->GetBucketManager()->ReleaseDisplayLists();
-                       }
+       /* display lists and GLSL materials need to be remade */
+       if(gp_KetsjiEngine) {
+               KX_SceneList *scenes = gp_KetsjiEngine->CurrentScenes();
+               KX_SceneList::iterator it;
 
-                       GPU_materials_free();
-               }
+               for(it=scenes->begin(); it!=scenes->end(); it++)
+                       if((*it)->GetBucketManager())
+                               (*it)->GetBucketManager()->ReleaseDisplayLists();
        }
 
-       Py_Return;
+       GPU_materials_free();
+
+       Py_RETURN_NONE;
 }
 
 static PyObject* gPyGetGLSLMaterialSetting(PyObject*, 
@@ -737,14 +731,17 @@ static PyObject* gPyGetGLSLMaterialSetting(PyObject*,
        char *setting;
        int enabled = 0, flag;
 
-       if (PyArg_ParseTuple(args,"s",&setting))
-       {
-               flag = getGLSLSettingFlag(setting);
-
-               if(flag != -1)
-                       enabled = ((G.fileflags & flag) != 0);
+       if (!PyArg_ParseTuple(args,"s",&setting))
+               return NULL;
+       
+       flag = getGLSLSettingFlag(setting);
+       
+       if  (flag==-1) {
+               PyErr_SetString(PyExc_ValueError, "glsl setting is not known");
+               return NULL;
        }
 
+       enabled = ((G.fileflags & flag) != 0);
        return PyInt_FromLong(enabled);
 }
 
index 630df2d21d94a5a6378c9ee99fd35803f0e2c9f4..18a297d6c926eff2af7cc576149b44fc6c308942 100644 (file)
@@ -80,7 +80,7 @@ PyParentObject KX_SCA_ReplaceMeshActuator::Parents[] = {
 
 
 PyMethodDef KX_SCA_ReplaceMeshActuator::Methods[] = {
-       {"setMesh", (PyCFunction) KX_SCA_ReplaceMeshActuator::sPySetMesh, METH_VARARGS, SetMesh_doc},
+       {"setMesh", (PyCFunction) KX_SCA_ReplaceMeshActuator::sPySetMesh, METH_O, SetMesh_doc},
        
        KX_PYMETHODTABLE(KX_SCA_ReplaceMeshActuator, instantReplaceMesh),
        KX_PYMETHODTABLE(KX_SCA_ReplaceMeshActuator, getMesh),
@@ -99,28 +99,29 @@ PyObject* KX_SCA_ReplaceMeshActuator::_getattr(const STR_String& attr)
 /* 1. setMesh */
 char KX_SCA_ReplaceMeshActuator::SetMesh_doc[] = 
        "setMesh(name)\n"
-       "\t- name: string\n"
+       "\t- name: string or None\n"
        "\tSet the mesh that will be substituted for the current one.\n";
 
-PyObject* KX_SCA_ReplaceMeshActuator::PySetMesh(PyObject* self,
-                                                                         PyObject* args, 
-                                                                         PyObject* kwds)
+PyObject* KX_SCA_ReplaceMeshActuator::PySetMesh(PyObject* self, PyObject* value)
 {
-       char* meshname;
-       
-       if (!PyArg_ParseTuple(args, "s", &meshname))
-       {
-               return NULL;    
-       }
-
-       void* mesh = SCA_ILogicBrick::m_sCurrentLogicManager->GetMeshByName(STR_String(meshname));
-       
-       if (mesh) {
+       if (value == Py_None) {
+               m_mesh = NULL;
+       } else {
+               char* meshname = PyString_AsString(value);
+               if (!meshname) {
+                       PyErr_SetString(PyExc_ValueError, "Expected the name of a mesh or None");
+                       return NULL;
+               }
+               void* mesh = SCA_ILogicBrick::m_sCurrentLogicManager->GetMeshByName(STR_String(meshname));
+               
+               if (mesh==NULL) {
+                       PyErr_SetString(PyExc_ValueError, "The mesh name given does not exist");
+                       return NULL;
+               }
                m_mesh= (class RAS_MeshObject*)mesh;
-               Py_Return;
        }
        
-       return NULL;
+       Py_RETURN_NONE;
 }
 
 KX_PYMETHODDEF_DOC(KX_SCA_ReplaceMeshActuator, getMesh,
@@ -129,7 +130,7 @@ KX_PYMETHODDEF_DOC(KX_SCA_ReplaceMeshActuator, getMesh,
 )
 {
        if (!m_mesh)
-               Py_Return;
+               Py_RETURN_NONE;
 
        return PyString_FromString(const_cast<char *>(m_mesh->GetName().ReadPtr()));
 }
@@ -139,7 +140,7 @@ KX_PYMETHODDEF_DOC(KX_SCA_ReplaceMeshActuator, instantReplaceMesh,
 "instantReplaceMesh() : immediately replace mesh without delay\n")
 {
        InstantReplaceMesh();
-       Py_Return;
+       Py_RETURN_NONE;
 }
 
 /* ------------------------------------------------------------------------- */
index 5ba0a099b1484a7d819069457a7bd283bebbea56..1da154cc222ab9977df3fadb047526347a6f8a61 100644 (file)
@@ -76,7 +76,7 @@ class KX_SCA_ReplaceMeshActuator : public SCA_IActuator
        void    InstantReplaceMesh();
 
        /* 1. setMesh */
-       KX_PYMETHOD_DOC(KX_SCA_ReplaceMeshActuator,SetMesh);
+       KX_PYMETHOD_DOC_O(KX_SCA_ReplaceMeshActuator,SetMesh);
        KX_PYMETHOD_DOC(KX_SCA_ReplaceMeshActuator,getMesh);
        KX_PYMETHOD_DOC(KX_SCA_ReplaceMeshActuator,instantReplaceMesh);
 
index eb00a91a4ce666f8373a638ee206cd3e7a040208..498f6072e23afd7df3e6c97d54d5d0a59616069e 100644 (file)
@@ -59,8 +59,9 @@ class KX_SCA_ReplaceMeshActuator(SCA_IActuator):
        def setMesh(name):
                """
                Sets the name of the mesh that will replace the current one.
+               When the name is None it will unset the mesh value so no action is taken.
                
-               @type name: string
+               @type name: string or None
                """
        def getMesh():
                """
@@ -68,6 +69,6 @@ class KX_SCA_ReplaceMeshActuator(SCA_IActuator):
                
                Returns None if no mesh has been scheduled to be added.
                
-               @rtype: string
+               @rtype: string or None
                """