From 3cb65f0d3166f976713a7c095eb37e6de05061d0 Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Tue, 11 Jun 2013 17:58:08 -0700
Subject: BulletSim: when meshing or asset fetching fails, include position and
 region with the offending object's name in the error message.

---
 OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs   | 40 ++++++++++++++--------
 .../Region/Physics/BulletSPlugin/BulletSimTODO.txt |  4 +++
 2 files changed, 30 insertions(+), 14 deletions(-)

(limited to 'OpenSim')

diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
index 202a4ce..006a9c1 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
@@ -168,10 +168,10 @@ public abstract class BSShape
         if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched)
         {
             prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing;
-            physicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. {1}, texture={2}",
-                                            LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture);
-            physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,setFailed,objNam={1},tex={2}",
-                                            prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture);
+            physicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. prim={1}, texture={2}",
+                                            LogHeader, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
+            physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,setFailed,prim={1},tex={2}",
+                                            prim.LocalID, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
         }
         else
         {
@@ -238,17 +238,17 @@ public abstract class BSShape
             {
                 if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
                 {
-                    physicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. obj={1}, texture={2}",
-                                                LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture);
-                    physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailed,objNam={1},tex={2}",
-                                                prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture);
+                    physicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. prim={1}, texture={2}",
+                                                LogHeader, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
+                    physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailed,prim={1},tex={2}",
+                                                prim.LocalID, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
                 }
                 if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing)
                 {
-                    physicsScene.Logger.WarnFormat("{0} Mesh asset would not mesh. obj={1}, texture={2}",
-                                                LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture);
-                    physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailedMeshing,objNam={1},tex={2}",
-                                                prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture);
+                    physicsScene.Logger.WarnFormat("{0} Mesh asset would not mesh. prim={1}, texture={2}",
+                                                LogHeader, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
+                    physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailedMeshing,prim={1},tex={2}",
+                                                prim.LocalID, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture);
                 }
             }
          }
@@ -260,6 +260,19 @@ public abstract class BSShape
         return fillShape.physShapeInfo;
      }
 
+    public static String UsefulPrimInfo(BSScene pScene, BSPhysObject prim)
+    {
+        StringBuilder buff = new StringBuilder(prim.PhysObjectName);
+        buff.Append("/pos=");
+        buff.Append(prim.RawPosition.ToString());
+        if (pScene != null)
+        {
+            buff.Append("/rgn=");
+            buff.Append(pScene.Name);
+        }
+        return buff.ToString();
+    }
+
     #endregion // Common shape routines
 }
 
@@ -528,8 +541,7 @@ public class BSShapeMesh : BSShape
             {
                 // Force the asset condition to 'failed' so we won't try to keep fetching and processing this mesh.
                 prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing;
-                physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}",
-                                    LogHeader, prim.PhysObjectName, prim.RawPosition, physicsScene.Name);
+                physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim={1}", LogHeader, UsefulPrimInfo(physicsScene, prim) );
                 physicsScene.DetailLog("{0},BSShapeMesh.CreatePhysicalMesh,allDegenerate,key={1}", prim.LocalID, newMeshKey);
             }
         }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
index 1e01526..4357ef1 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt
@@ -1,5 +1,9 @@
 CURRENT PROBLEMS TO FIX AND/OR LOOK AT
 =================================================
+Vehicle buoyancy. Computed correctly? Possibly creating very large effective mass.
+    Interaction of llSetBuoyancy and vehicle buoyancy. Should be additive?
+    Negative buoyancy computed correctly
+Computation of mesh mass. How done? How should it be done?
 Script changing rotation of child prim while vehicle moving (eg turning wheel) causes
 	the wheel to appear to jump back. Looks like sending position from previous update.
 Enable vehicle border crossings (at least as poorly as ODE)
-- 
cgit v1.1