aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rwxr-xr-xOpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs82
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs29
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs4
3 files changed, 105 insertions, 10 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
index 4455df4..decb61a 100755
--- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
@@ -61,6 +61,10 @@ public class ExtendedPhysics : INonSharedRegionModule
61 // Per prim functions. See BSPrim. 61 // Per prim functions. See BSPrim.
62 public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType"; 62 public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType";
63 public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType"; 63 public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType";
64 public const string PhysFunctChangeLinkFixed = "BulletSim.ChangeLinkFixed";
65 public const string PhysFunctChangeLinkHinge = "BulletSim.ChangeLinkHinge";
66 public const string PhysFunctChangeLinkSpring = "BulletSim.ChangeLinkSpring";
67 public const string PhysFunctChangeLinkSlider = "BulletSim.ChangeLinkSlider";
64 68
65 // ============================================================= 69 // =============================================================
66 70
@@ -250,7 +254,6 @@ public class ExtendedPhysics : INonSharedRegionModule
250 public int physGetLinksetType(UUID hostID, UUID scriptID) 254 public int physGetLinksetType(UUID hostID, UUID scriptID)
251 { 255 {
252 int ret = -1; 256 int ret = -1;
253
254 if (!Enabled) return ret; 257 if (!Enabled) return ret;
255 258
256 // The part that is requesting the change. 259 // The part that is requesting the change.
@@ -287,5 +290,82 @@ public class ExtendedPhysics : INonSharedRegionModule
287 } 290 }
288 return ret; 291 return ret;
289 } 292 }
293
294 [ScriptInvocation]
295 public int physChangeLinkFixed(UUID hostID, UUID scriptID, int linkNum)
296 {
297 int ret = -1;
298 if (!Enabled) return ret;
299
300 // The part that is requesting the change.
301 SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID);
302
303 if (requestingPart != null)
304 {
305 // The type is is always on the root of a linkset.
306 SceneObjectGroup containingGroup = requestingPart.ParentGroup;
307 SceneObjectPart rootPart = containingGroup.RootPart;
308
309 if (rootPart != null)
310 {
311 Physics.Manager.PhysicsActor rootPhysActor = rootPart.PhysActor;
312 if (rootPhysActor != null)
313 {
314 SceneObjectPart linkPart = containingGroup.GetLinkNumPart(linkNum);
315 if (linkPart != null)
316 {
317 Physics.Manager.PhysicsActor linkPhysActor = linkPart.PhysActor;
318 if (linkPhysActor != null)
319 {
320 ret = (int)rootPhysActor.Extension(PhysFunctChangeLinkFixed, linkNum, linkPhysActor);
321 }
322 else
323 {
324 m_log.WarnFormat("{0} physChangeLinkFixed: Link part has no physical actor. rootName={1}, hostID={2}, linknum={3}",
325 LogHeader, rootPart.Name, hostID, linkNum);
326 }
327 }
328 else
329 {
330 m_log.WarnFormat("{0} physChangeLinkFixed: Could not find linknum part. rootName={1}, hostID={2}, linknum={3}",
331 LogHeader, rootPart.Name, hostID, linkNum);
332 }
333 }
334 else
335 {
336 m_log.WarnFormat("{0} physChangeLinkFixed: Root part does not have a physics actor. rootName={1}, hostID={2}",
337 LogHeader, rootPart.Name, hostID);
338 }
339 }
340 else
341 {
342 m_log.WarnFormat("{0} physChangeLinkFixed: Root part does not exist. RequestingPartName={1}, hostID={2}",
343 LogHeader, requestingPart.Name, hostID);
344 }
345 }
346 else
347 {
348 m_log.WarnFormat("{0} physGetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID);
349 }
350 return ret;
351 }
352
353 [ScriptInvocation]
354 public int physChangeLinkHinge(UUID hostID, UUID scriptID, int linkNum)
355 {
356 return 0;
357 }
358
359 [ScriptInvocation]
360 public int physChangeLinkSpring(UUID hostID, UUID scriptID, int linkNum)
361 {
362 return 0;
363 }
364
365 [ScriptInvocation]
366 public int physChangeLinkSlider(UUID hostID, UUID scriptID, int linkNum)
367 {
368 return 0;
369 }
290} 370}
291} 371}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
index fc639ad..77d8246 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
@@ -60,10 +60,7 @@ public class BSPrimLinkable : BSPrimDisplaced
60 60
61 Linkset = BSLinkset.Factory(PhysScene, this); 61 Linkset = BSLinkset.Factory(PhysScene, this);
62 62
63 PhysScene.TaintedObject("BSPrimLinksetCompound.Refresh", delegate() 63 Linkset.Refresh(this);
64 {
65 Linkset.Refresh(this);
66 });
67 } 64 }
68 65
69 public override void Destroy() 66 public override void Destroy()
@@ -82,7 +79,7 @@ public class BSPrimLinkable : BSPrimDisplaced
82 79
83 Linkset = parent.Linkset.AddMeToLinkset(this); 80 Linkset = parent.Linkset.AddMeToLinkset(this);
84 81
85 DetailLog("{0},BSPrimLinkset.link,call,parentBefore={1}, childrenBefore=={2}, parentAfter={3}, childrenAfter={4}", 82 DetailLog("{0},BSPrimLinkable.link,call,parentBefore={1}, childrenBefore=={2}, parentAfter={3}, childrenAfter={4}",
86 LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren); 83 LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren);
87 } 84 }
88 return; 85 return;
@@ -98,7 +95,7 @@ public class BSPrimLinkable : BSPrimDisplaced
98 95
99 Linkset = Linkset.RemoveMeFromLinkset(this, false /* inTaintTime*/); 96 Linkset = Linkset.RemoveMeFromLinkset(this, false /* inTaintTime*/);
100 97
101 DetailLog("{0},BSPrimLinkset.delink,parentBefore={1},childrenBefore={2},parentAfter={3},childrenAfter={4}, ", 98 DetailLog("{0},BSPrimLinkable.delink,parentBefore={1},childrenBefore={2},parentAfter={3},childrenAfter={4}, ",
102 LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren); 99 LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren);
103 return; 100 return;
104 } 101 }
@@ -110,7 +107,7 @@ public class BSPrimLinkable : BSPrimDisplaced
110 set 107 set
111 { 108 {
112 base.Position = value; 109 base.Position = value;
113 PhysScene.TaintedObject("BSPrimLinkset.setPosition", delegate() 110 PhysScene.TaintedObject("BSPrimLinkable.setPosition", delegate()
114 { 111 {
115 Linkset.UpdateProperties(UpdatedProperties.Position, this); 112 Linkset.UpdateProperties(UpdatedProperties.Position, this);
116 }); 113 });
@@ -124,7 +121,7 @@ public class BSPrimLinkable : BSPrimDisplaced
124 set 121 set
125 { 122 {
126 base.Orientation = value; 123 base.Orientation = value;
127 PhysScene.TaintedObject("BSPrimLinkset.setOrientation", delegate() 124 PhysScene.TaintedObject("BSPrimLinkable.setOrientation", delegate()
128 { 125 {
129 Linkset.UpdateProperties(UpdatedProperties.Orientation, this); 126 Linkset.UpdateProperties(UpdatedProperties.Orientation, this);
130 }); 127 });
@@ -242,7 +239,7 @@ public class BSPrimLinkable : BSPrimDisplaced
242 bool ret = false; 239 bool ret = false;
243 if (LinksetType != newType) 240 if (LinksetType != newType)
244 { 241 {
245 DetailLog("{0},BSPrimLinkset.ConvertLinkset,oldT={1},newT={2}", LocalID, LinksetType, newType); 242 DetailLog("{0},BSPrimLinkable.ConvertLinkset,oldT={1},newT={2}", LocalID, LinksetType, newType);
246 243
247 // Set the implementation type first so the call to BSLinkset.Factory gets the new type. 244 // Set the implementation type first so the call to BSLinkset.Factory gets the new type.
248 this.LinksetType = newType; 245 this.LinksetType = newType;
@@ -288,12 +285,14 @@ public class BSPrimLinkable : BSPrimDisplaced
288 object ret = null; 285 object ret = null;
289 switch (pFunct) 286 switch (pFunct)
290 { 287 {
288 // physGetLinksetType();
291 case BSScene.PhysFunctGetLinksetType: 289 case BSScene.PhysFunctGetLinksetType:
292 { 290 {
293 ret = (object)LinksetType; 291 ret = (object)LinksetType;
294 m_log.DebugFormat("{0} Extension.physGetLinksetType, type={1}", LogHeader, ret); 292 m_log.DebugFormat("{0} Extension.physGetLinksetType, type={1}", LogHeader, ret);
295 break; 293 break;
296 } 294 }
295 // physSetLinksetType(type);
297 case BSScene.PhysFunctSetLinksetType: 296 case BSScene.PhysFunctSetLinksetType:
298 { 297 {
299 if (pParams.Length > 0) 298 if (pParams.Length > 0)
@@ -313,6 +312,18 @@ public class BSPrimLinkable : BSPrimDisplaced
313 } 312 }
314 break; 313 break;
315 } 314 }
315 // physChangeLinkFixed(linknum);
316 // Params: int linkNum, PhysActor linkedPrim
317 case BSScene.PhysFunctChangeLinkFixed:
318 {
319 if (pParams.Length > 1)
320 {
321 int linkNum = (int)pParams[0];
322 Manager.PhysicsActor linkActor = (Manager.PhysicsActor)pParams[1];
323 Linkset.Refresh(this);
324 }
325 break;
326 }
316 default: 327 default:
317 ret = base.Extension(pFunct, pParams); 328 ret = base.Extension(pFunct, pParams);
318 break; 329 break;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 88d50b4..b451129 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -875,6 +875,10 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
875 // Per prim functions. See BSPrim. 875 // Per prim functions. See BSPrim.
876 public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType"; 876 public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType";
877 public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType"; 877 public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType";
878 public const string PhysFunctChangeLinkFixed = "BulletSim.ChangeLinkFixed";
879 public const string PhysFunctChangeLinkHinge = "BulletSim.ChangeLinkHinge";
880 public const string PhysFunctChangeLinkSpring = "BulletSim.ChangeLinkSpring";
881 public const string PhysFunctChangeLinkSlider = "BulletSim.ChangeLinkSlider";
878 // ============================================================= 882 // =============================================================
879 883
880 public override object Extension(string pFunct, params object[] pParams) 884 public override object Extension(string pFunct, params object[] pParams)