From 7b4fb3b8bc62ff93927e88fef18cf5e2f931fa7e Mon Sep 17 00:00:00 2001
From: Sean Dague
Date: Fri, 8 Feb 2008 16:09:24 +0000
Subject: From: Kurt Taylor <krtaylor@us.ibm.com>

Attached is a patch for Mantis 25 - this fixes the problem of not having a
touch_start happen for all prims in a linked group.  So, with this, large
builds can now have a single script in the base prim and it will run when
any prim in the linked build is touched.   The problem was that the
objectgrab event was not being propagated to all the prims in the group.
 


---
 OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 8adb281..86f10d7 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -148,7 +148,6 @@ namespace OpenSim.Region.Environment.Scenes
 
         public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
         {
-            EventManager.TriggerObjectGrab(localID, offsetPos, remoteClient);
 
             List<EntityBase> EntitieList = GetEntities();
 
@@ -158,9 +157,21 @@ namespace OpenSim.Region.Environment.Scenes
                 {
                     SceneObjectGroup obj = ent as SceneObjectGroup;
 
+                    // Is this prim part of the group
                     if (obj.HasChildPrim(localID))
                     {
+                        // Currently only grab/touch for the single prim
+                        // the client handles rez correctly
                         obj.ObjectGrabHandler(localID, offsetPos, remoteClient);
+
+                        // trigger event, one for each prim part in the group
+                        // so that a touch to a non-root prim in a group will still
+                        // trigger a touch_start for a script in the root prim
+                        foreach (SceneObjectPart part in obj.Children.Values)
+                        {
+                            EventManager.TriggerObjectGrab(part.LocalID, part.OffsetPosition, remoteClient);
+                        }
+
                         return;
                     }
                 }
-- 
cgit v1.1