aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRobert Adams2014-07-26 16:03:43 -0700
committerRobert Adams2014-07-26 16:03:43 -0700
commit9c804466e504275ea4e6379b42113d2fce80f30c (patch)
tree3009549cce4c6435b3cbc228cde266877d29308e
parentAdd inventory.<url>.RequestsMade stat. (diff)
downloadopensim-SC_OLD-9c804466e504275ea4e6379b42113d2fce80f30c.zip
opensim-SC_OLD-9c804466e504275ea4e6379b42113d2fce80f30c.tar.gz
opensim-SC_OLD-9c804466e504275ea4e6379b42113d2fce80f30c.tar.bz2
opensim-SC_OLD-9c804466e504275ea4e6379b42113d2fce80f30c.tar.xz
BulletSim: rearrange code for sensing whether shapes have been
constructed. Add routine to check for failed and use that method rather than checking individual state.
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs25
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs5
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapes.cs90
3 files changed, 60 insertions, 60 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 5a9e9ff..6586099 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -401,20 +401,21 @@ public sealed class BSLinksetCompound : BSLinkset
401 // The linkset must be in an intermediate state where all the children have not yet 401 // The linkset must be in an intermediate state where all the children have not yet
402 // been constructed. This sometimes happens on startup when everything is getting 402 // been constructed. This sometimes happens on startup when everything is getting
403 // built and some shapes have to wait for assets to be read in. 403 // built and some shapes have to wait for assets to be read in.
404 // Just skip this child for the moment and cause the shape to be rebuilt next tick. 404 // Just skip this linkset for the moment and cause the shape to be rebuilt next tick.
405 // One problem might be that the shape is broken somehow and it never becomes completely 405 // One problem might be that the shape is broken somehow and it never becomes completely
406 // available. This might cause the rebuild to happen over and over. 406 // available. This might cause the rebuild to happen over and over.
407 if (LinksetRebuildFailureLoopPrevention-- > 0) 407 LinksetRoot.ForceBodyShapeRebuild(false);
408 { 408 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChildWithNoShape,indx={1},cShape={2},offPos={3},offRot={4}",
409 LinksetRoot.ForceBodyShapeRebuild(false); 409 LinksetRoot.LocalID, cPrim.LinksetChildIndex, childShape, offsetPos, offsetRot);
410 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChildWithNoShape,indx={1},cShape={2},offPos={3},offRot={4}", 410 // Output an annoying warning. It should only happen once but if it keeps coming out,
411 LinksetRoot.LocalID, cPrim.LinksetChildIndex, childShape, offsetPos, offsetRot); 411 // the user knows there is something wrong and will report it.
412 // Output an annoying warning. It should only happen once but if it keeps coming out, 412 m_physicsScene.Logger.WarnFormat("{0} Linkset rebuild warning. If this happens more than one or two times, please report in Mantis 7191", LogHeader);
413 // the user knows there is something wrong and will report it. 413 m_physicsScene.Logger.WarnFormat("{0} pName={1}, childIdx={2}, shape={3}",
414 m_physicsScene.Logger.WarnFormat("{0} Linkset rebuild warning. If this happens more than one or two times, please report in Mantis 7191", LogHeader); 414 LogHeader, LinksetRoot.Name, cPrim.LinksetChildIndex, childShape);
415 m_physicsScene.Logger.WarnFormat("{0} pName={1}, childIdx={2}, shape={3}", 415
416 LogHeader, LinksetRoot.Name, cPrim.LinksetChildIndex, childShape); 416 // This causes the loop to bail on building the rest of this linkset.
417 } 417 // The rebuild operation should fix it up or declare the object unbuildable.
418 return true;
418 } 419 }
419 420
420 return false; // 'false' says to move onto the next child in the list 421 return false; // 'false' says to move onto the next child in the list
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index 7a46550..75ffeb4 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -159,6 +159,11 @@ public abstract class BSPhysObject : PhysicsActor
159 Unknown, Waiting, FailedAssetFetch, FailedMeshing, Fetched 159 Unknown, Waiting, FailedAssetFetch, FailedMeshing, Fetched
160 } 160 }
161 public PrimAssetCondition PrimAssetState { get; set; } 161 public PrimAssetCondition PrimAssetState { get; set; }
162 public virtual bool AssetFailed()
163 {
164 return ( (this.PrimAssetState == PrimAssetCondition.FailedAssetFetch)
165 || (this.PrimAssetState == PrimAssetCondition.FailedMeshing) );
166 }
162 167
163 // The objects base shape information. Null if not a prim type shape. 168 // The objects base shape information. Null if not a prim type shape.
164 public PrimitiveBaseShape BaseShape { get; protected set; } 169 public PrimitiveBaseShape BaseShape { get; protected set; }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
index b344ba1..09f5bc4 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
@@ -177,8 +177,7 @@ public abstract class BSShape
177 { 177 {
178 // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset 178 // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset
179 if (prim.BaseShape.SculptEntry 179 if (prim.BaseShape.SculptEntry
180 && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.FailedAssetFetch 180 && !prim.AssetFailed()
181 && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.FailedMeshing
182 && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Waiting 181 && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Waiting
183 && prim.BaseShape.SculptTexture != OMV.UUID.Zero 182 && prim.BaseShape.SculptTexture != OMV.UUID.Zero
184 ) 183 )
@@ -189,50 +188,46 @@ public abstract class BSShape
189 prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Waiting; 188 prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Waiting;
190 189
191 BSPhysObject xprim = prim; 190 BSPhysObject xprim = prim;
192 Util.FireAndForget(delegate 191 RequestAssetDelegate assetProvider = physicsScene.RequestAssetMethod;
192 if (assetProvider != null)
193 {
194 BSPhysObject yprim = xprim; // probably not necessary, but, just in case.
195 assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset)
193 { 196 {
194 // physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,inFireAndForget", xprim.LocalID); 197 // physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,assetProviderCallback", xprim.LocalID);
195 RequestAssetDelegate assetProvider = physicsScene.RequestAssetMethod; 198 bool assetFound = false;
196 if (assetProvider != null) 199 string mismatchIDs = String.Empty; // DEBUG DEBUG
200 if (asset != null && yprim.BaseShape.SculptEntry)
197 { 201 {
198 BSPhysObject yprim = xprim; // probably not necessary, but, just in case. 202 if (yprim.BaseShape.SculptTexture.ToString() == asset.ID)
199 assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset) 203 {
204 yprim.BaseShape.SculptData = asset.Data;
205 // This will cause the prim to see that the filler shape is not the right
206 // one and try again to build the object.
207 // No race condition with the normal shape setting since the rebuild is at taint time.
208 yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Fetched;
209 yprim.ForceBodyShapeRebuild(false /* inTaintTime */);
210 assetFound = true;
211 }
212 else
200 { 213 {
201 // physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,assetProviderCallback", xprim.LocalID); 214 mismatchIDs = yprim.BaseShape.SculptTexture.ToString() + "/" + asset.ID;
202 bool assetFound = false; 215 }
203 string mismatchIDs = String.Empty; // DEBUG DEBUG
204 if (asset != null && yprim.BaseShape.SculptEntry)
205 {
206 if (yprim.BaseShape.SculptTexture.ToString() == asset.ID)
207 {
208 yprim.BaseShape.SculptData = asset.Data;
209 // This will cause the prim to see that the filler shape is not the right
210 // one and try again to build the object.
211 // No race condition with the normal shape setting since the rebuild is at taint time.
212 yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Fetched;
213 yprim.ForceBodyShapeRebuild(false /* inTaintTime */);
214 assetFound = true;
215 }
216 else
217 {
218 mismatchIDs = yprim.BaseShape.SculptTexture.ToString() + "/" + asset.ID;
219 }
220 }
221 if (!assetFound)
222 {
223 yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch;
224 }
225 physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,fetchAssetCallback,found={1},isSculpt={2},ids={3}",
226 yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs );
227 });
228 } 216 }
229 else 217 if (!assetFound)
230 { 218 {
231 xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch; 219 yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch;
232 physicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}",
233 LogHeader, physicsScene.Name);
234 } 220 }
221 physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,fetchAssetCallback,found={1},isSculpt={2},ids={3}",
222 yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs );
235 }); 223 });
224 }
225 else
226 {
227 xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch;
228 physicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}",
229 LogHeader, physicsScene.Name);
230 }
236 } 231 }
237 else 232 else
238 { 233 {
@@ -395,9 +390,7 @@ public class BSShapeMesh : BSShape
395 390
396 // Check to see if mesh was created (might require an asset). 391 // Check to see if mesh was created (might require an asset).
397 newShape = VerifyMeshCreated(physicsScene, newShape, prim); 392 newShape = VerifyMeshCreated(physicsScene, newShape, prim);
398 if (!newShape.isNativeShape 393 if (!newShape.isNativeShape || prim.AssetFailed() )
399 || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing
400 || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
401 { 394 {
402 // If a mesh was what was created, remember the built shape for later sharing. 395 // If a mesh was what was created, remember the built shape for later sharing.
403 // Also note that if meshing failed we put it in the mesh list as there is nothing else to do about the mesh. 396 // Also note that if meshing failed we put it in the mesh list as there is nothing else to do about the mesh.
@@ -584,9 +577,7 @@ public class BSShapeHull : BSShape
584 577
585 // Check to see if hull was created (might require an asset). 578 // Check to see if hull was created (might require an asset).
586 newShape = VerifyMeshCreated(physicsScene, newShape, prim); 579 newShape = VerifyMeshCreated(physicsScene, newShape, prim);
587 if (!newShape.isNativeShape 580 if (!newShape.isNativeShape || prim.AssetFailed())
588 || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing
589 || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
590 { 581 {
591 // If a mesh was what was created, remember the built shape for later sharing. 582 // If a mesh was what was created, remember the built shape for later sharing.
592 Hulls.Add(newHullKey, retHull); 583 Hulls.Add(newHullKey, retHull);
@@ -994,6 +985,11 @@ public class BSShapeCompound : BSShape
994 BSShapeNative nativeShape = new BSShapeNative(pShape); 985 BSShapeNative nativeShape = new BSShapeNative(pShape);
995 nativeShape.Dereference(physicsScene); 986 nativeShape.Dereference(physicsScene);
996 } 987 }
988 else
989 {
990 physicsScene.Logger.WarnFormat("{0} DereferenceAnonCollisionShape. Did not find shape. {1}",
991 LogHeader, pShape);
992 }
997 } 993 }
998 } 994 }
999 } 995 }
@@ -1137,9 +1133,7 @@ public class BSShapeGImpact : BSShape
1137 // Check to see if mesh was created (might require an asset). 1133 // Check to see if mesh was created (might require an asset).
1138 newShape = VerifyMeshCreated(physicsScene, newShape, prim); 1134 newShape = VerifyMeshCreated(physicsScene, newShape, prim);
1139 newShape.shapeKey = newMeshKey; 1135 newShape.shapeKey = newMeshKey;
1140 if (!newShape.isNativeShape 1136 if (!newShape.isNativeShape || prim.AssetFailed())
1141 || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing
1142 || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
1143 { 1137 {
1144 // If a mesh was what was created, remember the built shape for later sharing. 1138 // If a mesh was what was created, remember the built shape for later sharing.
1145 // Also note that if meshing failed we put it in the mesh list as there is nothing 1139 // Also note that if meshing failed we put it in the mesh list as there is nothing