From dff0fb56902f62b070ec6fd05769babfad32ed2e Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 7 Aug 2013 11:18:23 -0700 Subject: [PATCH] BulletSim: Linkset.Refresh() calls internal ScheduleRebuild() to recreate the linkset physics at next PostTaint time. Replace the existing calls to ScheduleRebuild to be calls to Refresh(). This allows external routines to make changes to parameters and then cause the linkset to rebuild. --- .../Physics/BulletSPlugin/BSLinksetCompound.cs | 17 ++++++++--------- .../BulletSPlugin/BSLinksetConstraints.cs | 11 ++++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 47ab8424b4..8f12189e76 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs @@ -90,10 +90,9 @@ public sealed class BSLinksetCompound : BSLinkset // its internal properties. public override void Refresh(BSPrimLinkable requestor) { - base.Refresh(requestor); - // Something changed so do the rebuilding thing - // ScheduleRebuild(); + ScheduleRebuild(requestor); + base.Refresh(requestor); } // Schedule a refresh to happen after all the other taint processing. @@ -127,7 +126,7 @@ public sealed class BSLinksetCompound : BSLinkset if (IsRoot(child)) { // The root is going dynamic. Rebuild the linkset so parts and mass get computed properly. - ScheduleRebuild(LinksetRoot); + Refresh(LinksetRoot); } return ret; } @@ -144,7 +143,7 @@ public sealed class BSLinksetCompound : BSLinkset if (IsRoot(child)) { // Schedule a rebuild to verify that the root shape is set to the real shape. - ScheduleRebuild(LinksetRoot); + Refresh(LinksetRoot); } return ret; } @@ -227,7 +226,7 @@ public sealed class BSLinksetCompound : BSLinkset // there will already be a rebuild scheduled. DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild.schedulingRebuild,whichUpdated={1}", updated.LocalID, whichUpdated); - ScheduleRebuild(updated); + Refresh(updated); } } } @@ -245,7 +244,7 @@ public sealed class BSLinksetCompound : BSLinkset DetailLog("{0},BSLinksetCompound.RemoveDependencies,refreshIfChild,rID={1},rBody={2},isRoot={3}", child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody, IsRoot(child)); - ScheduleRebuild(child); + Refresh(child); return ret; } @@ -263,7 +262,7 @@ public sealed class BSLinksetCompound : BSLinkset DetailLog("{0},BSLinksetCompound.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID); // Rebuild the compound shape with the new child shape included - ScheduleRebuild(child); + Refresh(child); } return; } @@ -292,7 +291,7 @@ public sealed class BSLinksetCompound : BSLinkset else { // Rebuild the compound shape with the child removed - ScheduleRebuild(LinksetRoot); + Refresh(LinksetRoot); } } return; diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs index f3b70c35f7..db323c2e15 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs @@ -158,6 +158,7 @@ public sealed class BSLinksetConstraints : BSLinkset // refresh will happen once after all the other taints are applied. public override void Refresh(BSPrimLinkable requestor) { + ScheduleRebuild(requestor); base.Refresh(requestor); } @@ -194,7 +195,7 @@ public sealed class BSLinksetConstraints : BSLinkset if (IsRoot(child)) { // The root is going dynamic. Rebuild the linkset so parts and mass get computed properly. - ScheduleRebuild(LinksetRoot); + Refresh(LinksetRoot); } return ret; } @@ -213,7 +214,7 @@ public sealed class BSLinksetConstraints : BSLinkset if (IsRoot(child)) { // Schedule a rebuild to verify that the root shape is set to the real shape. - ScheduleRebuild(LinksetRoot); + Refresh(LinksetRoot); } return ret; } @@ -241,7 +242,7 @@ public sealed class BSLinksetConstraints : BSLinkset // Just undo all the constraints for this linkset. Rebuild at the end of the step. ret = PhysicallyUnlinkAllChildrenFromRoot(LinksetRoot); // Cause the constraints, et al to be rebuilt before the next simulation step. - ScheduleRebuild(LinksetRoot); + Refresh(LinksetRoot); } return ret; } @@ -259,7 +260,7 @@ public sealed class BSLinksetConstraints : BSLinkset DetailLog("{0},BSLinksetConstraints.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID); // Cause constraints and assorted properties to be recomputed before the next simulation step. - ScheduleRebuild(LinksetRoot); + Refresh(LinksetRoot); } return; } @@ -283,7 +284,7 @@ public sealed class BSLinksetConstraints : BSLinkset PhysicallyUnlinkAChildFromRoot(rootx, childx); }); // See that the linkset parameters are recomputed at the end of the taint time. - ScheduleRebuild(LinksetRoot); + Refresh(LinksetRoot); } else {