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.

mb-throttle-test
Robert Adams 2014-10-10 05:12:30 -07:00
parent 41a943bfd0
commit 63d192f011
3 changed files with 27 additions and 24 deletions

View File

@ -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

View File

@ -106,23 +106,36 @@ 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)
{
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
@ -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,

View File

@ -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)