* Implemented the actual ObjectUpdate network optimizations. Sends single prim updates instead of group updates in most cases and avoids sending unnecessary or duplicate ObjectUpdate packets

slimupdates
John Hurliman 2010-05-05 18:07:09 -07:00
parent 95130df78a
commit 93469d3d58
7 changed files with 46 additions and 70 deletions

View File

@ -207,8 +207,6 @@ namespace OpenSim.Region.Framework.Scenes
if (part.ParentGroup.IsAttachment)
isAttachment = true;
else
part.ParentGroup.ScheduleGroupForUpdate(PrimUpdateFlags.FullUpdate);
// If it's not an attachment, and we are allowed to move it,
// then we might have done so. If we moved across a parcel

View File

@ -2051,8 +2051,6 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.SetGroup(groupID, null);
}
sceneObject.ScheduleGroupForUpdate(PrimUpdateFlags.FullUpdate);
return sceneObject;
}

View File

@ -1512,7 +1512,7 @@ namespace OpenSim.Region.Framework.Scenes
parentGroup.RootPart.AddFlag(PrimFlags.CreateSelected);
parentGroup.TriggerScriptChangedEvent(Changed.LINK);
parentGroup.HasGroupChanged = true;
parentGroup.ScheduleGroupForUpdate(PrimUpdateFlags.FullUpdate);
parentGroup.ScheduleGroupForUpdate(PrimUpdateFlags.ParentID);
}
finally
@ -1627,7 +1627,7 @@ namespace OpenSim.Region.Framework.Scenes
{
g.TriggerScriptChangedEvent(Changed.LINK);
g.HasGroupChanged = true; // Persist
g.ScheduleGroupForUpdate(PrimUpdateFlags.FullUpdate);
g.ScheduleGroupForUpdate(PrimUpdateFlags.ParentID);
}
}
finally

View File

@ -1001,7 +1001,7 @@ namespace OpenSim.Region.Framework.Scenes
}
IsSelected = false; // fudge....
ScheduleGroupForUpdate(PrimUpdateFlags.FullUpdate);
RootPart.ScheduleUpdate(PrimUpdateFlags.ParentID);
}
}
else
@ -2902,7 +2902,6 @@ namespace OpenSim.Region.Framework.Scenes
part.IgnoreUndoUpdate = false;
part.StoreUndoState();
HasGroupChanged = true;
ScheduleGroupForUpdate(PrimUpdateFlags.Position);
}
}
@ -2939,11 +2938,12 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = pos;
HasGroupChanged = true;
}
//we need to do a terse update even if the move wasn't allowed
// so that the position is reset in the client (the object snaps back)
ScheduleGroupForUpdate(PrimUpdateFlags.Position);
m_rootPart.ScheduleUpdate(PrimUpdateFlags.Position);
}
/// <summary>
@ -3008,7 +3008,7 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = newPos;
HasGroupChanged = true;
ScheduleGroupForUpdate(PrimUpdateFlags.Position);
ScheduleGroupForUpdate(PrimUpdateFlags.Position | PrimUpdateFlags.Rotation);
}
public void OffsetForNewRegion(Vector3 offset)
@ -3040,7 +3040,6 @@ namespace OpenSim.Region.Framework.Scenes
}
HasGroupChanged = true;
ScheduleGroupForUpdate(PrimUpdateFlags.Position | PrimUpdateFlags.Rotation);
}
/// <summary>
@ -3066,7 +3065,6 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = pos;
HasGroupChanged = true;
ScheduleGroupForUpdate(PrimUpdateFlags.Position | PrimUpdateFlags.Rotation);
}
/// <summary>

View File

@ -1240,7 +1240,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void ClearPendingUpdate()
{
m_pendingUpdateFlags = 0;
m_pendingUpdateFlags = PrimUpdateFlags.None;
}
public void ResetExpire()
@ -2856,23 +2856,23 @@ namespace OpenSim.Region.Framework.Scenes
else
updateFlags &= ~PrimUpdateFlags.AngularVelocity;
if (!OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE))
if (!RelativePosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE))
updateFlags |= PrimUpdateFlags.Position;
else
updateFlags &= ~PrimUpdateFlags.Position;
// For good measure
if (Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
updateFlags |= PrimUpdateFlags.Position;
//if (Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
// updateFlags |= PrimUpdateFlags.Position;
#endregion PrimUpdateFlags Management
if (updateFlags != 0)
if (updateFlags != PrimUpdateFlags.None)
{
AddUpdateToAllAvatars(updateFlags);
// Update the "last" values
m_lastPosition = OffsetPosition;
m_lastPosition = RelativePosition;
m_lastRotation = RotationOffset;
m_lastVelocity = Velocity;
m_lastAcceleration = Acceleration;
@ -3342,8 +3342,7 @@ namespace OpenSim.Region.Framework.Scenes
public void StopLookAt()
{
m_parentGroup.stopLookAt();
m_parentGroup.ScheduleGroupForUpdate(PrimUpdateFlags.Position | PrimUpdateFlags.Rotation);
m_parentGroup.RootPart.ScheduleUpdate(PrimUpdateFlags.Rotation);
}
/// <summary>
@ -3364,8 +3363,7 @@ namespace OpenSim.Region.Framework.Scenes
public void StopMoveToTarget()
{
m_parentGroup.stopMoveToTarget();
m_parentGroup.ScheduleGroupForUpdate(PrimUpdateFlags.Position | PrimUpdateFlags.Rotation);
m_parentGroup.RootPart.ScheduleUpdate(PrimUpdateFlags.Position | PrimUpdateFlags.Rotation);
}
public void StoreUndoState()
@ -3941,20 +3939,18 @@ namespace OpenSim.Region.Framework.Scenes
(pos.Y != OffsetPosition.Y) ||
(pos.Z != OffsetPosition.Z))
{
Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
if (ParentGroup.RootPart.GetStatusSandbox())
{
if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, newPos) > 10)
if (Util.GetDistanceTo(ParentGroup.RootPart.StatusSandboxPos, pos) > 10)
{
ParentGroup.RootPart.ScriptSetPhysicsStatus(false);
newPos = OffsetPosition;
pos = OffsetPosition;
ParentGroup.Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, ParentGroup.RootPart.AbsolutePosition, Name, UUID, false);
}
}
OffsetPosition = newPos;
OffsetPosition = pos;
ScheduleUpdate(PrimUpdateFlags.Position);
}
}

