diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs index c0f8c2a3ac..d37f29b641 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 582ba5b577..049f825614 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs @@ -106,24 +106,37 @@ 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) - { - RebuildScheduled = true; - m_physicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate() - { - if (HasAnyChildren) - RecomputeLinksetCompound(); - RebuildScheduled = false; - }); - } + InternalScheduleRebuild(requestor); } } } + private void InternalScheduleRebuild(BSPrimLinkable requestor) + { + RebuildScheduled = true; + m_physicsScene.PostTaintObject("BSLinksetCompound.ScheduleRebuild", LinksetRoot.LocalID, delegate() + { + if (HasAnyChildren) + { + if (this.AllPartsComplete) + { + 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. // Only the state of the passed object can be modified. The rest of the linkset // has not yet been fully constructed. @@ -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 c293e8c185..430d645566 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)