From 63d192f011c5232334759f8723c5e16197daff1b Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 10 Oct 2014 05:12:30 -0700 Subject: BulletSim: Remove linkset 'Incomplete' flag as its meaning couldn't be made clear. Add 'InternalScheduleRebuild() CHange rebuild code to call InternalScheduleRebuild() rather than ForceRebuild() to limit the scope of the changes made by the linkset. --- OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | 2 +- .../Physics/BulletSPlugin/BSLinksetCompound.cs | 37 +++++++++++++++------- .../Region/Physics/BulletSPlugin/BSPrimLinkable.cs | 10 ------ 3 files changed, 26 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs index c0f8c2a..d37f29b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs @@ -305,7 +305,7 @@ public abstract class BSLinkset // This is turned on when the rebuild is requested and turned off when // the rebuild is complete. Used to limit modifications to the // linkset parameters while the linkset is in an intermediate state. - // Protected by a "lock(this)" on the BSLinkset object + // Protected by a "lock(m_linsetActivityLock)" on the BSLinkset object public bool RebuildScheduled { get; protected set; } // The object is going dynamic (physical). Do any setup necessary diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 582ba5b..049f825 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs @@ -106,22 +106,35 @@ public sealed class BSLinksetCompound : BSLinkset // When rebuilding, it is possible to set properties that would normally require a rebuild. // If already rebuilding, don't request another rebuild. // If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding. - lock (this) + lock (m_linksetActivityLock) { - if (!RebuildScheduled) + if (!RebuildScheduled && !Rebuilding && HasAnyChildren) { - if (!Rebuilding && HasAnyChildren) + InternalScheduleRebuild(requestor); + } + } + } + + private void InternalScheduleRebuild(BSPrimLinkable requestor) + { + RebuildScheduled = true; + m_physicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate() + { + if (HasAnyChildren) + { + if (this.AllPartsComplete) { - RebuildScheduled = true; - m_physicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate() - { - if (HasAnyChildren) - RecomputeLinksetCompound(); - RebuildScheduled = false; - }); + RecomputeLinksetCompound(); + } + else + { + DetailLog("{0},BSLinksetCompound.InternalScheduleRebuild,,rescheduling because not all children complete", + requestor.LocalID); + InternalScheduleRebuild(requestor); } } - } + RebuildScheduled = false; + }); } // The object is going dynamic (physical). Do any setup necessary for a dynamic linkset. @@ -412,7 +425,7 @@ public sealed class BSLinksetCompound : BSLinkset // Just skip this linkset for the moment and cause the shape to be rebuilt next tick. // One problem might be that the shape is broken somehow and it never becomes completely // available. This might cause the rebuild to happen over and over. - LinksetRoot.ForceBodyShapeRebuild(false); + InternalScheduleRebuild(LinksetRoot); DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChildWithNoShape,indx={1},cShape={2},offPos={3},offRot={4}", LinksetRoot.LocalID, cPrim.LinksetChildIndex, childShape, offsetPos, offsetRot); // Output an annoying warning. It should only happen once but if it keeps coming out, diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs index c293e8c..430d645 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs @@ -54,16 +54,6 @@ public class BSPrimLinkable : BSPrimDisplaced public BSLinkset.LinksetImplementation LinksetType { get; set; } - public override bool IsIncomplete - { - get - { - // A linkset is incomplete when base objects are incomplete, waiting for assets, - // or being rebuilt. - return (base.IsIncomplete || Linkset.RebuildScheduled || !Linkset.AllPartsComplete); - } - } - public BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical) : base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical) -- cgit v1.1