From b0b4782a2b3c7a86195ad09c1c508856c2885f4d Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sat, 25 Sep 2010 22:36:38 -0400 Subject: [PATCH] adding configurable j2kDecodeCache path allowing the decoded sculpt map cache path to be defined in the configuration files. Use DecodedSculpMapPath in the [Startup] section to set the path. The default is still ./bin/j2kDecodeCache --- .../Region/Physics/Manager/PhysicsPluginManager.cs | 4 ++-- OpenSim/Region/Physics/Manager/ZeroMesher.cs | 3 ++- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 13 +++++++++---- .../Region/Physics/OdePlugin/Tests/ODETestClass.cs | 6 +++++- bin/OpenSimDefaults.ini | 6 ------ 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs index 7130a3e171..376369660f 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs @@ -81,7 +81,7 @@ namespace OpenSim.Region.Physics.Manager if (_MeshPlugins.ContainsKey(meshEngineName)) { m_log.Info("[PHYSICS]: creating meshing engine " + meshEngineName); - meshEngine = _MeshPlugins[meshEngineName].GetMesher(); + meshEngine = _MeshPlugins[meshEngineName].GetMesher(config); } else { @@ -234,6 +234,6 @@ namespace OpenSim.Region.Physics.Manager public interface IMeshingPlugin { string GetName(); - IMesher GetMesher(); + IMesher GetMesher(IConfigSource config); } } diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/Physics/Manager/ZeroMesher.cs index e6e75f964b..ba19db6c18 100644 --- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs +++ b/OpenSim/Region/Physics/Manager/ZeroMesher.cs @@ -28,6 +28,7 @@ using System; using OpenSim.Framework; using OpenMetaverse; +using Nini.Config; /* * This is the zero mesher. @@ -53,7 +54,7 @@ namespace OpenSim.Region.Physics.Manager return "ZeroMesher"; } - public IMesher GetMesher() + public IMesher GetMesher(IConfigSource config) { return new ZeroMesher(); } diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index fded95e4bb..62f947c1cc 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -35,6 +35,7 @@ using System.Drawing; using System.Drawing.Imaging; using PrimMesher; using log4net; +using Nini.Config; using System.Reflection; using System.IO; @@ -51,9 +52,9 @@ namespace OpenSim.Region.Physics.Meshing return "Meshmerizer"; } - public IMesher GetMesher() + public IMesher GetMesher(IConfigSource config) { - return new Meshmerizer(); + return new Meshmerizer(config); } } @@ -70,14 +71,18 @@ namespace OpenSim.Region.Physics.Meshing #endif private bool cacheSculptMaps = true; - private string decodedScultMapPath = "j2kDecodeCache"; + private string decodedScultMapPath = null; private float minSizeForComplexMesh = 0.2f; // prims with all dimensions smaller than this will have a bounding box mesh private Dictionary m_uniqueMeshes = new Dictionary(); - public Meshmerizer() + public Meshmerizer(IConfigSource config) { + IConfig start_config = config.Configs["Startup"]; + + decodedScultMapPath = start_config.GetString("DecodedSculpMapPath","j2kDecodeCache"); + try { if (!Directory.Exists(decodedScultMapPath)) diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs index 69e2d03482..ab8f8bf05f 100644 --- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs +++ b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs @@ -48,6 +48,10 @@ namespace OpenSim.Region.Physics.OdePlugin [SetUp] public void Initialize() { + IConfigSource TopConfig = new IniConfigSource(); + IConfig config = TopConfig.AddConfig("Startup"); + config.Set("DecodedSculpMapPath","j2kDecodeCache"); + // Loading ODEPlugin cbt = new OdePlugin(); // Loading Zero Mesher @@ -55,7 +59,7 @@ namespace OpenSim.Region.Physics.OdePlugin // Getting Physics Scene ps = cbt.GetScene("test"); // Initializing Physics Scene. - ps.Initialise(imp.GetMesher(),null); + ps.Initialise(imp.GetMesher(TopConfig),null); float[] _heightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize]; for (int i = 0; i < ((int)Constants.RegionSize * (int)Constants.RegionSize); i++) { diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 26acac7b72..4c579c9f8e 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1003,14 +1003,8 @@ ; false to allow script controlled underground positioning of ; prims ; DisableUndergroundMovement = true -<<<<<<< HEAD:bin/OpenSimDefaults.ini - ; Path to script engine assemblies - ; Default is ./bin/ScriptEngines -======= - ;; Path to script assemblies ->>>>>>> 298b4c0... Some cleanup to OpenSimDefaults.ini:OpenSim/Region/Application/OpenSimDefaults.ini ; ScriptEnginesPath = "ScriptEngines" [OpenGridProtocol]