From 912f0c7fde1d3ec159b9f9b61136a2ac64e7d9dd Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 7 Jun 2010 18:49:22 +0100 Subject: [PATCH] Stop some hud components disappearing on region crossings If viewers (or at least, Linden Viewer 1.23.5) receive child hud object updates before the root prim, then the children are not displayed. Updates were being queued in LLClientView in the right order (root first) but were being sent in a random order since they were all at the same prioritization This commit prioritizes the root prim of a hud to its highest level when queued. I'm not sure if the periodic reprioritization triggered via ScenePresence might reset this, but boosting priority appears to work so far. Also committed is a belt and braces mechanism in LLClientView to prevent child hud prim being sent out before their root, but since this doesn't appear to be needed it is currently commented out. --- .../ClientStack/LindenUDP/LLClientView.cs | 54 ++++++++++++++++--- .../Framework/Scenes/SceneObjectPart.cs | 31 +++++++++-- .../Region/Framework/Scenes/ScenePresence.cs | 4 +- bin/OpenSim.exe.config | 4 +- 4 files changed, 79 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 724c8bc986..37929f2374 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -365,6 +365,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// protected HashSet m_killRecord; +// protected HashSet m_attachmentsQueued; +// protected HashSet m_attachmentsSent; + private int m_moneyBalance; private int m_animationSequenceNumber = 1; private bool m_SendLogoutPacketWhenClosing = true; @@ -456,6 +459,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_primFullUpdates = new PriorityQueue(m_scene.Entities.Count); m_fullUpdateDataBlocksBuilder = new List(); m_killRecord = new HashSet(); +// m_attachmentsQueued = new HashSet(); +// m_attachmentsSent = new HashSet(); m_assetService = m_scene.RequestModuleInterface(); m_hyperAssets = m_scene.RequestModuleInterface(); @@ -3401,6 +3406,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data); OutPacket(objupdate, ThrottleOutPacketType.Task); + + // We need to record the avatar local id since the root prim of an attachment points to this. +// m_attachmentsSent.Add(data.AvatarLocalID); } /// @@ -3523,6 +3531,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP return; ObjectUpdatePacket.ObjectDataBlock objectData = CreatePrimUpdateBlock(data); + +// if (data.attachment) +// m_attachmentsQueued.Add(data.localID); lock (m_primFullUpdates.SyncRoot) m_primFullUpdates.Enqueue(data.priority, objectData, data.localID); @@ -3549,15 +3560,37 @@ namespace OpenSim.Region.ClientStack.LindenUDP ObjectUpdatePacket.ObjectDataBlock block = m_primFullUpdates.Dequeue(); if (!m_killRecord.Contains(block.ID)) - { + { +// if (m_attachmentsQueued.Contains(block.ID)) +// { +// string text = Util.FieldToString(block.Text); +// if (text.IndexOf("\n") >= 0) +// text = text.Remove(text.IndexOf("\n")); +// +// if (m_attachmentsSent.Contains(block.ParentID)) +// { +// m_log.DebugFormat( +// "[CLIENT]: Sending full info about attached prim {0} text {1}", +// block.ID, text); +// +// m_fullUpdateDataBlocksBuilder.Add(block); +// +// m_attachmentsSent.Add(block.ID); +// } +// else +// { +// m_log.DebugFormat( +// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", +// block.ID, text, block.ParentID); +// +// lock (m_primFullUpdates.SyncRoot) +// m_primFullUpdates.Enqueue(double.MaxValue, block, block.ID); +// } +// } +// else +// { m_fullUpdateDataBlocksBuilder.Add(block); - -// string text = Util.FieldToString(outPacket.ObjectData[i].Text); -// if (text.IndexOf("\n") >= 0) -// text = text.Remove(text.IndexOf("\n")); -// m_log.DebugFormat( -// "[CLIENT]: Sending full info about prim {0} text {1} to client {2}", -// outPacket.ObjectData[i].ID, text, Name); +// } } // else // { @@ -4506,6 +4539,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected ObjectUpdatePacket.ObjectDataBlock CreatePrimUpdateBlock(SendPrimitiveData data) { +// if (data.attachment) +// m_log.DebugFormat( +// "[LLCLIENTVIEW]: Creating prim update block for {0}, parent {1}, priority {2}", +// data.localID, data.parentID, data.priority); + byte[] objectData = new byte[60]; data.pos.ToBytes(objectData, 0); data.vel.ToBytes(objectData, 12); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 33624a2941..479ee4d516 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2929,10 +2929,33 @@ namespace OpenSim.Region.Framework.Scenes //isattachment = ParentGroup.RootPart.IsAttachment; byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; - remoteClient.SendPrimitiveToClient(new SendPrimitiveData(m_regionHandle, m_parentGroup.GetTimeDilation(), LocalId, m_shape, - lPos, Velocity, Acceleration, RotationOffset, AngularVelocity, clientFlags, m_uuid, _ownerID, - m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment, - AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius, ParentGroup.GetUpdatePriority(remoteClient))); + + double priority = ParentGroup.GetUpdatePriority(remoteClient); + if (IsRoot && IsAttachment) + { + if (double.MinValue == priority) + { + m_log.WarnFormat( + "[SOP]: Couldn't raise update priority of root part for attachment {0} {1} because priority is already highest value", + Name, LocalId); + } + else + { + priority = double.MinValue; + } + } + + remoteClient.SendPrimitiveToClient( + new SendPrimitiveData(m_regionHandle, m_parentGroup.GetTimeDilation(), LocalId, m_shape, + lPos, Velocity, Acceleration, RotationOffset, AngularVelocity, clientFlags, m_uuid, _ownerID, + m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment, + AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius, priority)); + +// if (IsRoot && IsAttachment) +// { +// ScenePresence sp = ParentGroup.Scene.GetScenePresence(remoteClient.AgentId); +// remoteClient.ReprioritizeUpdates(StateUpdateTypes.PrimitiveFull, sp.UpdatePriority); +// } } /// diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 49736633d4..18f2fd29ec 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3871,8 +3871,10 @@ namespace OpenSim.Region.Framework.Scenes } } - private double UpdatePriority(UpdatePriorityData data) + internal double UpdatePriority(UpdatePriorityData data) { +// m_log.DebugFormat("[SCENE PRESENCE]: Reprioritizing updates to client {0} for {1}", Name, data.localID); + EntityBase entity; SceneObjectGroup group; diff --git a/bin/OpenSim.exe.config b/bin/OpenSim.exe.config index 4e7ef51bd8..aa2162e9fd 100755 --- a/bin/OpenSim.exe.config +++ b/bin/OpenSim.exe.config @@ -12,7 +12,9 @@ - + + +