View File

@ -42,17 +42,12 @@ namespace OpenSim.Region.Framework.Scenes
if (part != null)
{
if (part.ParentID == 0)
{
Position = part.ParentGroup.AbsolutePosition;
Rotation = part.RotationOffset;
Scale = part.Shape.Scale;
}
else
{
Position = part.OffsetPosition;
Rotation = part.RotationOffset;
Scale = part.Shape.Scale;
}
Rotation = part.RotationOffset;
Scale = part.Shape.Scale;
}
}
@ -84,57 +79,48 @@ namespace OpenSim.Region.Framework.Scenes
if (part != null)
{
part.Undoing = true;
PrimUpdateFlags updateFlags = PrimUpdateFlags.Position | PrimUpdateFlags.Rotation;
if (part.ParentID == 0)
{
if (Position != Vector3.Zero)
part.ParentGroup.AbsolutePosition = Position;
part.RotationOffset = Rotation;
if (Scale != Vector3.Zero)
part.Resize(Scale);
part.ParentGroup.ScheduleGroupForUpdate(PrimUpdateFlags.Position | PrimUpdateFlags.Rotation);
}
part.ParentGroup.AbsolutePosition = Position;
else
part.OffsetPosition = Position;
part.RotationOffset = Rotation;
if (Scale != part.Scale)
{
if (Position != Vector3.Zero)
part.OffsetPosition = Position;
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
part.Resize(Scale);
part.ScheduleUpdate(PrimUpdateFlags.Position | PrimUpdateFlags.Rotation);
part.Scale = Scale;
updateFlags |= PrimUpdateFlags.Scale;
}
part.Undoing = false;
part.ScheduleUpdate(updateFlags);
}
}
public void PlayfwdState(SceneObjectPart part)
{
if (part != null)
{
part.Undoing = true;
PrimUpdateFlags updateFlags = PrimUpdateFlags.Position | PrimUpdateFlags.Rotation;
if (part.ParentID == 0)
{
if (Position != Vector3.Zero)
part.ParentGroup.AbsolutePosition = Position;
if (Rotation != Quaternion.Identity)
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
part.Resize(Scale);
part.ParentGroup.ScheduleGroupForUpdate(PrimUpdateFlags.Position | PrimUpdateFlags.Rotation);
}
part.ParentGroup.AbsolutePosition = Position;
else
{
if (Position != Vector3.Zero)
part.OffsetPosition = Position;
if (Rotation != Quaternion.Identity)
part.UpdateRotation(Rotation);
if (Scale != Vector3.Zero)
part.Resize(Scale);
part.ScheduleUpdate(PrimUpdateFlags.Position | PrimUpdateFlags.Rotation);
}
part.Undoing = false;
part.OffsetPosition = Position;
part.RotationOffset = Rotation;
if (Scale != part.Scale)
{
part.Scale = Scale;
updateFlags |= PrimUpdateFlags.Scale;
}
part.Undoing = false;
part.ScheduleUpdate(updateFlags);
}
}
}

View File

@ -1913,7 +1913,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
part.OffsetPosition = new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z);
SceneObjectGroup parent = part.ParentGroup;
parent.HasGroupChanged = true;
parent.ScheduleGroupForUpdate(PrimUpdateFlags.Position);
part.ScheduleUpdate(PrimUpdateFlags.Position);
}
}
}
@ -3866,7 +3866,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Util.Clip((float)color.z, 0.0f, 1.0f));
m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f));
m_host.ParentGroup.HasGroupChanged = true;
m_host.ParentGroup.ScheduleGroupForUpdate(PrimUpdateFlags.Text);
m_host.ScheduleUpdate(PrimUpdateFlags.Text);
}
public LSL_Float llWater(LSL_Vector offset)