From af73ea909cad78eee78bd4e9d9e3a42cf8856263 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 6 Feb 2013 22:34:03 -0800 Subject: Change passed PhysicsParameter value from float to the more general string value --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 34 +++++++++--------- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 41 +++++++++++++++++----- .../Region/Physics/Manager/IPhysicsParameters.cs | 6 ++-- 3 files changed, 52 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 965c382..601c78c 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 6cd72f2..f8a0c1e 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 b8676ba..31a397c 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); } } -- cgit v1.1