minor fixes, bump up pybullet to 2.5.5

This commit is contained in:
Erwin Coumans
2019-08-14 21:30:10 -07:00
parent f09cefabe8
commit 648844e898
3 changed files with 26 additions and 22 deletions

View File

@@ -8054,41 +8054,45 @@ static PyObject* pybullet_createCollisionShape(PyObject* self, PyObject* args, P
} }
if (shapeType == GEOM_HEIGHTFIELD && fileName==0 && heightfieldDataObj && numHeightfieldColumns>0 && numHeightfieldRows > 0) if (shapeType == GEOM_HEIGHTFIELD && fileName==0 && heightfieldDataObj && numHeightfieldColumns>0 && numHeightfieldRows > 0)
{ {
PyObject* seqPoints=0;
int numHeightfieldPoints;
if (meshScaleObj) if (meshScaleObj)
{ {
pybullet_internalSetVectord(meshScaleObj, meshScale); pybullet_internalSetVectord(meshScaleObj, meshScale);
} }
PyObject* seqPoints = PySequence_Fast(heightfieldDataObj, "expected a sequence"); seqPoints = PySequence_Fast(heightfieldDataObj, "expected a sequence");
int numHeightfieldPoints = PySequence_Size(heightfieldDataObj); numHeightfieldPoints = PySequence_Size(heightfieldDataObj);
if (numHeightfieldPoints != numHeightfieldColumns*numHeightfieldRows) if (numHeightfieldPoints != numHeightfieldColumns*numHeightfieldRows)
{ {
PyErr_SetString(SpamError, "Size of heightfieldData doesn't match numHeightfieldColumns*numHeightfieldRows"); PyErr_SetString(SpamError, "Size of heightfieldData doesn't match numHeightfieldColumns*numHeightfieldRows");
return NULL; return NULL;
} }
PyObject* item;
int i;
float* pointBuffer = (float*)malloc(numHeightfieldPoints*sizeof(float));
if (PyList_Check(seqPoints))
{ {
for (i = 0; i < numHeightfieldPoints; i++) PyObject* item;
int i;
float* pointBuffer = (float*)malloc(numHeightfieldPoints*sizeof(float));
if (PyList_Check(seqPoints))
{ {
item = PyList_GET_ITEM(seqPoints, i); for (i = 0; i < numHeightfieldPoints; i++)
pointBuffer[i] = (float)PyFloat_AsDouble(item); {
item = PyList_GET_ITEM(seqPoints, i);
pointBuffer[i] = (float)PyFloat_AsDouble(item);
}
} }
} else
else
{
for (i = 0; i < numHeightfieldPoints; i++)
{ {
item = PyTuple_GET_ITEM(seqPoints, i); for (i = 0; i < numHeightfieldPoints; i++)
pointBuffer[i] = (float)PyFloat_AsDouble(item); {
item = PyTuple_GET_ITEM(seqPoints, i);
pointBuffer[i] = (float)PyFloat_AsDouble(item);
}
} }
} shapeIndex = b3CreateCollisionShapeAddHeightfield2(sm, commandHandle, meshScale, heightfieldTextureScaling, pointBuffer, numHeightfieldRows, numHeightfieldColumns, replaceHeightfieldIndex);
shapeIndex = b3CreateCollisionShapeAddHeightfield2(sm, commandHandle, meshScale, heightfieldTextureScaling, pointBuffer, numHeightfieldRows, numHeightfieldColumns, replaceHeightfieldIndex);
free(pointBuffer); free(pointBuffer);
if (seqPoints) if (seqPoints)
Py_DECREF(seqPoints); Py_DECREF(seqPoints);
}
} }
if (shapeType == GEOM_MESH && fileName) if (shapeType == GEOM_MESH && fileName)
{ {

View File

@@ -485,7 +485,7 @@ if 'BT_USE_EGL' in EGL_CXX_FLAGS:
setup( setup(
name='pybullet', name='pybullet',
version='2.5.4', version='2.5.5',
description= description=
'Official Python Interface for the Bullet Physics SDK specialized for Robotics Simulation and Reinforcement Learning', 'Official Python Interface for the Bullet Physics SDK specialized for Robotics Simulation and Reinforcement Learning',
long_description= long_description=

View File

@@ -33,7 +33,7 @@ struct DeformableContactConstraint
append(rcontact); append(rcontact);
} }
DeformableContactConstraint(const btVector3 dir) DeformableContactConstraint(const btVector3& dir)
{ {
m_contact.push_back(NULL); m_contact.push_back(NULL);
m_direction.push_back(dir); m_direction.push_back(dir);