Merge pull request #2404 from erwincoumans/master
fix issues in previous softbody commits (always check for m_multibodyWorld == 0 before using the pointer in ::render method)
This commit is contained in:
@@ -1529,20 +1529,46 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus()
|
||||
{
|
||||
B3_PROFILE("CMD_LOADING_COMPLETED");
|
||||
int numConstraints = serverCmd.m_sdfLoadedArgs.m_numUserConstraints;
|
||||
int numBodies = serverCmd.m_sdfLoadedArgs.m_numBodies;
|
||||
if (serverCmd.m_type == CMD_SYNC_BODY_INFO_COMPLETED)
|
||||
{
|
||||
int* ids = (int*)m_data->m_testBlock1->m_bulletStreamDataServerToClientRefactor;
|
||||
int* constraintUids = ids + numBodies;
|
||||
for (int i = 0; i < numConstraints; i++)
|
||||
{
|
||||
int constraintUid = constraintUids[i];
|
||||
m_data->m_constraintIdsRequestInfo.push_back(constraintUid);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < numConstraints; i++)
|
||||
{
|
||||
int constraintUid = serverCmd.m_sdfLoadedArgs.m_userConstraintUniqueIds[i];
|
||||
m_data->m_constraintIdsRequestInfo.push_back(constraintUid);
|
||||
}
|
||||
int numBodies = serverCmd.m_sdfLoadedArgs.m_numBodies;
|
||||
}
|
||||
|
||||
if (numBodies > 0)
|
||||
{
|
||||
m_data->m_tempBackupServerStatus = m_data->m_lastServerStatus;
|
||||
|
||||
if (serverCmd.m_type == CMD_SYNC_BODY_INFO_COMPLETED)
|
||||
{
|
||||
int* bodyIds = (int*)m_data->m_testBlock1->m_bulletStreamDataServerToClientRefactor;
|
||||
|
||||
for (int i = 0; i < numBodies; i++)
|
||||
{
|
||||
m_data->m_bodyIdsRequestInfo.push_back(bodyIds[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < numBodies; i++)
|
||||
{
|
||||
m_data->m_bodyIdsRequestInfo.push_back(serverCmd.m_sdfLoadedArgs.m_bodyUniqueIds[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int bodyId = m_data->m_bodyIdsRequestInfo[m_data->m_bodyIdsRequestInfo.size() - 1];
|
||||
m_data->m_bodyIdsRequestInfo.pop_back();
|
||||
|
||||
@@ -688,7 +688,10 @@ void PhysicsDirect::processBodyJointInfo(int bodyUniqueId, const SharedMemorySta
|
||||
{
|
||||
bf.setFileDNAisMemoryDNA();
|
||||
}
|
||||
{
|
||||
BT_PROFILE("bf.parse");
|
||||
bf.parse(false);
|
||||
}
|
||||
|
||||
BodyJointInfoCache2* bodyJoints = new BodyJointInfoCache2;
|
||||
m_data->m_bodyJointMap.insert(bodyUniqueId, bodyJoints);
|
||||
@@ -718,6 +721,7 @@ void PhysicsDirect::processBodyJointInfo(int bodyUniqueId, const SharedMemorySta
|
||||
bodyJoints->m_baseName = mb->m_baseName;
|
||||
}
|
||||
addJointInfoFromMultiBodyData(mb, bodyJoints, m_data->m_verboseOutput);
|
||||
|
||||
}
|
||||
}
|
||||
if (bf.ok())
|
||||
@@ -919,17 +923,57 @@ void PhysicsDirect::postProcessStatus(const struct SharedMemoryStatus& serverCmd
|
||||
break;
|
||||
}
|
||||
case CMD_SYNC_BODY_INFO_COMPLETED:
|
||||
clearCachedBodies();
|
||||
case CMD_MJCF_LOADING_COMPLETED:
|
||||
case CMD_SDF_LOADING_COMPLETED:
|
||||
{
|
||||
//we'll stream further info from the physics server
|
||||
//so serverCmd will be invalid, make a copy
|
||||
|
||||
btAlignedObjectArray<int> bodyIdArray;
|
||||
btAlignedObjectArray<int> constraintIdArray;
|
||||
|
||||
int numConstraints = serverCmd.m_sdfLoadedArgs.m_numUserConstraints;
|
||||
int numBodies = serverCmd.m_sdfLoadedArgs.m_numBodies;
|
||||
|
||||
bodyIdArray.reserve(numBodies);
|
||||
constraintIdArray.reserve(numConstraints);
|
||||
|
||||
if (serverCmd.m_type == CMD_SYNC_BODY_INFO_COMPLETED)
|
||||
{
|
||||
clearCachedBodies();
|
||||
const int* bodyIds = (int*)m_data->m_bulletStreamDataServerToClient;
|
||||
const int* constaintIds = bodyIds + numBodies;
|
||||
|
||||
for (int i = 0; i < numConstraints; i++)
|
||||
{
|
||||
int constraintUid = constaintIds[i];
|
||||
constraintIdArray.push_back(constraintUid);
|
||||
}
|
||||
for (int i = 0; i < numBodies; i++)
|
||||
{
|
||||
int bodyUid = bodyIds[i];
|
||||
bodyIdArray.push_back(bodyUid);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < numConstraints; i++)
|
||||
{
|
||||
int constraintUid = serverCmd.m_sdfLoadedArgs.m_userConstraintUniqueIds[i];
|
||||
constraintIdArray.push_back(constraintUid);
|
||||
}
|
||||
for (int i = 0; i < numBodies; i++)
|
||||
{
|
||||
int bodyUid = serverCmd.m_sdfLoadedArgs.m_bodyUniqueIds[i];
|
||||
bodyIdArray.push_back(bodyUid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < numConstraints; i++)
|
||||
{
|
||||
int constraintUid = constraintIdArray[i];
|
||||
|
||||
m_data->m_tmpInfoRequestCommand.m_type = CMD_USER_CONSTRAINT;
|
||||
m_data->m_tmpInfoRequestCommand.m_updateFlags = USER_CONSTRAINT_REQUEST_INFO;
|
||||
@@ -953,10 +997,10 @@ void PhysicsDirect::postProcessStatus(const struct SharedMemoryStatus& serverCmd
|
||||
}
|
||||
}
|
||||
|
||||
int numBodies = serverCmd.m_sdfLoadedArgs.m_numBodies;
|
||||
|
||||
for (int i = 0; i < numBodies; i++)
|
||||
{
|
||||
int bodyUniqueId = serverCmd.m_sdfLoadedArgs.m_bodyUniqueIds[i];
|
||||
int bodyUniqueId = bodyIdArray[i];
|
||||
|
||||
m_data->m_tmpInfoRequestCommand.m_type = CMD_REQUEST_BODY_INFO;
|
||||
m_data->m_tmpInfoRequestCommand.m_sdfRequestInfoArgs.m_bodyUniqueId = bodyUniqueId;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -654,15 +654,20 @@ public:
|
||||
{
|
||||
if (m_debugDraw)
|
||||
{
|
||||
m_csGUI->lock();
|
||||
//draw stuff and flush?
|
||||
m_debugDraw->drawDebugDrawerLines();
|
||||
m_csGUI->unlock();
|
||||
}
|
||||
}
|
||||
virtual void clearLines()
|
||||
{
|
||||
m_csGUI->lock();
|
||||
if (m_debugDraw)
|
||||
{
|
||||
m_debugDraw->clearLines();
|
||||
}
|
||||
m_csGUI->unlock();
|
||||
}
|
||||
|
||||
GUIHelperInterface* m_childGuiHelper;
|
||||
|
||||
@@ -9024,10 +9024,23 @@ static PyObject* pybullet_createMultiBody(PyObject* self, PyObject* args, PyObje
|
||||
if (statusType == CMD_CREATE_MULTI_BODY_COMPLETED)
|
||||
{
|
||||
int uid = b3GetStatusBodyIndex(statusHandle);
|
||||
if (numBatchPositions > 0)
|
||||
{
|
||||
PyObject* pyResultList = PyTuple_New(numBatchPositions );
|
||||
for (i = 0; i < numBatchPositions; i++)
|
||||
{
|
||||
PyTuple_SetItem(pyResultList, i, PyLong_FromLong(uid - numBatchPositions + i + 1));
|
||||
}
|
||||
return pyResultList;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
PyObject* ob = PyLong_FromLong(uid);
|
||||
return ob;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (seqLinkMasses)
|
||||
|
||||
Reference in New Issue
Block a user