code cleanup: some warnings and formatting for PyMethodDef's in the BGE.

This commit is contained in:
Campbell Barton 2012-11-10 05:42:50 +00:00
parent fc2b52b837
commit 936f0388e8
13 changed files with 38 additions and 35 deletions

@ -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)
{

@ -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

@ -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

@ -639,7 +639,6 @@ PyTypeObject BL_ArmatureObject::Type = {
};
PyMethodDef BL_ArmatureObject::Methods[] = {
KX_PYMETHODTABLE_NOARGS(BL_ArmatureObject, update),
{NULL,NULL} //Sentinel
};

@ -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);
@ -1060,6 +1063,8 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
}
}
// TIMEIT_END(bge_link_blend_file);
return true;
}

@ -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]))

@ -202,7 +202,7 @@ PyTypeObject SCA_ILogicBrick::Type = {
};
PyMethodDef SCA_ILogicBrick::Methods[] = {
{NULL,NULL} //Sentinel
{NULL,NULL} //Sentinel
};
PyAttributeDef SCA_ILogicBrick::Attributes[] = {

@ -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__ */

@ -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[] = {

@ -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[] = {

@ -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[] = {

@ -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},
{"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},
{"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
{"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[] = {

@ -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},