BulletSim: prevent asset fetching loop when the fetched asset fails to mesh.

Check for the case where the fetched mesh asset fails meshing (degenerate
triangles or no physical mesh). In this case, the asset is marked 'failed'
and BulletSim doesn't keep trying to fetch over-and-over trying to get a
good asset.
user_profiles
Robert Adams 2013-03-26 15:02:10 -07:00
parent e82fab34d7
commit abde0d4efb
1 changed files with 68 additions and 56 deletions

View File

@ -929,6 +929,17 @@ public sealed class BSShapeCollection : IDisposable
if (newShape.HasPhysicalShape)
return newShape;
// VerifyMeshCreated is called after trying to create the mesh. If we think the asset had been
// fetched but we end up here again, the meshing of the asset must have failed.
// Prevent trying to keep fetching the mesh by declaring failure.
if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched)
{
prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed;
PhysicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. {1}, texture={2}",
LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture);
}
else
{
// If this mesh has an underlying asset and we have not failed getting it before, fetch the asset
if (prim.BaseShape.SculptEntry
&& prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Failed
@ -988,8 +999,9 @@ public sealed class BSShapeCollection : IDisposable
{
if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed)
{
PhysicsScene.Logger.ErrorFormat("{0} Mesh failed to fetch asset. lID={1}, texture={2}",
LogHeader, prim.LocalID, prim.BaseShape.SculptTexture);
PhysicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. obj={1}, texture={2}",
LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture);
}
}
}