diff options
author | Robert Adams | 2013-08-01 17:43:06 -0700 |
---|---|---|
committer | Robert Adams | 2013-08-02 09:47:12 -0700 |
commit | 24df15dab7befd50f7a45eb54f001e6e481f0ec4 (patch) | |
tree | f3502a9782d68848c00fe3cb9b4b2a04dfa91f61 /OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics | |
parent | BulletSim: add BSLinkInfo structure to remember link specific information (diff) | |
download | opensim-SC_OLD-24df15dab7befd50f7a45eb54f001e6e481f0ec4.zip opensim-SC_OLD-24df15dab7befd50f7a45eb54f001e6e481f0ec4.tar.gz opensim-SC_OLD-24df15dab7befd50f7a45eb54f001e6e481f0ec4.tar.bz2 opensim-SC_OLD-24df15dab7befd50f7a45eb54f001e6e481f0ec4.tar.xz |
BulletSim: add implementation of 'physSetLinksetType' and 'physGetLinksetType'
and processing routines in BulletSim.
Add linkset rebuild/conversion routine in BSLinkset.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics')
-rwxr-xr-x | OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs | 65 |
1 files changed, 60 insertions, 5 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs index 0cbc5f9..d1d318c 100755 --- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs | |||
@@ -49,10 +49,20 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | private static string LogHeader = "[EXTENDED PHYSICS]"; | 50 | private static string LogHeader = "[EXTENDED PHYSICS]"; |
51 | 51 | ||
52 | // ============================================================= | ||
52 | // Since BulletSim is a plugin, this these values aren't defined easily in one place. | 53 | // Since BulletSim is a plugin, this these values aren't defined easily in one place. |
53 | // This table must coorespond to an identical table in BSScene. | 54 | // This table must correspond to an identical table in BSScene. |
55 | |||
56 | // Per scene functions. See BSScene. | ||
57 | |||
58 | // Per avatar functions. See BSCharacter. | ||
59 | |||
60 | // Per prim functions. See BSPrim. | ||
61 | public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType"; | ||
54 | public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType"; | 62 | public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType"; |
55 | 63 | ||
64 | // ============================================================= | ||
65 | |||
56 | private IConfig Configuration { get; set; } | 66 | private IConfig Configuration { get; set; } |
57 | private bool Enabled { get; set; } | 67 | private bool Enabled { get; set; } |
58 | private Scene BaseScene { get; set; } | 68 | private Scene BaseScene { get; set; } |
@@ -123,6 +133,7 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
123 | 133 | ||
124 | // Register as LSL functions all the [ScriptInvocation] marked methods. | 134 | // Register as LSL functions all the [ScriptInvocation] marked methods. |
125 | Comms.RegisterScriptInvocations(this); | 135 | Comms.RegisterScriptInvocations(this); |
136 | Comms.RegisterConstants(this); | ||
126 | 137 | ||
127 | // When an object is modified, we might need to update its extended physics parameters | 138 | // When an object is modified, we might need to update its extended physics parameters |
128 | BaseScene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene; | 139 | BaseScene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene; |
@@ -136,7 +147,6 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
136 | 147 | ||
137 | private void EventManager_OnObjectAddedToScene(SceneObjectGroup obj) | 148 | private void EventManager_OnObjectAddedToScene(SceneObjectGroup obj) |
138 | { | 149 | { |
139 | throw new NotImplementedException(); | ||
140 | } | 150 | } |
141 | 151 | ||
142 | // Event generated when some property of a prim changes. | 152 | // Event generated when some property of a prim changes. |
@@ -168,9 +178,11 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
168 | public static int PHYS_LINKSET_TYPE_MANUAL = 2; | 178 | public static int PHYS_LINKSET_TYPE_MANUAL = 2; |
169 | 179 | ||
170 | [ScriptInvocation] | 180 | [ScriptInvocation] |
171 | public void physSetLinksetType(UUID hostID, UUID scriptID, int linksetType) | 181 | public int physSetLinksetType(UUID hostID, UUID scriptID, int linksetType) |
172 | { | 182 | { |
173 | if (!Enabled) return; | 183 | int ret = -1; |
184 | |||
185 | if (!Enabled) return ret; | ||
174 | 186 | ||
175 | // The part that is requesting the change. | 187 | // The part that is requesting the change. |
176 | SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID); | 188 | SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID); |
@@ -186,7 +198,7 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
186 | Physics.Manager.PhysicsActor rootPhysActor = rootPart.PhysActor; | 198 | Physics.Manager.PhysicsActor rootPhysActor = rootPart.PhysActor; |
187 | if (rootPhysActor != null) | 199 | if (rootPhysActor != null) |
188 | { | 200 | { |
189 | rootPhysActor.Extension(PhysFunctSetLinksetType, linksetType); | 201 | ret = (int)rootPhysActor.Extension(PhysFunctSetLinksetType, linksetType); |
190 | } | 202 | } |
191 | else | 203 | else |
192 | { | 204 | { |
@@ -204,6 +216,49 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
204 | { | 216 | { |
205 | m_log.WarnFormat("{0} physSetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); | 217 | m_log.WarnFormat("{0} physSetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); |
206 | } | 218 | } |
219 | return ret; | ||
220 | } | ||
221 | |||
222 | [ScriptInvocation] | ||
223 | public int physGetLinksetType(UUID hostID, UUID scriptID) | ||
224 | { | ||
225 | int ret = -1; | ||
226 | |||
227 | if (!Enabled) return ret; | ||
228 | |||
229 | // The part that is requesting the change. | ||
230 | SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID); | ||
231 | |||
232 | if (requestingPart != null) | ||
233 | { | ||
234 | // The type is is always on the root of a linkset. | ||
235 | SceneObjectGroup containingGroup = requestingPart.ParentGroup; | ||
236 | SceneObjectPart rootPart = containingGroup.RootPart; | ||
237 | |||
238 | if (rootPart != null) | ||
239 | { | ||
240 | Physics.Manager.PhysicsActor rootPhysActor = rootPart.PhysActor; | ||
241 | if (rootPhysActor != null) | ||
242 | { | ||
243 | ret = (int)rootPhysActor.Extension(PhysFunctGetLinksetType); | ||
244 | } | ||
245 | else | ||
246 | { | ||
247 | m_log.WarnFormat("{0} physGetLinksetType: root part does not have a physics actor. rootName={1}, hostID={2}", | ||
248 | LogHeader, rootPart.Name, hostID); | ||
249 | } | ||
250 | } | ||
251 | else | ||
252 | { | ||
253 | m_log.WarnFormat("{0} physGetLinksetType: root part does not exist. RequestingPartName={1}, hostID={2}", | ||
254 | LogHeader, requestingPart.Name, hostID); | ||
255 | } | ||
256 | } | ||
257 | else | ||
258 | { | ||
259 | m_log.WarnFormat("{0} physGetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); | ||
260 | } | ||
261 | return ret; | ||
207 | } | 262 | } |
208 | } | 263 | } |
209 | } | 264 | } |