diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSScene.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 55 |
1 files changed, 37 insertions, 18 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 75c0ff9..da7e300 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -157,12 +157,20 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
157 | public delegate void TaintCallback(); | 157 | public delegate void TaintCallback(); |
158 | private struct TaintCallbackEntry | 158 | private struct TaintCallbackEntry |
159 | { | 159 | { |
160 | public String originator; | ||
160 | public String ident; | 161 | public String ident; |
161 | public TaintCallback callback; | 162 | public TaintCallback callback; |
162 | public TaintCallbackEntry(string i, TaintCallback c) | 163 | public TaintCallbackEntry(string pIdent, TaintCallback pCallBack) |
163 | { | 164 | { |
164 | ident = i; | 165 | originator = BSScene.DetailLogZero; |
165 | callback = c; | 166 | ident = pIdent; |
167 | callback = pCallBack; | ||
168 | } | ||
169 | public TaintCallbackEntry(string pOrigin, string pIdent, TaintCallback pCallBack) | ||
170 | { | ||
171 | originator = pOrigin; | ||
172 | ident = pIdent; | ||
173 | callback = pCallBack; | ||
166 | } | 174 | } |
167 | } | 175 | } |
168 | private Object _taintLock = new Object(); // lock for using the next object | 176 | private Object _taintLock = new Object(); // lock for using the next object |
@@ -888,26 +896,37 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
888 | // Calls to the PhysicsActors can't directly call into the physics engine | 896 | // Calls to the PhysicsActors can't directly call into the physics engine |
889 | // because it might be busy. We delay changes to a known time. | 897 | // because it might be busy. We delay changes to a known time. |
890 | // We rely on C#'s closure to save and restore the context for the delegate. | 898 | // We rely on C#'s closure to save and restore the context for the delegate. |
891 | public void TaintedObject(String ident, TaintCallback callback) | 899 | public void TaintedObject(string pOriginator, string pIdent, TaintCallback pCallback) |
892 | { | 900 | { |
893 | if (!m_initialized) return; | 901 | TaintedObject(false /*inTaintTime*/, pOriginator, pIdent, pCallback); |
894 | 902 | } | |
895 | lock (_taintLock) | 903 | public void TaintedObject(uint pOriginator, String pIdent, TaintCallback pCallback) |
896 | { | 904 | { |
897 | _taintOperations.Add(new TaintCallbackEntry(ident, callback)); | 905 | TaintedObject(false /*inTaintTime*/, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback); |
898 | } | 906 | } |
899 | 907 | public void TaintedObject(bool inTaintTime, String pIdent, TaintCallback pCallback) | |
900 | return; | 908 | { |
909 | TaintedObject(inTaintTime, BSScene.DetailLogZero, pIdent, pCallback); | ||
910 | } | ||
911 | public void TaintedObject(bool inTaintTime, uint pOriginator, String pIdent, TaintCallback pCallback) | ||
912 | { | ||
913 | TaintedObject(inTaintTime, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback); | ||
901 | } | 914 | } |
902 | |||
903 | // Sometimes a potentially tainted operation can be used in and out of taint time. | 915 | // Sometimes a potentially tainted operation can be used in and out of taint time. |
904 | // This routine executes the command immediately if in taint-time otherwise it is queued. | 916 | // This routine executes the command immediately if in taint-time otherwise it is queued. |
905 | public void TaintedObject(bool inTaintTime, string ident, TaintCallback callback) | 917 | public void TaintedObject(bool inTaintTime, string pOriginator, string pIdent, TaintCallback pCallback) |
906 | { | 918 | { |
919 | if (!m_initialized) return; | ||
920 | |||
907 | if (inTaintTime) | 921 | if (inTaintTime) |
908 | callback(); | 922 | pCallback(); |
909 | else | 923 | else |
910 | TaintedObject(ident, callback); | 924 | { |
925 | lock (_taintLock) | ||
926 | { | ||
927 | _taintOperations.Add(new TaintCallbackEntry(pOriginator, pIdent, pCallback)); | ||
928 | } | ||
929 | } | ||
911 | } | 930 | } |
912 | 931 | ||
913 | private void TriggerPreStepEvent(float timeStep) | 932 | private void TriggerPreStepEvent(float timeStep) |
@@ -951,7 +970,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
951 | { | 970 | { |
952 | try | 971 | try |
953 | { | 972 | { |
954 | DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", DetailLogZero, tcbe.ident); // DEBUG DEBUG DEBUG | 973 | DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", tcbe.originator, tcbe.ident); // DEBUG DEBUG DEBUG |
955 | tcbe.callback(); | 974 | tcbe.callback(); |
956 | } | 975 | } |
957 | catch (Exception e) | 976 | catch (Exception e) |
@@ -1081,7 +1100,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
1081 | string xval = val; | 1100 | string xval = val; |
1082 | List<uint> xlIDs = lIDs; | 1101 | List<uint> xlIDs = lIDs; |
1083 | string xparm = parm; | 1102 | string xparm = parm; |
1084 | TaintedObject("BSScene.UpdateParameterSet", delegate() { | 1103 | TaintedObject(DetailLogZero, "BSScene.UpdateParameterSet", delegate() { |
1085 | BSParam.ParameterDefnBase thisParam; | 1104 | BSParam.ParameterDefnBase thisParam; |
1086 | if (BSParam.TryGetParameter(xparm, out thisParam)) | 1105 | if (BSParam.TryGetParameter(xparm, out thisParam)) |
1087 | { | 1106 | { |