From fc6f3edec60c391bbd986ee021bff0e5fa4991c0 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 10 Nov 2008 05:21:51 +0000 Subject: Stop attachments from causing an update to be sent on every frame in which an avatar moves. --- OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 4 ++-- OpenSim/Region/Environment/Scenes/Scene.cs | 3 ++- OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 7 +++++-- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 6 ++++-- 4 files changed, 13 insertions(+), 7 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index b0bac42..ff4abc7 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -2356,9 +2356,9 @@ namespace OpenSim.Region.Environment.Scenes 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) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 62e6691..6634028 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2042,6 +2042,7 @@ namespace OpenSim.Region.Environment.Scenes public bool CrossPrimGroupIntoNewRegion(ulong newRegionHandle, SceneObjectGroup grp, bool silent) { bool successYN = false; + grp.RootPart.UpdateFlag = 0; int primcrossingXMLmethod = 0; if (newRegionHandle != 0) @@ -2139,7 +2140,7 @@ namespace OpenSim.Region.Environment.Scenes grp.SetFromAssetID(grp.RootPart.LastOwnerID); 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 { diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index a59047b..c17e4a7 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -1575,6 +1575,8 @@ namespace OpenSim.Region.Environment.Scenes lock (m_parts) { + bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); + //if (IsAttachment) //{ //foreach (SceneObjectPart part in m_parts.Values) @@ -1584,7 +1586,7 @@ namespace OpenSim.Region.Environment.Scenes //return; //} - if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02) + if ((Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02) && UsePhysics) { m_rootPart.UpdateFlag = 1; lastPhysGroupPos = AbsolutePosition; @@ -1596,10 +1598,11 @@ namespace OpenSim.Region.Environment.Scenes 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.Y - GroupRotation.Y) > 0.1) || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1)) + && UsePhysics) { m_rootPart.UpdateFlag = 1; diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index b90dd72..0efe6e1 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -646,7 +646,8 @@ namespace OpenSim.Region.Environment.Scenes // We deal with the possibility that two updates occur at // the same unix time at the update point itself. - if (update.LastFullUpdateTime < part.TimeStampFull) + if ((update.LastFullUpdateTime < part.TimeStampFull) || + part.IsAttachment) { // m_log.DebugFormat( // "[SCENE PRESENCE]: Fully updating prim {0}, {1} - part timestamp {2}", @@ -693,6 +694,7 @@ namespace OpenSim.Region.Environment.Scenes if (part != part.ParentGroup.RootPart) continue; + System.Threading.Thread.Sleep(1000); part.ParentGroup.SendFullUpdateToClient(ControllingClient); continue; } @@ -3184,7 +3186,7 @@ namespace OpenSim.Region.Environment.Scenes { // Attach from world, if not already attached 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) { -- cgit v1.1