Fix a bug that createVisualShape(Array) does not have the correct color. Add urdfEditor.py to pybullet_utils. Remove all unnecessary changes of white spaces.

This commit is contained in:
jietan 2018-03-14 20:47:56 -07:00
parent d91a58e050
commit f4ca3f5963
2 changed files with 535 additions and 528 deletions

View File

@ -3953,7 +3953,6 @@ bool PhysicsServerCommandProcessor::processCreateVisualShapeCommand(const struct
btAlignedObjectArray<BulletURDFTexture> textures; btAlignedObjectArray<BulletURDFTexture> textures;
UrdfVisual visualShape; UrdfVisual visualShape;
for (int userShapeIndex = 0; userShapeIndex< clientCmd.m_createUserShapeArgs.m_numUserShapes; userShapeIndex++) for (int userShapeIndex = 0; userShapeIndex< clientCmd.m_createUserShapeArgs.m_numUserShapes; userShapeIndex++)
{ {
@ -4039,9 +4038,6 @@ bool PhysicsServerCommandProcessor::processCreateVisualShapeCommand(const struct
bool hasRGBA = (clientCmd.m_createUserShapeArgs.m_shapes[userShapeIndex].m_visualFlags&GEOM_VISUAL_HAS_RGBA_COLOR) != 0;; bool hasRGBA = (clientCmd.m_createUserShapeArgs.m_shapes[userShapeIndex].m_visualFlags&GEOM_VISUAL_HAS_RGBA_COLOR) != 0;;
bool hasSpecular = (clientCmd.m_createUserShapeArgs.m_shapes[userShapeIndex].m_visualFlags&GEOM_VISUAL_HAS_SPECULAR_COLOR) != 0;; bool hasSpecular = (clientCmd.m_createUserShapeArgs.m_shapes[userShapeIndex].m_visualFlags&GEOM_VISUAL_HAS_SPECULAR_COLOR) != 0;;
visualShape.m_geometry.m_hasLocalMaterial = hasRGBA | hasSpecular; visualShape.m_geometry.m_hasLocalMaterial = hasRGBA | hasSpecular;
@ -4086,7 +4082,9 @@ bool PhysicsServerCommandProcessor::processCreateVisualShapeCommand(const struct
u2b.convertURDFToVisualShapeInternal(&visualShape, pathPrefix, localInertiaFrame.inverse()*childTrans, vertices, indices, textures); u2b.convertURDFToVisualShapeInternal(&visualShape, pathPrefix, localInertiaFrame.inverse()*childTrans, vertices, indices, textures);
} }
if (vertices.size() && indices.size()) if (vertices.size() && indices.size())
{ {
if (1) if (1)

View File

@ -6112,11 +6112,13 @@ static PyObject* pybullet_createVisualShape(PyObject* self, PyObject* args, PyOb
{ {
pybullet_internalSetVectord(visualFramePositionObj,visualFramePosition); pybullet_internalSetVectord(visualFramePositionObj,visualFramePosition);
} }
if (visualFrameOrientationObj) if (visualFrameOrientationObj)
{ {
pybullet_internalSetVector4d(visualFrameOrientationObj,visualFrameOrientation); pybullet_internalSetVector4d(visualFrameOrientationObj,visualFrameOrientation);
} }
b3CreateVisualShapeSetChildTransform(commandHandle, shapeIndex, visualFramePosition,visualFrameOrientation); b3CreateVisualShapeSetChildTransform(commandHandle, shapeIndex, visualFramePosition,visualFrameOrientation);
} }
@ -6167,6 +6169,10 @@ static PyObject* pybullet_createVisualShapeArray(PyObject* self, PyObject* args,
PyErr_SetString(SpamError, "Not connected to physics server."); PyErr_SetString(SpamError, "Not connected to physics server.");
return NULL; return NULL;
} }
{ {
b3SharedMemoryCommandHandle commandHandle = b3CreateVisualShapeCommandInit(sm); b3SharedMemoryCommandHandle commandHandle = b3CreateVisualShapeCommandInit(sm);
int numShapeTypes = 0; int numShapeTypes = 0;
@ -6334,6 +6340,9 @@ static PyObject* pybullet_createVisualShapeArray(PyObject* self, PyObject* args,
} }
} }
} }
if (shapeTypeArraySeq) if (shapeTypeArraySeq)
@ -6350,10 +6359,10 @@ static PyObject* pybullet_createVisualShapeArray(PyObject* self, PyObject* args,
Py_DECREF(meshScaleArraySeq); Py_DECREF(meshScaleArraySeq);
if (planeNormalArraySeq) if (planeNormalArraySeq)
Py_DECREF(planeNormalArraySeq); Py_DECREF(planeNormalArraySeq);
if (flagsArraySeq)
Py_DECREF(flagsArraySeq);
if (rgbaColorArraySeq) if (rgbaColorArraySeq)
Py_DECREF(rgbaColorArraySeq); Py_DECREF(rgbaColorArraySeq);
if (flagsArraySeq)
Py_DECREF(flagsArraySeq);
if (positionArraySeq) if (positionArraySeq)
Py_DECREF(positionArraySeq); Py_DECREF(positionArraySeq);
if (orientationArraySeq) if (orientationArraySeq)