Stop attachments from causing an update to be sent on every frame in which

an avatar moves.
0.6.1-post-fixes
Melanie Thielker 2008-11-10 05:21:51 +00:00
parent ce37b80c68
commit fc6f3edec6
4 changed files with 13 additions and 7 deletions

View File

@ -2356,9 +2356,9 @@ namespace OpenSim.Region.Environment.Scenes
return att.UUID; return att.UUID;
} }
public void AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos) public void AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent)
{ {
m_innerScene.AttachObject(controllingClient, localID, attachPoint, rot, pos, false); m_innerScene.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent);
} }
public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att)

View File

@ -2042,6 +2042,7 @@ namespace OpenSim.Region.Environment.Scenes
public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp, bool silent) public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp, bool silent)
{ {
bool successYN = false; bool successYN = false;
grp.RootPart.UpdateFlag = 0;
int primcrossingXMLmethod = 0; int primcrossingXMLmethod = 0;
if (newRegionHandle != 0) if (newRegionHandle != 0)
@ -2139,7 +2140,7 @@ namespace OpenSim.Region.Environment.Scenes
grp.SetFromAssetID(grp.RootPart.LastOwnerID); grp.SetFromAssetID(grp.RootPart.LastOwnerID);
m_log.DebugFormat("[ATTACHMENT]: Attach to avatar {0}", sp.UUID.ToString()); m_log.DebugFormat("[ATTACHMENT]: Attach to avatar {0}", sp.UUID.ToString());
AttachObject(sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition); AttachObject(sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false);
} }
else else
{ {

View File

@ -1575,6 +1575,8 @@ namespace OpenSim.Region.Environment.Scenes
lock (m_parts) lock (m_parts)
{ {
bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0);
//if (IsAttachment) //if (IsAttachment)
//{ //{
//foreach (SceneObjectPart part in m_parts.Values) //foreach (SceneObjectPart part in m_parts.Values)
@ -1584,7 +1586,7 @@ namespace OpenSim.Region.Environment.Scenes
//return; //return;
//} //}
if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02) if ((Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02) && UsePhysics)
{ {
m_rootPart.UpdateFlag = 1; m_rootPart.UpdateFlag = 1;
lastPhysGroupPos = AbsolutePosition; lastPhysGroupPos = AbsolutePosition;
@ -1596,10 +1598,11 @@ namespace OpenSim.Region.Environment.Scenes
checkAtTargets(); checkAtTargets();
if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1) if (((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1)
|| (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1) || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1)
|| (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1) || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1)
|| (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1)) || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1))
&& UsePhysics)
{ {
m_rootPart.UpdateFlag = 1; m_rootPart.UpdateFlag = 1;

View File

@ -646,7 +646,8 @@ namespace OpenSim.Region.Environment.Scenes
// We deal with the possibility that two updates occur at // We deal with the possibility that two updates occur at
// the same unix time at the update point itself. // the same unix time at the update point itself.
if (update.LastFullUpdateTime < part.TimeStampFull) if ((update.LastFullUpdateTime < part.TimeStampFull) ||
part.IsAttachment)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}", // "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}",
@ -693,6 +694,7 @@ namespace OpenSim.Region.Environment.Scenes
if (part != part.ParentGroup.RootPart) if (part != part.ParentGroup.RootPart)
continue; continue;
System.Threading.Thread.Sleep(1000);
part.ParentGroup.SendFullUpdateToClient(ControllingClient); part.ParentGroup.SendFullUpdateToClient(ControllingClient);
continue; continue;
} }
@ -3184,7 +3186,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
// Attach from world, if not already attached // Attach from world, if not already attached
if (att.ParentGroup != null && !att.IsAttachment) if (att.ParentGroup != null && !att.IsAttachment)
m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, (uint)0, att.ParentGroup.GroupRotation, Vector3.Zero); m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, (uint)0, att.ParentGroup.GroupRotation, Vector3.Zero, false);
} }
catch (NullReferenceException) catch (NullReferenceException)
{ {