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