diff options
author | Robert Adams | 2014-07-26 16:03:43 -0700 |
---|---|---|
committer | Justin Clark-Casey | 2014-08-02 00:58:27 +0100 |
commit | eedefdc5ff17f52c106d6832bc0cd8c596aefe62 (patch) | |
tree | af3ef82909396f34b75485f2c67e9e3d069b0758 /OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | |
parent | Add inventory.<url>.RequestsMade stat. (diff) | |
download | opensim-SC_OLD-eedefdc5ff17f52c106d6832bc0cd8c596aefe62.zip opensim-SC_OLD-eedefdc5ff17f52c106d6832bc0cd8c596aefe62.tar.gz opensim-SC_OLD-eedefdc5ff17f52c106d6832bc0cd8c596aefe62.tar.bz2 opensim-SC_OLD-eedefdc5ff17f52c106d6832bc0cd8c596aefe62.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-x | OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | 90 |
1 files changed, 42 insertions, 48 deletions
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 |