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.

0.7.6-extended
Robert Adams 2013-08-07 11:18:23 -07:00 committed by Justin Clark-Casey (justincc)
parent 3ffad76b0d
commit 05ff4379f0
2 changed files with 14 additions and 14 deletions

View File

@ -90,10 +90,9 @@ public sealed class BSLinksetCompound : BSLinkset
// its internal properties. // its internal properties.
public override void Refresh(BSPrimLinkable requestor) public override void Refresh(BSPrimLinkable requestor)
{ {
base.Refresh(requestor);
// Something changed so do the rebuilding thing // Something changed so do the rebuilding thing
// ScheduleRebuild(); ScheduleRebuild(requestor);
base.Refresh(requestor);
} }
// Schedule a refresh to happen after all the other taint processing. // Schedule a refresh to happen after all the other taint processing.
@ -127,7 +126,7 @@ public sealed class BSLinksetCompound : BSLinkset
if (IsRoot(child)) if (IsRoot(child))
{ {
// The root is going dynamic. Rebuild the linkset so parts and mass get computed properly. // The root is going dynamic. Rebuild the linkset so parts and mass get computed properly.
ScheduleRebuild(LinksetRoot); Refresh(LinksetRoot);
} }
return ret; return ret;
} }
@ -144,7 +143,7 @@ public sealed class BSLinksetCompound : BSLinkset
if (IsRoot(child)) if (IsRoot(child))
{ {
// Schedule a rebuild to verify that the root shape is set to the real shape. // Schedule a rebuild to verify that the root shape is set to the real shape.
ScheduleRebuild(LinksetRoot); Refresh(LinksetRoot);
} }
return ret; return ret;
} }
@ -227,7 +226,7 @@ public sealed class BSLinksetCompound : BSLinkset
// there will already be a rebuild scheduled. // there will already be a rebuild scheduled.
DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild.schedulingRebuild,whichUpdated={1}", DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild.schedulingRebuild,whichUpdated={1}",
updated.LocalID, whichUpdated); 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}", DetailLog("{0},BSLinksetCompound.RemoveDependencies,refreshIfChild,rID={1},rBody={2},isRoot={3}",
child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody, IsRoot(child)); child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody, IsRoot(child));
ScheduleRebuild(child); Refresh(child);
return ret; return ret;
} }
@ -263,7 +262,7 @@ public sealed class BSLinksetCompound : BSLinkset
DetailLog("{0},BSLinksetCompound.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID); DetailLog("{0},BSLinksetCompound.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID);
// Rebuild the compound shape with the new child shape included // Rebuild the compound shape with the new child shape included
ScheduleRebuild(child); Refresh(child);
} }
return; return;
} }
@ -292,7 +291,7 @@ public sealed class BSLinksetCompound : BSLinkset
else else
{ {
// Rebuild the compound shape with the child removed // Rebuild the compound shape with the child removed
ScheduleRebuild(LinksetRoot); Refresh(LinksetRoot);
} }
} }
return; return;

View File

@ -158,6 +158,7 @@ public sealed class BSLinksetConstraints : BSLinkset
// refresh will happen once after all the other taints are applied. // refresh will happen once after all the other taints are applied.
public override void Refresh(BSPrimLinkable requestor) public override void Refresh(BSPrimLinkable requestor)
{ {
ScheduleRebuild(requestor);
base.Refresh(requestor); base.Refresh(requestor);
} }
@ -194,7 +195,7 @@ public sealed class BSLinksetConstraints : BSLinkset
if (IsRoot(child)) if (IsRoot(child))
{ {
// The root is going dynamic. Rebuild the linkset so parts and mass get computed properly. // The root is going dynamic. Rebuild the linkset so parts and mass get computed properly.
ScheduleRebuild(LinksetRoot); Refresh(LinksetRoot);
} }
return ret; return ret;
} }
@ -213,7 +214,7 @@ public sealed class BSLinksetConstraints : BSLinkset
if (IsRoot(child)) if (IsRoot(child))
{ {
// Schedule a rebuild to verify that the root shape is set to the real shape. // Schedule a rebuild to verify that the root shape is set to the real shape.
ScheduleRebuild(LinksetRoot); Refresh(LinksetRoot);
} }
return ret; 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. // Just undo all the constraints for this linkset. Rebuild at the end of the step.
ret = PhysicallyUnlinkAllChildrenFromRoot(LinksetRoot); ret = PhysicallyUnlinkAllChildrenFromRoot(LinksetRoot);
// Cause the constraints, et al to be rebuilt before the next simulation step. // Cause the constraints, et al to be rebuilt before the next simulation step.
ScheduleRebuild(LinksetRoot); Refresh(LinksetRoot);
} }
return ret; return ret;
} }
@ -259,7 +260,7 @@ public sealed class BSLinksetConstraints : BSLinkset
DetailLog("{0},BSLinksetConstraints.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID); DetailLog("{0},BSLinksetConstraints.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID);
// Cause constraints and assorted properties to be recomputed before the next simulation step. // Cause constraints and assorted properties to be recomputed before the next simulation step.
ScheduleRebuild(LinksetRoot); Refresh(LinksetRoot);
} }
return; return;
} }
@ -283,7 +284,7 @@ public sealed class BSLinksetConstraints : BSLinkset
PhysicallyUnlinkAChildFromRoot(rootx, childx); PhysicallyUnlinkAChildFromRoot(rootx, childx);
}); });
// See that the linkset parameters are recomputed at the end of the taint time. // See that the linkset parameters are recomputed at the end of the taint time.
ScheduleRebuild(LinksetRoot); Refresh(LinksetRoot);
} }
else else
{ {