code cleanup: some warnings and formatting for PyMethodDef's in the BGE.
authorCampbell Barton <ideasman42@gmail.com>
Sat, 10 Nov 2012 05:42:50 +0000 (05:42 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 10 Nov 2012 05:42:50 +0000 (05:42 +0000)
13 files changed:
intern/guardedalloc/cpp/mallocn.cpp
source/gameengine/Converter/BL_ArmatureChannel.cpp
source/gameengine/Converter/BL_ArmatureConstraint.cpp
source/gameengine/Converter/BL_ArmatureObject.cpp
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
source/gameengine/Expressions/PyObjectPlus.cpp
source/gameengine/GameLogic/SCA_ILogicBrick.cpp
source/gameengine/Ketsji/KX_CharacterWrapper.h
source/gameengine/Ketsji/KX_MeshProxy.cpp
source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
source/gameengine/Ketsji/KX_VertexProxy.cpp
source/gameengine/VideoTexture/ImageRender.cpp

index da77f0e1c83b2a5d3bad7d72eb05945946ae0af6..8b05d25018f5de01efc16c47e99317821fdfea9c 100644 (file)
@@ -28,6 +28,9 @@
 #include <new>
 #include "../MEM_guardedalloc.h"
 
+void *operator new(size_t size, const char *str) throw(std::bad_alloc);
+void *operator new[](size_t size, const char *str) throw(std::bad_alloc);
+
 /* not default but can be used when needing to set a string */
 void *operator new(size_t size, const char *str) throw(std::bad_alloc)
 {
index 7cf895255bac08332f4e3f3a9aed2c977386aaa6..11e90e1797d12992aa3585fb8d67e12ddd380b7a 100644 (file)
@@ -95,7 +95,7 @@ BL_ArmatureChannel::~BL_ArmatureChannel()
 // PYTHON
 
 PyMethodDef BL_ArmatureChannel::Methods[] = {
-  {NULL,NULL} //Sentinel
+       {NULL,NULL} //Sentinel
 };
 
 // order of definition of attributes, must match Attributes[] array
index b8ad117a220b56fc6efdf559ae387d053e922be2..379be91b52308cb3ccebc97126e3bdab8eaf0eba 100644 (file)
@@ -246,7 +246,7 @@ void BL_ArmatureConstraint::SetSubtarget(KX_GameObject* subtarget)
 // PYTHON
 
 PyMethodDef BL_ArmatureConstraint::Methods[] = {
-  {NULL,NULL} //Sentinel
+       {NULL,NULL} //Sentinel
 };
 
 // order of definition of attributes, must match Attributes[] array
index ed97b9ff73ffae8a8d94e83550532f361a9b64a9..1f1c404efcbbed362de43ffff1941ad49931c0cf 100644 (file)
@@ -639,7 +639,6 @@ PyTypeObject BL_ArmatureObject::Type = {
 };
 
 PyMethodDef BL_ArmatureObject::Methods[] = {
-
        KX_PYMETHODTABLE_NOARGS(BL_ArmatureObject, update),
        {NULL,NULL} //Sentinel
 };
index 30a4209965e74f2b13cf9f601ad079b7195ff542..d1684db0f5a49f5dea33042e319970d2d2822d82 100644 (file)
@@ -103,6 +103,7 @@ extern "C"
 #include "KX_MeshProxy.h"
 #include "RAS_MeshObject.h"
 extern "C" {
+       #include "PIL_time.h"
        #include "BKE_context.h"
        #include "BLO_readfile.h"
        #include "BKE_idcode.h"
@@ -957,10 +958,12 @@ static void load_datablocks(Main *main_newlib, BlendHandle *bpy_openlib, const c
 bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const char *path, char *group, KX_Scene *scene_merge, char **err_str, short options)
 {
        Main *main_newlib; /* stored as a dynamic 'main' until we free it */
-       int idcode= BKE_idcode_from_name(group);
+       const int idcode = BKE_idcode_from_name(group);
        ReportList reports;
        static char err_local[255];
-       
+
+//     TIMEIT_START(bge_link_blend_file);
+
        /* only scene and mesh supported right now */
        if (idcode!=ID_SCE && idcode!=ID_ME &&idcode!=ID_AC) {
                snprintf(err_local, sizeof(err_local), "invalid ID type given \"%s\"\n", group);
@@ -1059,7 +1062,9 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
                        }
                }
        }
-       
+
+//     TIMEIT_END(bge_link_blend_file);
+
        return true;
 }
 
index 03f9fb5fb19e210461860dca791b01c73175c742..77c76ca8153288a438e66f0a7c46fa5153097714 100644 (file)
@@ -259,7 +259,7 @@ void PyObjectPlus::py_base_dealloc(PyObject *self)                          // python wrapper
  * PyObjectPlus Methods        -- Every class, even the abstract one should have a Methods
 ------------------------------*/
 PyMethodDef PyObjectPlus::Methods[] = {
-  {NULL, NULL}         /* Sentinel */
+       {NULL, NULL}            /* Sentinel */
 };
 
 #define BGE_PY_ATTR_INVALID (&(PyObjectPlus::Attributes[0]))
index ab0e6c5edcba7f0547c84fb09de37fa91c2e4068..4916d8a0a570e8ca0cb23aeff9597588c26cff37 100644 (file)
@@ -202,7 +202,7 @@ PyTypeObject SCA_ILogicBrick::Type = {
 };
 
 PyMethodDef SCA_ILogicBrick::Methods[] = {
-  {NULL,NULL} //Sentinel
+       {NULL,NULL} //Sentinel
 };
 
 PyAttributeDef SCA_ILogicBrick::Attributes[] = {
index 04303064645f500bf9478def3a6801aef28d2c19..3b0058aca6f4eebcc3a9e0901e695757f6ef91bc 100644 (file)
@@ -30,10 +30,6 @@ public:
 
 private:
        PHY_ICharacter*                  m_character;
-
-#ifdef WITH_CXX_GUARDEDALLOC
-       MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_CharacterWrapper")
-#endif
 };
 
-#endif //__KX_CHARACTERWRAPPER_H__
+#endif  /* __KX_CHARACTERWRAPPER_H__ */
index 87c366046ad81349b4fc6ad65714cd6e0b466011..69be584343acd102d7413491bcf2189d1fea0435 100644 (file)
@@ -70,13 +70,13 @@ PyTypeObject KX_MeshProxy::Type = {
 };
 
 PyMethodDef KX_MeshProxy::Methods[] = {
-{"getMaterialName", (PyCFunction)KX_MeshProxy::sPyGetMaterialName,METH_VARARGS},
-{"getTextureName", (PyCFunction)KX_MeshProxy::sPyGetTextureName,METH_VARARGS},
-{"getVertexArrayLength", (PyCFunction)KX_MeshProxy::sPyGetVertexArrayLength,METH_VARARGS},
-{"getVertex", (PyCFunction)KX_MeshProxy::sPyGetVertex,METH_VARARGS},
-{"getPolygon", (PyCFunction)KX_MeshProxy::sPyGetPolygon,METH_VARARGS},
-//{"getIndexArrayLength", (PyCFunction)KX_MeshProxy::sPyGetIndexArrayLength,METH_VARARGS},
-  {NULL,NULL} //Sentinel
+       {"getMaterialName", (PyCFunction)KX_MeshProxy::sPyGetMaterialName,METH_VARARGS},
+       {"getTextureName", (PyCFunction)KX_MeshProxy::sPyGetTextureName,METH_VARARGS},
+       {"getVertexArrayLength", (PyCFunction)KX_MeshProxy::sPyGetVertexArrayLength,METH_VARARGS},
+       {"getVertex", (PyCFunction)KX_MeshProxy::sPyGetVertex,METH_VARARGS},
+       {"getPolygon", (PyCFunction)KX_MeshProxy::sPyGetPolygon,METH_VARARGS},
+       //{"getIndexArrayLength", (PyCFunction)KX_MeshProxy::sPyGetIndexArrayLength,METH_VARARGS},
+       {NULL,NULL} //Sentinel
 };
 
 PyAttributeDef KX_MeshProxy::Attributes[] = {
index d850168afdf06fbbebb374ef8423a3faf91bdf66..56dccc1d04542c271abe29665d54adbf08f425ae 100644 (file)
@@ -190,8 +190,8 @@ PyTypeObject KX_SCA_AddObjectActuator::Type = {
 };
 
 PyMethodDef KX_SCA_AddObjectActuator::Methods[] = {
-  {"instantAddObject", (PyCFunction) KX_SCA_AddObjectActuator::sPyInstantAddObject, METH_NOARGS,"instantAddObject() : immediately add object without delay\n"},
-  {NULL,NULL} //Sentinel
+       {"instantAddObject", (PyCFunction) KX_SCA_AddObjectActuator::sPyInstantAddObject, METH_NOARGS, NULL},
+       {NULL,NULL} //Sentinel
 };
 
 PyAttributeDef KX_SCA_AddObjectActuator::Attributes[] = {
index e6209d2d47b84492fdf81d2f9581e9796cadf116..81c9dc9160357c801dfd47368f6392dfa7cf85de 100644 (file)
@@ -113,7 +113,7 @@ PyTypeObject KX_SCA_EndObjectActuator::Type = {
 };
 
 PyMethodDef KX_SCA_EndObjectActuator::Methods[] = {
-  {NULL,NULL} //Sentinel
+       {NULL,NULL} //Sentinel
 };
 
 PyAttributeDef KX_SCA_EndObjectActuator::Attributes[] = {
index dabb79b357dc7f4ec12dde689c0b718561c04f37..02333f8ae2f3b8196207f2aa10b5887c4c7a459e 100644 (file)
@@ -61,19 +61,19 @@ PyTypeObject KX_VertexProxy::Type = {
 };
 
 PyMethodDef KX_VertexProxy::Methods[] = {
-{"getXYZ", (PyCFunction)KX_VertexProxy::sPyGetXYZ,METH_NOARGS},
-{"setXYZ", (PyCFunction)KX_VertexProxy::sPySetXYZ,METH_O},
-{"getUV", (PyCFunction)KX_VertexProxy::sPyGetUV,METH_NOARGS},
-{"setUV", (PyCFunction)KX_VertexProxy::sPySetUV,METH_O},
-
-{"getUV2", (PyCFunction)KX_VertexProxy::sPyGetUV2,METH_NOARGS},
-{"setUV2", (PyCFunction)KX_VertexProxy::sPySetUV2,METH_VARARGS},
-
-{"getRGBA", (PyCFunction)KX_VertexProxy::sPyGetRGBA,METH_NOARGS},
-{"setRGBA", (PyCFunction)KX_VertexProxy::sPySetRGBA,METH_O},
-{"getNormal", (PyCFunction)KX_VertexProxy::sPyGetNormal,METH_NOARGS},
-{"setNormal", (PyCFunction)KX_VertexProxy::sPySetNormal,METH_O},
-  {NULL,NULL} //Sentinel
+       {"getXYZ", (PyCFunction)KX_VertexProxy::sPyGetXYZ,METH_NOARGS},
+       {"setXYZ", (PyCFunction)KX_VertexProxy::sPySetXYZ,METH_O},
+       {"getUV", (PyCFunction)KX_VertexProxy::sPyGetUV,METH_NOARGS},
+       {"setUV", (PyCFunction)KX_VertexProxy::sPySetUV,METH_O},
+
+       {"getUV2", (PyCFunction)KX_VertexProxy::sPyGetUV2,METH_NOARGS},
+       {"setUV2", (PyCFunction)KX_VertexProxy::sPySetUV2,METH_VARARGS},
+
+       {"getRGBA", (PyCFunction)KX_VertexProxy::sPyGetRGBA,METH_NOARGS},
+       {"setRGBA", (PyCFunction)KX_VertexProxy::sPySetRGBA,METH_O},
+       {"getNormal", (PyCFunction)KX_VertexProxy::sPyGetNormal,METH_NOARGS},
+       {"setNormal", (PyCFunction)KX_VertexProxy::sPySetNormal,METH_O},
+       {NULL,NULL} //Sentinel
 };
 
 PyAttributeDef KX_VertexProxy::Attributes[] = {
index 85857165403823d6450a05cd3909e1a8f9c20807..2cc2cfb6bfc70d83d6989303879d58697c214427 100644 (file)
@@ -375,7 +375,7 @@ static PyMethodDef imageRenderMethods[] =
 static PyGetSetDef imageRenderGetSets[] =
 { 
        {(char*)"background", (getter)getBackground, (setter)setBackground, (char*)"background color", NULL},
-    // attribute from ImageViewport
+       // attribute from ImageViewport
        {(char*)"capsize", (getter)ImageViewport_getCaptureSize, (setter)ImageViewport_setCaptureSize, (char*)"size of render area", NULL},
        {(char*)"alpha", (getter)ImageViewport_getAlpha, (setter)ImageViewport_setAlpha, (char*)"use alpha in texture", NULL},
        {(char*)"whole", (getter)ImageViewport_getWhole, (setter)ImageViewport_setWhole, (char*)"use whole viewport to render", NULL},