From 192b92a6dd4576c6aa28aa87c9c37996dbc2c527 Mon Sep 17 00:00:00 2001 From: Fredrik Svantesson Date: Fri, 18 Jan 2019 22:58:09 +0100 Subject: [PATCH 1/2] Add space to prevent macro from specifying literal --- src/LinearMath/btScalar.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LinearMath/btScalar.h b/src/LinearMath/btScalar.h index c198bd4b3..ba49d6700 100644 --- a/src/LinearMath/btScalar.h +++ b/src/LinearMath/btScalar.h @@ -124,7 +124,7 @@ inline int btGetVersion() #ifdef BT_DEBUG #ifdef _MSC_VER #include - #define btAssert(x) { if(!(x)){printf("Assert "__FILE__ ":%u (%s)\n", __LINE__, #x);__debugbreak(); }} + #define btAssert(x) { if(!(x)){printf("Assert " __FILE__ ":%u (%s)\n", __LINE__, #x);__debugbreak(); }} #else//_MSC_VER #include #define btAssert assert @@ -152,7 +152,7 @@ inline int btGetVersion() #ifdef __SPU__ #include #define printf spu_printf - #define btAssert(x) {if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);spu_hcmpeq(0,0);}} + #define btAssert(x) {if(!(x)){printf("Assert " __FILE__ ":%u ("#x")\n", __LINE__);spu_hcmpeq(0,0);}} #else #define btAssert assert #endif From b4eca192fbb9d420e28867810f449b902c7ce07c Mon Sep 17 00:00:00 2001 From: Maxime Busy Date: Wed, 23 Jan 2019 12:02:17 +0100 Subject: [PATCH 2/2] Parse physicsClientId before calling getPhysicsClient --- examples/pybullet/pybullet.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/pybullet/pybullet.c b/examples/pybullet/pybullet.c index b506fa183..260e7ad5a 100644 --- a/examples/pybullet/pybullet.c +++ b/examples/pybullet/pybullet.c @@ -6293,17 +6293,17 @@ static PyObject* pybullet_setCollisionFilterGroupMask(PyObject* self, PyObject* static char* kwlist[] = {"bodyUniqueId", "linkIndexA", "collisionFilterGroup", "collisionFilterMask", "physicsClientId", NULL}; + if (!PyArg_ParseTupleAndKeywords(args, keywds, "iiii|i", kwlist, + &bodyUniqueIdA, &linkIndexA, &collisionFilterGroup, &collisionFilterMask, &physicsClientId)) + return NULL; + sm = getPhysicsClient(physicsClientId); if (sm == 0) { PyErr_SetString(SpamError, "Not connected to physics server."); return NULL; } - - if (!PyArg_ParseTupleAndKeywords(args, keywds, "iiii|i", kwlist, - &bodyUniqueIdA, &linkIndexA, &collisionFilterGroup, &collisionFilterMask, &physicsClientId)) - return NULL; - + commandHandle = b3CollisionFilterCommandInit(sm); b3SetCollisionFilterGroupMask(commandHandle, bodyUniqueIdA, linkIndexA, collisionFilterGroup, collisionFilterMask); @@ -6329,6 +6329,10 @@ static PyObject* pybullet_setCollisionFilterPair(PyObject* self, PyObject* args, static char* kwlist[] = {"bodyUniqueIdA", "bodyUniqueIdB", "linkIndexA", "linkIndexB", "enableCollision", "physicsClientId", NULL}; + if (!PyArg_ParseTupleAndKeywords(args, keywds, "iiiii|i", kwlist, + &bodyUniqueIdA, &bodyUniqueIdB, &linkIndexA, &linkIndexB, &enableCollision, &physicsClientId)) + return NULL; + sm = getPhysicsClient(physicsClientId); if (sm == 0) { @@ -6336,10 +6340,6 @@ static PyObject* pybullet_setCollisionFilterPair(PyObject* self, PyObject* args, return NULL; } - if (!PyArg_ParseTupleAndKeywords(args, keywds, "iiiii|i", kwlist, - &bodyUniqueIdA, &bodyUniqueIdB, &linkIndexA, &linkIndexB, &enableCollision, &physicsClientId)) - return NULL; - commandHandle = b3CollisionFilterCommandInit(sm); b3SetCollisionFilterPair(commandHandle, bodyUniqueIdA, bodyUniqueIdB, linkIndexA, linkIndexB, enableCollision);