Parse physicsClientId before calling getPhysicsClient

This commit is contained in:
Maxime Busy 2019-01-23 12:02:17 +01:00
parent c993175a58
commit b4eca192fb

View File

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