From 8f55b9d735fbc975ce7a4b54e972c17ffbfb1f49 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Sun, 22 Feb 2009 20:52:55 +0000 Subject: Mantis#3218. Thank you kindly, TLaukkan (Tommil) for a patch that: * Added log4net dependency to physxplugin in prebuild.xml. * Added missing m_log fields to classes. * Replaced Console.WriteLine with appropriate m_log.Xxxx * Tested that nant test target runs succesfully. * Tested that local opensim sandbox starts up without errors. --- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 21 ++++++++++++--------- OpenSim/Region/Physics/Meshing/PrimMesher.cs | 11 +++++++---- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 2 +- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 4 ++-- OpenSim/Region/Physics/OdePlugin/ODETestClass.cs | 12 ++++++++---- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 8 ++++---- OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | 10 +++++++--- 7 files changed, 41 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 72575e5..72dc70f 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -35,6 +35,8 @@ using OpenMetaverse.Imaging; using System.Drawing; using System.Drawing.Imaging; using PrimMesher; +using log4net; +using System.Reflection; namespace OpenSim.Region.Physics.Meshing { @@ -57,6 +59,7 @@ namespace OpenSim.Region.Physics.Meshing public class Meshmerizer : IMesher { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Setting baseDir to a path will enable the dumping of raw files @@ -155,9 +158,9 @@ namespace OpenSim.Region.Physics.Meshing private void ReportPrimError(string message, string primName, PrimMesh primMesh) { - Console.WriteLine(message); - Console.WriteLine("\nPrim Name: " + primName); - Console.WriteLine("****** PrimMesh Parameters ******\n" + primMesh.ParamsToDisplayString()); + m_log.Error(message); + m_log.Error("\nPrim Name: " + primName); + m_log.Error("****** PrimMesh Parameters ******\n" + primMesh.ParamsToDisplayString()); } @@ -185,17 +188,17 @@ namespace OpenSim.Region.Physics.Meshing } catch (DllNotFoundException) { - System.Console.WriteLine("[PHYSICS]: OpenJpeg is not installed correctly on this system. Physics Proxy generation failed. Often times this is because of an old version of GLIBC. You must have version 2.4 or above!"); + m_log.Error("[PHYSICS]: OpenJpeg is not installed correctly on this system. Physics Proxy generation failed. Often times this is because of an old version of GLIBC. You must have version 2.4 or above!"); return null; } catch (IndexOutOfRangeException) { - System.Console.WriteLine("[PHYSICS]: OpenJpeg was unable to decode this. Physics Proxy generation failed"); + m_log.Error("[PHYSICS]: OpenJpeg was unable to decode this. Physics Proxy generation failed"); return null; } catch (Exception) { - System.Console.WriteLine("[PHYSICS]: Unable to generate a Sculpty physics proxy. Sculpty texture decode failed!"); + m_log.Error("[PHYSICS]: Unable to generate a Sculpty physics proxy. Sculpty texture decode failed!"); return null; } @@ -285,7 +288,7 @@ namespace OpenSim.Region.Physics.Meshing if (profileEnd > 1.0f) profileEnd = 1.0f; } #if SPAM - Console.WriteLine("****** PrimMesh Parameters (Linear) ******\n" + primMesh.ParamsToDisplayString()); + m_log.Debug("****** PrimMesh Parameters (Linear) ******\n" + primMesh.ParamsToDisplayString()); #endif try { @@ -316,7 +319,7 @@ namespace OpenSim.Region.Physics.Meshing if (profileEnd > 1.0f) profileEnd = 1.0f; } #if SPAM - Console.WriteLine("****** PrimMesh Parameters (Circular) ******\n" + primMesh.ParamsToDisplayString()); + m_log.Debug("****** PrimMesh Parameters (Circular) ******\n" + primMesh.ParamsToDisplayString()); #endif try { @@ -378,7 +381,7 @@ namespace OpenSim.Region.Physics.Meshing if ((!isPhysical) && size.X < minSizeForComplexMesh && size.Y < minSizeForComplexMesh && size.Z < minSizeForComplexMesh) { #if SPAM - Console.WriteLine("Meshmerizer: prim " + primName + " has a size of " + size.ToString() + " which is below threshold of " + + m_log.Debug("Meshmerizer: prim " + primName + " has a size of " + size.ToString() + " which is below threshold of " + minSizeForComplexMesh.ToString() + " - creating simple bounding box" ); #endif diff --git a/OpenSim/Region/Physics/Meshing/PrimMesher.cs b/OpenSim/Region/Physics/Meshing/PrimMesher.cs index c28577d..86c9c08 100644 --- a/OpenSim/Region/Physics/Meshing/PrimMesher.cs +++ b/OpenSim/Region/Physics/Meshing/PrimMesher.cs @@ -29,6 +29,8 @@ using System; using System.Collections.Generic; using System.Text; using System.IO; +using log4net; +using System.Reflection; namespace PrimMesher { @@ -576,6 +578,7 @@ namespace PrimMesher /// internal class Profile { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private const float twoPi = 2.0f * (float)Math.PI; internal List coords; @@ -643,8 +646,8 @@ namespace PrimMesher try { angles.makeAngles(sides, startAngle, stopAngle); } catch (Exception ex) { - Console.WriteLine("makeAngles failed: Exception: " + ex.ToString()); - Console.WriteLine("sides: " + sides.ToString() + " startAngle: " + startAngle.ToString() + " stopAngle: " + stopAngle.ToString()); + m_log.Error("makeAngles failed: Exception: " + ex.ToString()); + m_log.Error("sides: " + sides.ToString() + " startAngle: " + startAngle.ToString() + " stopAngle: " + stopAngle.ToString()); return; } @@ -663,8 +666,8 @@ namespace PrimMesher try { hollowAngles.makeAngles(hollowSides, startAngle, stopAngle); } catch (Exception ex) { - Console.WriteLine("makeAngles failed: Exception: " + ex.ToString()); - Console.WriteLine("sides: " + sides.ToString() + " startAngle: " + startAngle.ToString() + " stopAngle: " + stopAngle.ToString()); + m_log.Error("makeAngles failed: Exception: " + ex.ToString()); + m_log.Error("sides: " + sides.ToString() + " startAngle: " + startAngle.ToString() + " stopAngle: " + stopAngle.ToString()); return; } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 16e0efe..9991ab1 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -669,7 +669,7 @@ namespace OpenSim.Region.Physics.OdePlugin m_pidControllerActive = false; force *= 100f; doForce(force); - //System.Console.WriteLine("Push!"); + //m_log.Debug("Push!"); //_target_velocity.X += force.X; // _target_velocity.Y += force.Y; //_target_velocity.Z += force.Z; diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index bfb9b1a..6d07b92 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -2507,7 +2507,7 @@ namespace OpenSim.Region.Physics.OdePlugin } else { - //System.Console.WriteLine(Math.Abs(m_lastposition.X - l_position.X).ToString()); + //m_log.Debug(Math.Abs(m_lastposition.X - l_position.X).ToString()); _zeroFlag = false; } @@ -2569,7 +2569,7 @@ namespace OpenSim.Region.Physics.OdePlugin m_rotationalVelocity.setValues(rotvel.X, rotvel.Y, rotvel.Z); } - //System.Console.WriteLine("ODE: " + m_rotationalVelocity.ToString()); + //m_log.Debug("ODE: " + m_rotationalVelocity.ToString()); _orientation.X = ori.X; _orientation.Y = ori.Y; _orientation.Z = ori.Z; diff --git a/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs index c913639..6ee23db 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs @@ -31,12 +31,16 @@ using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Physics.Manager; +using log4net; +using System.Reflection; namespace OpenSim.Region.Physics.OdePlugin { [TestFixture] public class ODETestClass { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private OdePlugin cbt; private PhysicsScene ps; private IMeshingPlugin imp; @@ -92,18 +96,18 @@ namespace OpenSim.Region.Physics.OdePlugin Assert.That(oprim.m_targetSpace != (IntPtr)0); //Assert.That(oprim.m_targetSpace == pscene.space); - Console.WriteLine("TargetSpace: " + oprim.m_targetSpace + " - SceneMainSpace: " + pscene.space); + m_log.Info("TargetSpace: " + oprim.m_targetSpace + " - SceneMainSpace: " + pscene.space); Assert.That(!oprim.m_taintadd); - Console.WriteLine("Prim Position (" + oprim.m_localID + "): " + prim.Position.ToString()); + m_log.Info("Prim Position (" + oprim.m_localID + "): " + prim.Position.ToString()); // Make sure we're above the ground //Assert.That(prim.Position.Z > 20f); - //Console.WriteLine("PrimCollisionScore (" + oprim.m_localID + "): " + oprim.m_collisionscore); + //m_log.Info("PrimCollisionScore (" + oprim.m_localID + "): " + oprim.m_collisionscore); // Make sure we've got a Body Assert.That(oprim.Body != (IntPtr)0); - //Console.WriteLine( + //m_log.Info( } // Make sure we're not somewhere above the ground diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index f30de4d..359e7b3 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -579,7 +579,7 @@ namespace OpenSim.Region.Physics.OdePlugin //if (id == d.GeomClassId.TriMeshClass) //{ // m_log.InfoFormat("near: A collision was detected between {1} and {2}", 0, name1, name2); - //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2); + //m_log.Debug("near: A collision was detected between {1} and {2}", 0, name1, name2); //} // Figure out how many contact points we have @@ -945,8 +945,8 @@ namespace OpenSim.Region.Physics.OdePlugin // so lets throttle them and send them again after it's somewhat sorted out. p2.ThrottleUpdates = true; } - //System.Console.WriteLine(count.ToString()); - //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2); + //m_log.Debug(count.ToString()); + //m_log.Debug("near: A collision was detected between {1} and {2}", 0, name1, name2); } } @@ -2095,7 +2095,7 @@ namespace OpenSim.Region.Physics.OdePlugin // convenient place to do it for now... // //if (pbs.PathCurve == (byte)Primitive.PathCurve.Circle && pbs.ProfileCurve == (byte)Primitive.ProfileCurve.Circle && pbs.PathScaleY <= 0.75f) - // //Console.WriteLine("needsMeshing: " + " pathCurve: " + pbs.PathCurve.ToString() + " profileCurve: " + pbs.ProfileCurve.ToString() + " pathScaleY: " + Primitive.UnpackPathScale(pbs.PathScaleY).ToString()); + // //m_log.Debug("needsMeshing: " + " pathCurve: " + pbs.PathCurve.ToString() + " profileCurve: " + pbs.ProfileCurve.ToString() + " pathScaleY: " + Primitive.UnpackPathScale(pbs.PathScaleY).ToString()); int iPropertiesNotSupportedDefault = 0; if (pbs.SculptEntry && !meshSculptedPrim) diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index 18935fb..5579848 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs @@ -32,6 +32,8 @@ using OpenSim.Framework; using OpenSim.Region.Physics.Manager; using PhysXWrapper; using Quaternion=OpenMetaverse.Quaternion; +using System.Reflection; +using log4net; namespace OpenSim.Region.Physics.PhysXPlugin { @@ -40,6 +42,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin /// public class PhysXPlugin : IPhysicsPlugin { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private PhysXScene _mScene; public PhysXPlugin() @@ -72,6 +75,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin public class PhysXScene : PhysicsScene { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private List _characters = new List(); private List _prims = new List(); private float[] _heightMap = null; @@ -84,7 +88,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin //sceneIdentifier = _sceneIdentifier; mySdk = NxPhysicsSDK.CreateSDK(); - Console.WriteLine("Sdk created - now creating scene"); + m_log.Info("Sdk created - now creating scene"); scene = mySdk.CreateScene(); } @@ -174,7 +178,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin } catch (Exception e) { - Console.WriteLine(e.Message); + m_log.Error(e.Message); } return fps; } @@ -193,7 +197,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin { if (_heightMap != null) { - Console.WriteLine("PhysX - deleting old terrain"); + m_log.Debug("PhysX - deleting old terrain"); scene.DeleteTerrain(); } _heightMap = heightMap; -- cgit v1.1