aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
diff options
context:
space:
mode:
authorRobert Adams2013-03-23 11:00:52 -0700
committerRobert Adams2013-03-25 15:40:43 -0700
commit953090fd62c2f8647d0e04bc3890a04a7076dbad (patch)
treeaf514b520cd7f5f9edc7de5d4ede87e5ea7cb476 /OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
parentBulletSim: parameterize C# HACD hull creation. Add feature of reducing max hu... (diff)
downloadopensim-SC-953090fd62c2f8647d0e04bc3890a04a7076dbad.zip
opensim-SC-953090fd62c2f8647d0e04bc3890a04a7076dbad.tar.gz
opensim-SC-953090fd62c2f8647d0e04bc3890a04a7076dbad.tar.bz2
opensim-SC-953090fd62c2f8647d0e04bc3890a04a7076dbad.tar.xz
BulletSim: fix possible race condition where an prim's asset can be requested quicker than the asset fetcher returns and thus falsely reporting that an asset was not fetched and defaulting the assset to a bounding box.
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs21
1 files changed, 15 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index 457f204..a6e20a8 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -930,11 +930,15 @@ public sealed class BSShapeCollection : IDisposable
930 return newShape; 930 return newShape;
931 931
932 // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset 932 // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset
933 if (prim.BaseShape.SculptEntry && !prim.LastAssetBuildFailed && prim.BaseShape.SculptTexture != OMV.UUID.Zero) 933 if (prim.BaseShape.SculptEntry
934 && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Failed
935 && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Waiting
936 && prim.BaseShape.SculptTexture != OMV.UUID.Zero
937 )
934 { 938 {
935 DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset,lastFailed={1}", prim.LocalID, prim.LastAssetBuildFailed); 939 DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset", prim.LocalID);
936 // This will prevent looping through this code as we keep trying to get the failed shape 940 // Multiple requestors will know we're waiting for this asset
937 prim.LastAssetBuildFailed = true; 941 prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Waiting;
938 942
939 BSPhysObject xprim = prim; 943 BSPhysObject xprim = prim;
940 Util.FireAndForget(delegate 944 Util.FireAndForget(delegate
@@ -945,7 +949,7 @@ public sealed class BSShapeCollection : IDisposable
945 BSPhysObject yprim = xprim; // probably not necessary, but, just in case. 949 BSPhysObject yprim = xprim; // probably not necessary, but, just in case.
946 assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset) 950 assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset)
947 { 951 {
948 bool assetFound = false; // DEBUG DEBUG 952 bool assetFound = false;
949 string mismatchIDs = String.Empty; // DEBUG DEBUG 953 string mismatchIDs = String.Empty; // DEBUG DEBUG
950 if (asset != null && yprim.BaseShape.SculptEntry) 954 if (asset != null && yprim.BaseShape.SculptEntry)
951 { 955 {
@@ -963,6 +967,10 @@ public sealed class BSShapeCollection : IDisposable
963 mismatchIDs = yprim.BaseShape.SculptTexture.ToString() + "/" + asset.ID; 967 mismatchIDs = yprim.BaseShape.SculptTexture.ToString() + "/" + asset.ID;
964 } 968 }
965 } 969 }
970 if (assetFound)
971 yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Fetched;
972 else
973 yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed;
966 DetailLog("{0},BSShapeCollection,fetchAssetCallback,found={1},isSculpt={2},ids={3}", 974 DetailLog("{0},BSShapeCollection,fetchAssetCallback,found={1},isSculpt={2},ids={3}",
967 yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs ); 975 yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs );
968 976
@@ -970,6 +978,7 @@ public sealed class BSShapeCollection : IDisposable
970 } 978 }
971 else 979 else
972 { 980 {
981 xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed;
973 PhysicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}", 982 PhysicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}",
974 LogHeader, PhysicsScene.Name); 983 LogHeader, PhysicsScene.Name);
975 } 984 }
@@ -977,7 +986,7 @@ public sealed class BSShapeCollection : IDisposable
977 } 986 }
978 else 987 else
979 { 988 {
980 if (prim.LastAssetBuildFailed) 989 if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed)
981 { 990 {
982 PhysicsScene.Logger.ErrorFormat("{0} Mesh failed to fetch asset. lID={1}, texture={2}", 991 PhysicsScene.Logger.ErrorFormat("{0} Mesh failed to fetch asset. lID={1}, texture={2}",
983 LogHeader, prim.LocalID, prim.BaseShape.SculptTexture); 992 LogHeader, prim.LocalID, prim.BaseShape.SculptTexture);