Change passed PhysicsParameter value from float to the more general string value
parent
a5c83f7505
commit
af73ea909c
|
@ -146,7 +146,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
|
||||||
{
|
{
|
||||||
foreach (PhysParameterEntry ppe in physScene.GetParameterList())
|
foreach (PhysParameterEntry ppe in physScene.GetParameterList())
|
||||||
{
|
{
|
||||||
float val = 0.0f;
|
string val = string.Empty;
|
||||||
if (physScene.GetPhysicsParameter(ppe.name, out val))
|
if (physScene.GetPhysicsParameter(ppe.name, out val))
|
||||||
{
|
{
|
||||||
WriteOut(" {0}/{1} = {2}", scene.RegionInfo.RegionName, ppe.name, val);
|
WriteOut(" {0}/{1} = {2}", scene.RegionInfo.RegionName, ppe.name, val);
|
||||||
|
@ -159,7 +159,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float val = 0.0f;
|
string val = string.Empty;
|
||||||
if (physScene.GetPhysicsParameter(parm, out val))
|
if (physScene.GetPhysicsParameter(parm, out val))
|
||||||
{
|
{
|
||||||
WriteOut(" {0}/{1} = {2}", scene.RegionInfo.RegionName, parm, val);
|
WriteOut(" {0}/{1} = {2}", scene.RegionInfo.RegionName, parm, val);
|
||||||
|
@ -185,21 +185,12 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string parm = "xxx";
|
string parm = "xxx";
|
||||||
float val = 0f;
|
string valparm = String.Empty;
|
||||||
uint localID = (uint)PhysParameterEntry.APPLY_TO_NONE; // set default value
|
uint localID = (uint)PhysParameterEntry.APPLY_TO_NONE; // set default value
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
parm = cmdparms[2];
|
parm = cmdparms[2];
|
||||||
string valparm = cmdparms[3].ToLower();
|
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);
|
|
||||||
}
|
|
||||||
if (cmdparms.Length > 4)
|
if (cmdparms.Length > 4)
|
||||||
{
|
{
|
||||||
if (cmdparms[4].ToLower() == "all")
|
if (cmdparms[4].ToLower() == "all")
|
||||||
|
@ -224,7 +215,7 @@ namespace OpenSim.Region.OptionalModules.PhysicsParameters
|
||||||
IPhysicsParameters physScene = scene.PhysicsScene as IPhysicsParameters;
|
IPhysicsParameters physScene = scene.PhysicsScene as IPhysicsParameters;
|
||||||
if (physScene != null)
|
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);
|
WriteError("Failed set of parameter '{0}' for region '{1}'", parm, scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -641,24 +641,6 @@ public static class BSParam
|
||||||
return (b == ConfigurationParameters.numericTrue ? true : false);
|
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
|
// Search through the parameter definitions and return the matching
|
||||||
// ParameterDefn structure.
|
// ParameterDefn structure.
|
||||||
// Case does not matter as names are compared after converting to lower case.
|
// 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);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -876,14 +876,39 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
// will use the next time since it's pinned and shared memory.
|
// 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
|
// Some of the values require calling into the physics engine to get the new
|
||||||
// value activated ('terrainFriction' for instance).
|
// 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;
|
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;
|
BSParam.ParameterDefn theParam;
|
||||||
if (BSParam.TryGetParameter(parm, out theParam))
|
if (BSParam.TryGetParameter(parm, out theParam))
|
||||||
{
|
{
|
||||||
// Set the value in the C# code
|
// 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
|
// Optionally set the parameter in the unmanaged code
|
||||||
if (theParam.onObject != null)
|
if (theParam.onObject != null)
|
||||||
|
@ -898,16 +923,16 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
case PhysParameterEntry.APPLY_TO_NONE:
|
case PhysParameterEntry.APPLY_TO_NONE:
|
||||||
// This will cause a call into the physical world if some operation is specified (SetOnObject).
|
// This will cause a call into the physical world if some operation is specified (SetOnObject).
|
||||||
objectIDs.Add(TERRAIN_ID);
|
objectIDs.Add(TERRAIN_ID);
|
||||||
TaintedUpdateParameter(parm, objectIDs, val);
|
TaintedUpdateParameter(parm, objectIDs, valf);
|
||||||
break;
|
break;
|
||||||
case PhysParameterEntry.APPLY_TO_ALL:
|
case PhysParameterEntry.APPLY_TO_ALL:
|
||||||
lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys);
|
lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys);
|
||||||
TaintedUpdateParameter(parm, objectIDs, val);
|
TaintedUpdateParameter(parm, objectIDs, valf);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// setting only one localID
|
// setting only one localID
|
||||||
objectIDs.Add(localID);
|
objectIDs.Add(localID);
|
||||||
TaintedUpdateParameter(parm, objectIDs, val);
|
TaintedUpdateParameter(parm, objectIDs, valf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -942,14 +967,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
|
|
||||||
// Get parameter.
|
// Get parameter.
|
||||||
// Return 'false' if not able to get the 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;
|
bool ret = false;
|
||||||
BSParam.ParameterDefn theParam;
|
BSParam.ParameterDefn theParam;
|
||||||
if (BSParam.TryGetParameter(parm, out theParam))
|
if (BSParam.TryGetParameter(parm, out theParam))
|
||||||
{
|
{
|
||||||
val = theParam.getter(this);
|
val = theParam.getter(this).ToString();
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
value = val;
|
value = val;
|
||||||
|
|
|
@ -60,14 +60,14 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
// Set parameter on a specific or all instances.
|
// Set parameter on a specific or all instances.
|
||||||
// Return 'false' if not able to set the parameter.
|
// 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.
|
// Get parameter.
|
||||||
// Return 'false' if not able to get the 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
|
// Get parameter from a particular object
|
||||||
// TODO:
|
// TODO:
|
||||||
// bool GetPhysicsParameter(string parm, out float value, uint localID);
|
// bool GetPhysicsParameter(string parm, out string value, uint localID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue