diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs | 94 |
1 files changed, 82 insertions, 12 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs index 7179a6d..126b146 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs | |||
@@ -30,6 +30,7 @@ using System.Linq; | |||
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Region.OptionalModules.Scripting; | ||
33 | 34 | ||
34 | using OMV = OpenMetaverse; | 35 | using OMV = OpenMetaverse; |
35 | 36 | ||
@@ -41,6 +42,8 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
41 | // operations necessary for keeping the linkset created and, additionally, this | 42 | // operations necessary for keeping the linkset created and, additionally, this |
42 | // calls the linkset implementation for its creation and management. | 43 | // calls the linkset implementation for its creation and management. |
43 | 44 | ||
45 | private static readonly string LogHeader = "[BULLETS PRIMLINKABLE]"; | ||
46 | |||
44 | // This adds the overrides for link() and delink() so the prim is linkable. | 47 | // This adds the overrides for link() and delink() so the prim is linkable. |
45 | 48 | ||
46 | public BSLinkset Linkset { get; set; } | 49 | public BSLinkset Linkset { get; set; } |
@@ -58,15 +61,12 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
58 | 61 | ||
59 | Linkset = BSLinkset.Factory(PhysScene, this); | 62 | Linkset = BSLinkset.Factory(PhysScene, this); |
60 | 63 | ||
61 | PhysScene.TaintedObject("BSPrimLinksetCompound.Refresh", delegate() | 64 | Linkset.Refresh(this); |
62 | { | ||
63 | Linkset.Refresh(this); | ||
64 | }); | ||
65 | } | 65 | } |
66 | 66 | ||
67 | public override void Destroy() | 67 | public override void Destroy() |
68 | { | 68 | { |
69 | Linkset = Linkset.RemoveMeFromLinkset(this); | 69 | Linkset = Linkset.RemoveMeFromLinkset(this, false /* inTaintTime */); |
70 | base.Destroy(); | 70 | base.Destroy(); |
71 | } | 71 | } |
72 | 72 | ||
@@ -80,7 +80,7 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
80 | 80 | ||
81 | Linkset = parent.Linkset.AddMeToLinkset(this); | 81 | Linkset = parent.Linkset.AddMeToLinkset(this); |
82 | 82 | ||
83 | DetailLog("{0},BSPrimLinkset.link,call,parentBefore={1}, childrenBefore=={2}, parentAfter={3}, childrenAfter={4}", | 83 | DetailLog("{0},BSPrimLinkable.link,call,parentBefore={1}, childrenBefore=={2}, parentAfter={3}, childrenAfter={4}", |
84 | LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren); | 84 | LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren); |
85 | } | 85 | } |
86 | return; | 86 | return; |
@@ -94,9 +94,9 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
94 | BSPhysObject parentBefore = Linkset.LinksetRoot; // DEBUG | 94 | BSPhysObject parentBefore = Linkset.LinksetRoot; // DEBUG |
95 | int childrenBefore = Linkset.NumberOfChildren; // DEBUG | 95 | int childrenBefore = Linkset.NumberOfChildren; // DEBUG |
96 | 96 | ||
97 | Linkset = Linkset.RemoveMeFromLinkset(this); | 97 | Linkset = Linkset.RemoveMeFromLinkset(this, false /* inTaintTime*/); |
98 | 98 | ||
99 | DetailLog("{0},BSPrimLinkset.delink,parentBefore={1},childrenBefore={2},parentAfter={3},childrenAfter={4}, ", | 99 | DetailLog("{0},BSPrimLinkable.delink,parentBefore={1},childrenBefore={2},parentAfter={3},childrenAfter={4}, ", |
100 | LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren); | 100 | LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren); |
101 | return; | 101 | return; |
102 | } | 102 | } |
@@ -108,7 +108,7 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
108 | set | 108 | set |
109 | { | 109 | { |
110 | base.Position = value; | 110 | base.Position = value; |
111 | PhysScene.TaintedObject("BSPrimLinkset.setPosition", delegate() | 111 | PhysScene.TaintedObject(LocalID, "BSPrimLinkable.setPosition", delegate() |
112 | { | 112 | { |
113 | Linkset.UpdateProperties(UpdatedProperties.Position, this); | 113 | Linkset.UpdateProperties(UpdatedProperties.Position, this); |
114 | }); | 114 | }); |
@@ -122,7 +122,7 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
122 | set | 122 | set |
123 | { | 123 | { |
124 | base.Orientation = value; | 124 | base.Orientation = value; |
125 | PhysScene.TaintedObject("BSPrimLinkset.setOrientation", delegate() | 125 | PhysScene.TaintedObject(LocalID, "BSPrimLinkable.setOrientation", delegate() |
126 | { | 126 | { |
127 | Linkset.UpdateProperties(UpdatedProperties.Orientation, this); | 127 | Linkset.UpdateProperties(UpdatedProperties.Orientation, this); |
128 | }); | 128 | }); |
@@ -180,7 +180,7 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
180 | // Do any filtering/modification needed for linksets. | 180 | // Do any filtering/modification needed for linksets. |
181 | public override void UpdateProperties(EntityProperties entprop) | 181 | public override void UpdateProperties(EntityProperties entprop) |
182 | { | 182 | { |
183 | if (Linkset.IsRoot(this)) | 183 | if (Linkset.IsRoot(this) || Linkset.ShouldReportPropertyUpdates(this)) |
184 | { | 184 | { |
185 | // Properties are only updated for the roots of a linkset. | 185 | // Properties are only updated for the roots of a linkset. |
186 | // TODO: this will have to change when linksets are articulated. | 186 | // TODO: this will have to change when linksets are articulated. |
@@ -240,6 +240,8 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
240 | bool ret = false; | 240 | bool ret = false; |
241 | if (LinksetType != newType) | 241 | if (LinksetType != newType) |
242 | { | 242 | { |
243 | DetailLog("{0},BSPrimLinkable.ConvertLinkset,oldT={1},newT={2}", LocalID, LinksetType, newType); | ||
244 | |||
243 | // Set the implementation type first so the call to BSLinkset.Factory gets the new type. | 245 | // Set the implementation type first so the call to BSLinkset.Factory gets the new type. |
244 | this.LinksetType = newType; | 246 | this.LinksetType = newType; |
245 | 247 | ||
@@ -263,7 +265,10 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
263 | // Remove the children from the old linkset and add to the new (will be a new instance from the factory) | 265 | // Remove the children from the old linkset and add to the new (will be a new instance from the factory) |
264 | foreach (BSPrimLinkable child in children) | 266 | foreach (BSPrimLinkable child in children) |
265 | { | 267 | { |
266 | oldLinkset.RemoveMeFromLinkset(child); | 268 | oldLinkset.RemoveMeFromLinkset(child, true /*inTaintTime*/); |
269 | } | ||
270 | foreach (BSPrimLinkable child in children) | ||
271 | { | ||
267 | newLinkset.AddMeToLinkset(child); | 272 | newLinkset.AddMeToLinkset(child); |
268 | child.Linkset = newLinkset; | 273 | child.Linkset = newLinkset; |
269 | } | 274 | } |
@@ -274,5 +279,70 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
274 | } | 279 | } |
275 | return ret; | 280 | return ret; |
276 | } | 281 | } |
282 | |||
283 | #region Extension | ||
284 | public override object Extension(string pFunct, params object[] pParams) | ||
285 | { | ||
286 | DetailLog("{0} BSPrimLinkable.Extension,op={1},nParam={2}", LocalID, pFunct, pParams.Length); | ||
287 | object ret = null; | ||
288 | switch (pFunct) | ||
289 | { | ||
290 | // physGetLinksetType(); | ||
291 | // pParams = [ BSPhysObject root, null ] | ||
292 | case ExtendedPhysics.PhysFunctGetLinksetType: | ||
293 | { | ||
294 | ret = (object)LinksetType; | ||
295 | DetailLog("{0},BSPrimLinkable.Extension.physGetLinksetType,type={1}", LocalID, ret); | ||
296 | break; | ||
297 | } | ||
298 | // physSetLinksetType(type); | ||
299 | // pParams = [ BSPhysObject root, null, integer type ] | ||
300 | case ExtendedPhysics.PhysFunctSetLinksetType: | ||
301 | { | ||
302 | if (pParams.Length > 2) | ||
303 | { | ||
304 | BSLinkset.LinksetImplementation linksetType = (BSLinkset.LinksetImplementation)pParams[2]; | ||
305 | if (Linkset.IsRoot(this)) | ||
306 | { | ||
307 | PhysScene.TaintedObject(LocalID, "BSPrim.PhysFunctSetLinksetType", delegate() | ||
308 | { | ||
309 | // Cause the linkset type to change | ||
310 | DetailLog("{0},BSPrimLinkable.Extension.physSetLinksetType, oldType={1},newType={2}", | ||
311 | LocalID, Linkset.LinksetImpl, linksetType); | ||
312 | ConvertLinkset(linksetType); | ||
313 | }); | ||
314 | } | ||
315 | ret = (object)(int)linksetType; | ||
316 | } | ||
317 | break; | ||
318 | } | ||
319 | // physChangeLinkType(linknum, typeCode); | ||
320 | // pParams = [ BSPhysObject root, BSPhysObject child, integer linkType ] | ||
321 | case ExtendedPhysics.PhysFunctChangeLinkType: | ||
322 | { | ||
323 | ret = Linkset.Extension(pFunct, pParams); | ||
324 | break; | ||
325 | } | ||
326 | // physGetLinkType(linknum); | ||
327 | // pParams = [ BSPhysObject root, BSPhysObject child ] | ||
328 | case ExtendedPhysics.PhysFunctGetLinkType: | ||
329 | { | ||
330 | ret = Linkset.Extension(pFunct, pParams); | ||
331 | break; | ||
332 | } | ||
333 | // physChangeLinkParams(linknum, [code, value, code, value, ...]); | ||
334 | // pParams = [ BSPhysObject root, BSPhysObject child, object[] [ string op, object opParam, string op, object opParam, ... ] ] | ||
335 | case ExtendedPhysics.PhysFunctChangeLinkParams: | ||
336 | { | ||
337 | ret = Linkset.Extension(pFunct, pParams); | ||
338 | break; | ||
339 | } | ||
340 | default: | ||
341 | ret = base.Extension(pFunct, pParams); | ||
342 | break; | ||
343 | } | ||
344 | return ret; | ||
345 | } | ||
346 | #endregion // Extension | ||
277 | } | 347 | } |
278 | } | 348 | } |