diff options
author | Justin Clark-Casey (justincc) | 2013-02-07 23:09:47 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-02-07 23:09:47 +0000 |
commit | 9e17dc3daa04644c1a565d819a614c02022bdeed (patch) | |
tree | 014eb8cec88c68b2dedde009a508dde3b5b52aca /OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |
parent | Fix a recent regression in e17392a where JsonSetValue() stopped working (prob... (diff) | |
parent | Plumb the path from the client to the extra physics params and back (diff) | |
download | opensim-SC_OLD-9e17dc3daa04644c1a565d819a614c02022bdeed.zip opensim-SC_OLD-9e17dc3daa04644c1a565d819a614c02022bdeed.tar.gz opensim-SC_OLD-9e17dc3daa04644c1a565d819a614c02022bdeed.tar.bz2 opensim-SC_OLD-9e17dc3daa04644c1a565d819a614c02022bdeed.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 41 |
1 files changed, 33 insertions, 8 deletions
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 | |||
876 | // will use the next time since it's pinned and shared memory. | 876 | // will use the next time since it's pinned and shared memory. |
877 | // Some of the values require calling into the physics engine to get the new | 877 | // Some of the values require calling into the physics engine to get the new |
878 | // value activated ('terrainFriction' for instance). | 878 | // value activated ('terrainFriction' for instance). |
879 | public bool SetPhysicsParameter(string parm, float val, uint localID) | 879 | public bool SetPhysicsParameter(string parm, string val, uint localID) |
880 | { | 880 | { |
881 | bool ret = false; | 881 | bool ret = false; |
882 | |||
883 | float valf = 0f; | ||
884 | if (val.ToLower() == "true") | ||
885 | { | ||
886 | valf = PhysParameterEntry.NUMERIC_TRUE; | ||
887 | } | ||
888 | else | ||
889 | { | ||
890 | if (val.ToLower() == "false") | ||
891 | { | ||
892 | valf = PhysParameterEntry.NUMERIC_FALSE; | ||
893 | } | ||
894 | else | ||
895 | { | ||
896 | try | ||
897 | { | ||
898 | valf = float.Parse(val); | ||
899 | } | ||
900 | catch | ||
901 | { | ||
902 | valf = 0f; | ||
903 | } | ||
904 | } | ||
905 | } | ||
906 | |||
882 | BSParam.ParameterDefn theParam; | 907 | BSParam.ParameterDefn theParam; |
883 | if (BSParam.TryGetParameter(parm, out theParam)) | 908 | if (BSParam.TryGetParameter(parm, out theParam)) |
884 | { | 909 | { |
885 | // Set the value in the C# code | 910 | // Set the value in the C# code |
886 | theParam.setter(this, parm, localID, val); | 911 | theParam.setter(this, parm, localID, valf); |
887 | 912 | ||
888 | // Optionally set the parameter in the unmanaged code | 913 | // Optionally set the parameter in the unmanaged code |
889 | if (theParam.onObject != null) | 914 | if (theParam.onObject != null) |
@@ -898,16 +923,16 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
898 | case PhysParameterEntry.APPLY_TO_NONE: | 923 | case PhysParameterEntry.APPLY_TO_NONE: |
899 | // This will cause a call into the physical world if some operation is specified (SetOnObject). | 924 | // This will cause a call into the physical world if some operation is specified (SetOnObject). |
900 | objectIDs.Add(TERRAIN_ID); | 925 | objectIDs.Add(TERRAIN_ID); |
901 | TaintedUpdateParameter(parm, objectIDs, val); | 926 | TaintedUpdateParameter(parm, objectIDs, valf); |
902 | break; | 927 | break; |
903 | case PhysParameterEntry.APPLY_TO_ALL: | 928 | case PhysParameterEntry.APPLY_TO_ALL: |
904 | lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys); | 929 | lock (PhysObjects) objectIDs = new List<uint>(PhysObjects.Keys); |
905 | TaintedUpdateParameter(parm, objectIDs, val); | 930 | TaintedUpdateParameter(parm, objectIDs, valf); |
906 | break; | 931 | break; |
907 | default: | 932 | default: |
908 | // setting only one localID | 933 | // setting only one localID |
909 | objectIDs.Add(localID); | 934 | objectIDs.Add(localID); |
910 | TaintedUpdateParameter(parm, objectIDs, val); | 935 | TaintedUpdateParameter(parm, objectIDs, valf); |
911 | break; | 936 | break; |
912 | } | 937 | } |
913 | } | 938 | } |
@@ -942,14 +967,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
942 | 967 | ||
943 | // Get parameter. | 968 | // Get parameter. |
944 | // Return 'false' if not able to get the parameter. | 969 | // Return 'false' if not able to get the parameter. |
945 | public bool GetPhysicsParameter(string parm, out float value) | 970 | public bool GetPhysicsParameter(string parm, out string value) |
946 | { | 971 | { |
947 | float val = 0f; | 972 | string val = String.Empty; |
948 | bool ret = false; | 973 | bool ret = false; |
949 | BSParam.ParameterDefn theParam; | 974 | BSParam.ParameterDefn theParam; |
950 | if (BSParam.TryGetParameter(parm, out theParam)) | 975 | if (BSParam.TryGetParameter(parm, out theParam)) |
951 | { | 976 | { |
952 | val = theParam.getter(this); | 977 | val = theParam.getter(this).ToString(); |
953 | ret = true; | 978 | ret = true; |
954 | } | 979 | } |
955 | value = val; | 980 | value = val; |