diff options
author | Robert Adams | 2013-08-20 13:09:40 -0700 |
---|---|---|
committer | Robert Adams | 2013-09-11 09:12:05 -0700 |
commit | d09c35f5063114880aecb94a938bfc49f5af5f7d (patch) | |
tree | 8af9cf90bdbde7b63bb49844d550d36529cadd46 /OpenSim | |
parent | BulletSim: add ID parameter to TaintedObject calls so logging will include Lo... (diff) | |
download | opensim-SC_OLD-d09c35f5063114880aecb94a938bfc49f5af5f7d.zip opensim-SC_OLD-d09c35f5063114880aecb94a938bfc49f5af5f7d.tar.gz opensim-SC_OLD-d09c35f5063114880aecb94a938bfc49f5af5f7d.tar.bz2 opensim-SC_OLD-d09c35f5063114880aecb94a938bfc49f5af5f7d.tar.xz |
BulletSim: pass both root and child BSPhysObjects to Extension function. Update routines to use the new parameters list from above change.
Diffstat (limited to 'OpenSim')
3 files changed, 41 insertions, 35 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs index 90cf15a..10e13b9 100755 --- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs | |||
@@ -220,7 +220,8 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
220 | containingGroup.UpdateGroupPosition(containingGroup.AbsolutePosition); | 220 | containingGroup.UpdateGroupPosition(containingGroup.AbsolutePosition); |
221 | containingGroup.UpdateGroupRotationR(containingGroup.GroupRotation); | 221 | containingGroup.UpdateGroupRotationR(containingGroup.GroupRotation); |
222 | 222 | ||
223 | ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, linksetType)); | 223 | object[] parms2 = { rootPhysActor, null, linksetType }; |
224 | ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, parms2)); | ||
224 | Thread.Sleep(150); // longer than one heartbeat tick | 225 | Thread.Sleep(150); // longer than one heartbeat tick |
225 | 226 | ||
226 | containingGroup.ScriptSetPhysicsStatus(true); | 227 | containingGroup.ScriptSetPhysicsStatus(true); |
@@ -229,7 +230,8 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
229 | { | 230 | { |
230 | // Non-physical linksets don't have a physical instantiation so there is no state to | 231 | // Non-physical linksets don't have a physical instantiation so there is no state to |
231 | // worry about being updated. | 232 | // worry about being updated. |
232 | ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, linksetType)); | 233 | object[] parms2 = { rootPhysActor, null, linksetType }; |
234 | ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, parms2)); | ||
233 | } | 235 | } |
234 | } | 236 | } |
235 | else | 237 | else |
@@ -271,7 +273,8 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
271 | PhysicsActor rootPhysActor = rootPart.PhysActor; | 273 | PhysicsActor rootPhysActor = rootPart.PhysActor; |
272 | if (rootPhysActor != null) | 274 | if (rootPhysActor != null) |
273 | { | 275 | { |
274 | ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinksetType)); | 276 | object[] parms2 = { rootPhysActor, null }; |
277 | ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinksetType, parms2)); | ||
275 | } | 278 | } |
276 | else | 279 | else |
277 | { | 280 | { |
@@ -315,8 +318,8 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
315 | 318 | ||
316 | if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) | 319 | if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) |
317 | { | 320 | { |
318 | object[] parms = { childPhysActor, typeCode }; | 321 | object[] parms2 = { rootPhysActor, childPhysActor, typeCode }; |
319 | ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms)); | 322 | ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms2)); |
320 | } | 323 | } |
321 | 324 | ||
322 | return ret; | 325 | return ret; |
@@ -334,8 +337,8 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
334 | 337 | ||
335 | if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) | 338 | if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) |
336 | { | 339 | { |
337 | object[] parms = { childPhysActor }; | 340 | object[] parms2 = { rootPhysActor, childPhysActor }; |
338 | ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinkType, parms)); | 341 | ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinkType, parms2)); |
339 | } | 342 | } |
340 | 343 | ||
341 | return ret; | 344 | return ret; |
@@ -354,8 +357,8 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
354 | 357 | ||
355 | if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) | 358 | if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) |
356 | { | 359 | { |
357 | object[] parms = { childPhysActor , PHYS_LINK_TYPE_FIXED }; | 360 | object[] parms2 = { rootPhysActor, childPhysActor , PHYS_LINK_TYPE_FIXED }; |
358 | ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms)); | 361 | ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms2)); |
359 | } | 362 | } |
360 | 363 | ||
361 | return ret; | 364 | return ret; |
@@ -412,7 +415,7 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
412 | 415 | ||
413 | if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) | 416 | if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) |
414 | { | 417 | { |
415 | object[] parms2 = AddToBeginningOfArray(childPhysActor, parms); | 418 | object[] parms2 = AddToBeginningOfArray(rootPhysActor, childPhysActor, parms); |
416 | ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkParams, parms2)); | 419 | ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkParams, parms2)); |
417 | } | 420 | } |
418 | 421 | ||
@@ -518,11 +521,12 @@ public class ExtendedPhysics : INonSharedRegionModule | |||
518 | } | 521 | } |
519 | 522 | ||
520 | // Return an array of objects with the passed object as the first object of a new array | 523 | // Return an array of objects with the passed object as the first object of a new array |
521 | private object[] AddToBeginningOfArray(object firstOne, object[] prevArray) | 524 | private object[] AddToBeginningOfArray(object firstOne, object secondOne, object[] prevArray) |
522 | { | 525 | { |
523 | object[] newArray = new object[1 + prevArray.Length]; | 526 | object[] newArray = new object[2 + prevArray.Length]; |
524 | newArray[0] = firstOne; | 527 | newArray[0] = firstOne; |
525 | prevArray.CopyTo(newArray, 1); | 528 | newArray[1] = secondOne; |
529 | prevArray.CopyTo(newArray, 2); | ||
526 | return newArray; | 530 | return newArray; |
527 | } | 531 | } |
528 | 532 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs index b2a9501..a9ae89d 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | |||
@@ -385,7 +385,7 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
385 | linkInfo.frameInAloc, linkInfo.frameInArot, linkInfo.frameInBloc, linkInfo.frameInBrot, | 385 | linkInfo.frameInAloc, linkInfo.frameInArot, linkInfo.frameInBloc, linkInfo.frameInBrot, |
386 | true /*useLinearReferenceFrameA*/, | 386 | true /*useLinearReferenceFrameA*/, |
387 | true /*disableCollisionsBetweenLinkedBodies*/); | 387 | true /*disableCollisionsBetweenLinkedBodies*/); |
388 | DetailLog("{0},BSLinksetConstraint.BuildConstraint,spring,root={1},rBody={2},child={3},cBody={4},rLoc={5},cLoc={6},midLoc={7}", | 388 | DetailLog("{0},BSLinksetConstraint.BuildConstraint,spring,root={1},rBody={2},child={3},cBody={4},rLoc={5},cLoc={6}", |
389 | rootPrim.LocalID, | 389 | rootPrim.LocalID, |
390 | rootPrim.LocalID, rootPrim.PhysBody.AddrString, | 390 | rootPrim.LocalID, rootPrim.PhysBody.AddrString, |
391 | linkInfo.member.LocalID, linkInfo.member.PhysBody.AddrString, | 391 | linkInfo.member.LocalID, linkInfo.member.PhysBody.AddrString, |
@@ -492,12 +492,12 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
492 | object ret = null; | 492 | object ret = null; |
493 | switch (pFunct) | 493 | switch (pFunct) |
494 | { | 494 | { |
495 | // pParams = [ BSPhysObject child, integer linkType ] | 495 | // pParams = [ BSPhysObject root, BSPhysObject child, integer linkType ] |
496 | case ExtendedPhysics.PhysFunctChangeLinkType: | 496 | case ExtendedPhysics.PhysFunctChangeLinkType: |
497 | if (pParams.Length > 1) | 497 | if (pParams.Length > 2) |
498 | { | 498 | { |
499 | int requestedType = (int)pParams[1]; | 499 | int requestedType = (int)pParams[2]; |
500 | DetailLog("{0},BSLinksetConstraint.SetLinkType,requestedType={1}", LinksetRoot.LocalID, requestedType); | 500 | DetailLog("{0},BSLinksetConstraint.ChangeLinkType,requestedType={1}", LinksetRoot.LocalID, requestedType); |
501 | if (requestedType == (int)ConstraintType.FIXED_CONSTRAINT_TYPE | 501 | if (requestedType == (int)ConstraintType.FIXED_CONSTRAINT_TYPE |
502 | || requestedType == (int)ConstraintType.D6_CONSTRAINT_TYPE | 502 | || requestedType == (int)ConstraintType.D6_CONSTRAINT_TYPE |
503 | || requestedType == (int)ConstraintType.D6_SPRING_CONSTRAINT_TYPE | 503 | || requestedType == (int)ConstraintType.D6_SPRING_CONSTRAINT_TYPE |
@@ -505,9 +505,11 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
505 | || requestedType == (int)ConstraintType.CONETWIST_CONSTRAINT_TYPE | 505 | || requestedType == (int)ConstraintType.CONETWIST_CONSTRAINT_TYPE |
506 | || requestedType == (int)ConstraintType.SLIDER_CONSTRAINT_TYPE) | 506 | || requestedType == (int)ConstraintType.SLIDER_CONSTRAINT_TYPE) |
507 | { | 507 | { |
508 | BSPrimLinkable child = pParams[0] as BSPrimLinkable; | 508 | BSPrimLinkable child = pParams[1] as BSPrimLinkable; |
509 | if (child != null) | 509 | if (child != null) |
510 | { | 510 | { |
511 | DetailLog("{0},BSLinksetConstraint.ChangeLinkType,rootID={1},childID={2},type={3}", | ||
512 | LinksetRoot.LocalID, LinksetRoot.LocalID, child.LocalID, requestedType); | ||
511 | m_physicsScene.TaintedObject(child.LocalID, "BSLinksetConstraint.PhysFunctChangeLinkType", delegate() | 513 | m_physicsScene.TaintedObject(child.LocalID, "BSLinksetConstraint.PhysFunctChangeLinkType", delegate() |
512 | { | 514 | { |
513 | // Pick up all the constraints currently created. | 515 | // Pick up all the constraints currently created. |
@@ -523,17 +525,17 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
523 | linkInfoC.ResetLink(); | 525 | linkInfoC.ResetLink(); |
524 | linkInfoC.constraintType = (ConstraintType)requestedType; | 526 | linkInfoC.constraintType = (ConstraintType)requestedType; |
525 | ret = (object)true; | 527 | ret = (object)true; |
526 | DetailLog("{0},BSLinksetConstraint.SetLinkType,link={1},type={2}", | 528 | DetailLog("{0},BSLinksetConstraint.ChangeLinkType,link={1},type={2}", |
527 | linkInfo.member.LocalID, linkInfo.member.LocalID, linkInfoC.constraintType); | 529 | linkInfo.member.LocalID, linkInfo.member.LocalID, linkInfoC.constraintType); |
528 | } | 530 | } |
529 | else | 531 | else |
530 | { | 532 | { |
531 | DetailLog("{0},BSLinksetConstraint.SetLinkType,linkInfoNotConstraint,childID={1}", LinksetRoot.LocalID, child.LocalID); | 533 | DetailLog("{0},BSLinksetConstraint.ChangeLinkType,linkInfoNotConstraint,childID={1}", LinksetRoot.LocalID, child.LocalID); |
532 | } | 534 | } |
533 | } | 535 | } |
534 | else | 536 | else |
535 | { | 537 | { |
536 | DetailLog("{0},BSLinksetConstraint.SetLinkType,noLinkInfoForChild,childID={1}", LinksetRoot.LocalID, child.LocalID); | 538 | DetailLog("{0},BSLinksetConstraint.ChangeLinkType,noLinkInfoForChild,childID={1}", LinksetRoot.LocalID, child.LocalID); |
537 | } | 539 | } |
538 | // Cause the whole linkset to be rebuilt in post-taint time. | 540 | // Cause the whole linkset to be rebuilt in post-taint time. |
539 | Refresh(child); | 541 | Refresh(child); |
@@ -551,11 +553,11 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
551 | } | 553 | } |
552 | } | 554 | } |
553 | break; | 555 | break; |
554 | // pParams = [] | 556 | // pParams = [ BSPhysObject root, BSPhysObject child ] |
555 | case ExtendedPhysics.PhysFunctGetLinkType: | 557 | case ExtendedPhysics.PhysFunctGetLinkType: |
556 | if (pParams.Length > 0) | 558 | if (pParams.Length > 0) |
557 | { | 559 | { |
558 | BSPrimLinkable child = pParams[0] as BSPrimLinkable; | 560 | BSPrimLinkable child = pParams[1] as BSPrimLinkable; |
559 | if (child != null) | 561 | if (child != null) |
560 | { | 562 | { |
561 | BSLinkInfo linkInfo = null; | 563 | BSLinkInfo linkInfo = null; |
@@ -573,14 +575,14 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
573 | } | 575 | } |
574 | } | 576 | } |
575 | break; | 577 | break; |
576 | // pParams = [ BSPhysObject child, int op, object opParams, int op, object opParams, ... ] | 578 | // pParams = [ BSPhysObject root, BSPhysObject child, int op, object opParams, int op, object opParams, ... ] |
577 | case ExtendedPhysics.PhysFunctChangeLinkParams: | 579 | case ExtendedPhysics.PhysFunctChangeLinkParams: |
578 | // There should be two parameters: the childActor and a list of parameters to set | 580 | // There should be two parameters: the childActor and a list of parameters to set |
579 | try | 581 | try |
580 | { | 582 | { |
581 | if (pParams.Length > 1) | 583 | if (pParams.Length > 2) |
582 | { | 584 | { |
583 | BSPrimLinkable child = pParams[0] as BSPrimLinkable; | 585 | BSPrimLinkable child = pParams[1] as BSPrimLinkable; |
584 | BSLinkInfo baseLinkInfo = null; | 586 | BSLinkInfo baseLinkInfo = null; |
585 | if (TryGetLinkInfo(child, out baseLinkInfo)) | 587 | if (TryGetLinkInfo(child, out baseLinkInfo)) |
586 | { | 588 | { |
@@ -592,7 +594,7 @@ public sealed class BSLinksetConstraints : BSLinkset | |||
592 | OMV.Vector3 valueVector; | 594 | OMV.Vector3 valueVector; |
593 | OMV.Quaternion valueQuaternion; | 595 | OMV.Quaternion valueQuaternion; |
594 | 596 | ||
595 | int opIndex = 1; | 597 | int opIndex = 2; |
596 | while (opIndex < pParams.Length) | 598 | while (opIndex < pParams.Length) |
597 | { | 599 | { |
598 | int thisOp = (int)pParams[opIndex]; | 600 | int thisOp = (int)pParams[opIndex]; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs index 840265b..126b146 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs | |||
@@ -288,7 +288,7 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
288 | switch (pFunct) | 288 | switch (pFunct) |
289 | { | 289 | { |
290 | // physGetLinksetType(); | 290 | // physGetLinksetType(); |
291 | // pParams = [] | 291 | // pParams = [ BSPhysObject root, null ] |
292 | case ExtendedPhysics.PhysFunctGetLinksetType: | 292 | case ExtendedPhysics.PhysFunctGetLinksetType: |
293 | { | 293 | { |
294 | ret = (object)LinksetType; | 294 | ret = (object)LinksetType; |
@@ -296,12 +296,12 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
296 | break; | 296 | break; |
297 | } | 297 | } |
298 | // physSetLinksetType(type); | 298 | // physSetLinksetType(type); |
299 | // pParams = [ BSPhysObject child, integer type ] | 299 | // pParams = [ BSPhysObject root, null, integer type ] |
300 | case ExtendedPhysics.PhysFunctSetLinksetType: | 300 | case ExtendedPhysics.PhysFunctSetLinksetType: |
301 | { | 301 | { |
302 | if (pParams.Length > 0) | 302 | if (pParams.Length > 2) |
303 | { | 303 | { |
304 | BSLinkset.LinksetImplementation linksetType = (BSLinkset.LinksetImplementation)pParams[0]; | 304 | BSLinkset.LinksetImplementation linksetType = (BSLinkset.LinksetImplementation)pParams[2]; |
305 | if (Linkset.IsRoot(this)) | 305 | if (Linkset.IsRoot(this)) |
306 | { | 306 | { |
307 | PhysScene.TaintedObject(LocalID, "BSPrim.PhysFunctSetLinksetType", delegate() | 307 | PhysScene.TaintedObject(LocalID, "BSPrim.PhysFunctSetLinksetType", delegate() |
@@ -317,21 +317,21 @@ public class BSPrimLinkable : BSPrimDisplaced | |||
317 | break; | 317 | break; |
318 | } | 318 | } |
319 | // physChangeLinkType(linknum, typeCode); | 319 | // physChangeLinkType(linknum, typeCode); |
320 | // pParams = [ BSPhysObject child, integer linkType ] | 320 | // pParams = [ BSPhysObject root, BSPhysObject child, integer linkType ] |
321 | case ExtendedPhysics.PhysFunctChangeLinkType: | 321 | case ExtendedPhysics.PhysFunctChangeLinkType: |
322 | { | 322 | { |
323 | ret = Linkset.Extension(pFunct, pParams); | 323 | ret = Linkset.Extension(pFunct, pParams); |
324 | break; | 324 | break; |
325 | } | 325 | } |
326 | // physGetLinkType(linknum); | 326 | // physGetLinkType(linknum); |
327 | // pParams = [ BSPhysObject child ] | 327 | // pParams = [ BSPhysObject root, BSPhysObject child ] |
328 | case ExtendedPhysics.PhysFunctGetLinkType: | 328 | case ExtendedPhysics.PhysFunctGetLinkType: |
329 | { | 329 | { |
330 | ret = Linkset.Extension(pFunct, pParams); | 330 | ret = Linkset.Extension(pFunct, pParams); |
331 | break; | 331 | break; |
332 | } | 332 | } |
333 | // physChangeLinkParams(linknum, [code, value, code, value, ...]); | 333 | // physChangeLinkParams(linknum, [code, value, code, value, ...]); |
334 | // pParams = [ BSPhysObject child, object[] [ string op, object opParam, string op, object opParam, ... ] ] | 334 | // pParams = [ BSPhysObject root, BSPhysObject child, object[] [ string op, object opParam, string op, object opParam, ... ] ] |
335 | case ExtendedPhysics.PhysFunctChangeLinkParams: | 335 | case ExtendedPhysics.PhysFunctChangeLinkParams: |
336 | { | 336 | { |
337 | ret = Linkset.Extension(pFunct, pParams); | 337 | ret = Linkset.Extension(pFunct, pParams); |