aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs116
1 files changed, 64 insertions, 52 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index a6e20a8..b6ac23d 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -929,67 +929,79 @@ public sealed class BSShapeCollection : IDisposable
929 if (newShape.HasPhysicalShape) 929 if (newShape.HasPhysicalShape)
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 // VerifyMeshCreated is called after trying to create the mesh. If we think the asset had been
933 if (prim.BaseShape.SculptEntry 933 // fetched but we end up here again, the meshing of the asset must have failed.
934 && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Failed 934 // Prevent trying to keep fetching the mesh by declaring failure.
935 && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Waiting 935 if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched)
936 && prim.BaseShape.SculptTexture != OMV.UUID.Zero
937 )
938 { 936 {
939 DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset", prim.LocalID); 937 prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed;
940 // Multiple requestors will know we're waiting for this asset 938 PhysicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. {1}, texture={2}",
941 prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Waiting; 939 LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture);
940 }
941 else
942 {
943 // If this mesh has an underlying asset and we have not failed getting it before, fetch the asset
944 if (prim.BaseShape.SculptEntry
945 && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Failed
946 && prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Waiting
947 && prim.BaseShape.SculptTexture != OMV.UUID.Zero
948 )
949 {
950 DetailLog("{0},BSShapeCollection.VerifyMeshCreated,fetchAsset", prim.LocalID);
951 // Multiple requestors will know we're waiting for this asset
952 prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Waiting;
942 953
943 BSPhysObject xprim = prim; 954 BSPhysObject xprim = prim;
944 Util.FireAndForget(delegate 955 Util.FireAndForget(delegate
945 {
946 RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod;
947 if (assetProvider != null)
948 { 956 {
949 BSPhysObject yprim = xprim; // probably not necessary, but, just in case. 957 RequestAssetDelegate assetProvider = PhysicsScene.RequestAssetMethod;
950 assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset) 958 if (assetProvider != null)
951 { 959 {
952 bool assetFound = false; 960 BSPhysObject yprim = xprim; // probably not necessary, but, just in case.
953 string mismatchIDs = String.Empty; // DEBUG DEBUG 961 assetProvider(yprim.BaseShape.SculptTexture, delegate(AssetBase asset)
954 if (asset != null && yprim.BaseShape.SculptEntry)
955 { 962 {
956 if (yprim.BaseShape.SculptTexture.ToString() == asset.ID) 963 bool assetFound = false;
964 string mismatchIDs = String.Empty; // DEBUG DEBUG
965 if (asset != null && yprim.BaseShape.SculptEntry)
957 { 966 {
958 yprim.BaseShape.SculptData = asset.Data; 967 if (yprim.BaseShape.SculptTexture.ToString() == asset.ID)
959 // This will cause the prim to see that the filler shape is not the right 968 {
960 // one and try again to build the object. 969 yprim.BaseShape.SculptData = asset.Data;
961 // No race condition with the normal shape setting since the rebuild is at taint time. 970 // This will cause the prim to see that the filler shape is not the right
962 yprim.ForceBodyShapeRebuild(false /* inTaintTime */); 971 // one and try again to build the object.
963 assetFound = true; 972 // No race condition with the normal shape setting since the rebuild is at taint time.
973 yprim.ForceBodyShapeRebuild(false /* inTaintTime */);
974 assetFound = true;
975 }
976 else
977 {
978 mismatchIDs = yprim.BaseShape.SculptTexture.ToString() + "/" + asset.ID;
979 }
964 } 980 }
981 if (assetFound)
982 yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Fetched;
965 else 983 else
966 { 984 yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed;
967 mismatchIDs = yprim.BaseShape.SculptTexture.ToString() + "/" + asset.ID; 985 DetailLog("{0},BSShapeCollection,fetchAssetCallback,found={1},isSculpt={2},ids={3}",
968 } 986 yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs );
969 } 987
970 if (assetFound) 988 });
971 yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Fetched; 989 }
972 else 990 else
973 yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed; 991 {
974 DetailLog("{0},BSShapeCollection,fetchAssetCallback,found={1},isSculpt={2},ids={3}", 992 xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed;
975 yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs ); 993 PhysicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}",
976 994 LogHeader, PhysicsScene.Name);
977 }); 995 }
978 } 996 });
979 else 997 }
980 { 998 else
981 xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed;
982 PhysicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}",
983 LogHeader, PhysicsScene.Name);
984 }
985 });
986 }
987 else
988 {
989 if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed)
990 { 999 {
991 PhysicsScene.Logger.ErrorFormat("{0} Mesh failed to fetch asset. lID={1}, texture={2}", 1000 if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed)
992 LogHeader, prim.LocalID, prim.BaseShape.SculptTexture); 1001 {
1002 PhysicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. obj={1}, texture={2}",
1003 LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture);
1004 }
993 } 1005 }
994 } 1006 }
995 1007