diff --git a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs index 40f7fbc59a..3083a337ff 100755 --- a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs +++ b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs @@ -146,7 +146,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters { foreach (PhysParameterEntry ppe in physScene.GetParameterList()) { - float val = 0.0f; + string val = string.Empty; if (physScene.GetPhysicsParameter(ppe.name, out val)) { WriteOut(" {0}/{1} = {2}", scene.RegionInfo.RegionName, ppe.name, val); @@ -159,7 +159,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters } else { - float val = 0.0f; + string val = string.Empty; if (physScene.GetPhysicsParameter(parm, out val)) { WriteOut(" {0}/{1} = {2}", scene.RegionInfo.RegionName, parm, val); @@ -185,21 +185,12 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters return; } string parm = "xxx"; - float val = 0f; + string valparm = String.Empty; uint localID = (uint)PhysParameterEntry.APPLY_TO_NONE; // set default value try { parm = cmdparms[2]; - string valparm = cmdparms[3].ToLower(); - if (valparm == "true") - val = PhysParameterEntry.NUMERIC_TRUE; - else - { - if (valparm == "false") - val = PhysParameterEntry.NUMERIC_FALSE; - else - val = float.Parse(valparm, Culture.NumberFormatInfo); - } + valparm = cmdparms[3].ToLower(); if (cmdparms.Length > 4) { if (cmdparms[4].ToLower() == "all") @@ -224,7 +215,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters IPhysicsParameters physScene = scene.PhysicsScene as IPhysicsParameters; if (physScene != null) { - if (!physScene.SetPhysicsParameter(parm, val, localID)) + if (!physScene.SetPhysicsParameter(parm, valparm, localID)) { WriteError("Failed set of parameter '{0}' for region '{1}'", parm, scene.RegionInfo.RegionName); } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 965c3823b8..601c78c203 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -641,24 +641,6 @@ public static class BSParam return (b == ConfigurationParameters.numericTrue ? true : false); } - private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v) - { - BSScene physScene = pPhysScene; - physScene.TaintedObject("BSParam.ResetBroadphasePoolTainted", delegate() - { - physScene.PE.ResetBroadphasePool(physScene.World); - }); - } - - private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v) - { - BSScene physScene = pPhysScene; - physScene.TaintedObject("BSParam.ResetConstraintSolver", delegate() - { - physScene.PE.ResetConstraintSolver(physScene.World); - }); - } - // Search through the parameter definitions and return the matching // ParameterDefn structure. // Case does not matter as names are compared after converting to lower case. @@ -722,6 +704,22 @@ public static class BSParam } } + private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v) + { + BSScene physScene = pPhysScene; + physScene.TaintedObject("BSParam.ResetBroadphasePoolTainted", delegate() + { + physScene.PE.ResetBroadphasePool(physScene.World); + }); + } + private static void ResetConstraintSolverTainted(BSScene pPhysScene, float v) + { + BSScene physScene = pPhysScene; + physScene.TaintedObject("BSParam.ResetConstraintSolver", delegate() + { + physScene.PE.ResetConstraintSolver(physScene.World); + }); + } } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 6cd72f221c..f8a0c1e6ba 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -876,14 +876,39 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters // will use the next time since it's pinned and shared memory. // Some of the values require calling into the physics engine to get the new // value activated ('terrainFriction' for instance). - public bool SetPhysicsParameter(string parm, float val, uint localID) + public bool SetPhysicsParameter(string parm, string val, uint localID) { bool ret = false; + + float valf = 0f; + if (val.ToLower() == "true") + { + valf = PhysParameterEntry.NUMERIC_TRUE; + } + else + { + if (val.ToLower() == "false") + { + valf = PhysParameterEntry.NUMERIC_FALSE; + } + else + { + try + { + valf = float.Parse(val); + } + catch + { + valf = 0f; + } + } + } + BSParam.ParameterDefn theParam; if (BSParam.TryGetParameter(parm, out theParam)) { // Set the value in the C# code - theParam.setter(this, parm, localID, val); + theParam.setter(this, parm, localID, valf); // Optionally set the parameter in the unmanaged code if (theParam.onObject != null) @@ -898,16 +923,16 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters case PhysParameterEntry.APPLY_TO_NONE: // This will cause a call into the physical world if some operation is specified (SetOnObject). objectIDs.Add(TERRAIN_ID); - TaintedUpdateParameter(parm, objectIDs, val); + TaintedUpdateParameter(parm, objectIDs, valf); break; case PhysParameterEntry.APPLY_TO_ALL: lock (PhysObjects) objectIDs = new List(PhysObjects.Keys); - TaintedUpdateParameter(parm, objectIDs, val); + TaintedUpdateParameter(parm, objectIDs, valf); break; default: // setting only one localID objectIDs.Add(localID); - TaintedUpdateParameter(parm, objectIDs, val); + TaintedUpdateParameter(parm, objectIDs, valf); break; } } @@ -942,14 +967,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters // Get parameter. // Return 'false' if not able to get the parameter. - public bool GetPhysicsParameter(string parm, out float value) + public bool GetPhysicsParameter(string parm, out string value) { - float val = 0f; + string val = String.Empty; bool ret = false; BSParam.ParameterDefn theParam; if (BSParam.TryGetParameter(parm, out theParam)) { - val = theParam.getter(this); + val = theParam.getter(this).ToString(); ret = true; } value = val; diff --git a/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs b/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs index b8676bac9b..31a397c7d4 100755 --- a/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs +++ b/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs @@ -60,14 +60,14 @@ namespace OpenSim.Region.Physics.Manager // Set parameter on a specific or all instances. // Return 'false' if not able to set the parameter. - bool SetPhysicsParameter(string parm, float value, uint localID); + bool SetPhysicsParameter(string parm, string value, uint localID); // Get parameter. // Return 'false' if not able to get the parameter. - bool GetPhysicsParameter(string parm, out float value); + bool GetPhysicsParameter(string parm, out string value); // Get parameter from a particular object // TODO: - // bool GetPhysicsParameter(string parm, out float value, uint localID); + // bool GetPhysicsParameter(string parm, out string value, uint localID); } }