From 2b2580e3a12d5c493f9a77bf9435ca32a0a0355c Mon Sep 17 00:00:00 2001
From: Snoopy Pfeffer
Date: Sun, 25 Sep 2011 00:51:43 +0200
Subject: Fix for rezzing and derezzing HUDs (see Mantis #5406). From now on
 updates are only sent to affected clients.

---
 OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 6 +++++-
 OpenSim/Region/Framework/Scenes/SceneObjectPart.cs  | 7 ++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

(limited to 'OpenSim')

diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 980b01f..234eb7d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1174,7 +1174,11 @@ namespace OpenSim.Region.Framework.Scenes
                     {
                         part.UpdateFlag = 0;
                         if (part == m_rootPart)
-                            avatar.ControllingClient.SendKillObject(m_regionHandle, part.LocalId);
+                        {
+                            if (!IsAttachment || (AttachedAvatar == avatar.ControllingClient.AgentId) || 
+                                (AttachmentPoint < 31) || (AttachmentPoint > 38))
+                                avatar.ControllingClient.SendKillObject(m_regionHandle, part.LocalId);
+                        }
                     }
                 });
             }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 632ac8f..d631c12 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2999,6 +2999,10 @@ namespace OpenSim.Region.Framework.Scenes
             if (ParentGroup.IsDeleted)
                 return;
 
+            if (ParentGroup.IsAttachment && (ParentGroup.AttachedAvatar != remoteClient.AgentId) &&
+                (ParentGroup.AttachmentPoint >= 31) && (ParentGroup.AttachmentPoint <= 38))
+                return;
+
             clientFlags &= ~(uint) PrimFlags.CreateSelected;
 
             if (remoteClient.AgentId == _ownerID)
@@ -4786,7 +4790,8 @@ namespace OpenSim.Region.Framework.Scenes
             if (ParentGroup.IsDeleted)
                 return;
 
-            if (ParentGroup.IsAttachment && ParentGroup.RootPart != this)
+            if (ParentGroup.IsAttachment && ((ParentGroup.RootPart != this) ||
+                ((ParentGroup.AttachedAvatar != remoteClient.AgentId) && (ParentGroup.AttachmentPoint >= 31) && (ParentGroup.AttachmentPoint <= 38))))
                 return;
             
             // Causes this thread to dig into the Client Thread Data.
-- 
cgit v1.1