diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 1ae01ccfb8..660bb3ea54 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -605,7 +605,7 @@ namespace OpenSim.Client.MXP.ClientStack public event ObjectDuplicate OnObjectDuplicate; public event ObjectDuplicateOnRay OnObjectDuplicateOnRay; public event GrabObject OnGrabObject; - public event ObjectSelect OnDeGrabObject; + public event DeGrabObject OnDeGrabObject; public event MoveObject OnGrabUpdate; public event SpinStart OnSpinStart; public event SpinObject OnSpinUpdate; diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index 011392e6ea..225ef69333 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs @@ -252,7 +252,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack public event ObjectDuplicate OnObjectDuplicate = delegate { }; public event ObjectDuplicateOnRay OnObjectDuplicateOnRay = delegate { }; public event GrabObject OnGrabObject = delegate { }; - public event ObjectSelect OnDeGrabObject = delegate { }; + public event DeGrabObject OnDeGrabObject = delegate { }; public event MoveObject OnGrabUpdate = delegate { }; public event SpinStart OnSpinStart = delegate { }; public event SpinObject OnSpinUpdate = delegate { }; diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 5d169cfc71..2a81d5c6d0 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -155,6 +155,9 @@ namespace OpenSim.Framework public delegate void GrabObject( uint localID, Vector3 pos, IClientAPI remoteClient, List surfaceArgs); + public delegate void DeGrabObject( + uint localID, IClientAPI remoteClient, List surfaceArgs); + public delegate void MoveObject( UUID objectID, Vector3 offset, Vector3 grapPos, IClientAPI remoteClient, List surfaceArgs ); @@ -609,7 +612,7 @@ namespace OpenSim.Framework event ObjectDuplicate OnObjectDuplicate; event ObjectDuplicateOnRay OnObjectDuplicateOnRay; event GrabObject OnGrabObject; - event ObjectSelect OnDeGrabObject; + event DeGrabObject OnDeGrabObject; event MoveObject OnGrabUpdate; event SpinStart OnSpinStart; event SpinObject OnSpinUpdate; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 98c84ae5a0..1109e775f3 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -197,7 +197,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP private UpdatePrimTexture handlerUpdatePrimTexture; private GrabObject handlerGrabObject; //OnGrabObject; private MoveObject handlerGrabUpdate; //OnGrabUpdate; - private ObjectSelect handlerDeGrabObject; //OnDeGrabObject; + private DeGrabObject handlerDeGrabObject; //OnDeGrabObject; private SpinStart handlerSpinStart; //OnSpinStart; private SpinObject handlerSpinUpdate; //OnSpinUpdate; private SpinStop handlerSpinStop; //OnSpinStop; @@ -1021,7 +1021,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event LinkObjects OnLinkObjects; public event DelinkObjects OnDelinkObjects; public event GrabObject OnGrabObject; - public event ObjectSelect OnDeGrabObject; + public event DeGrabObject OnDeGrabObject; public event SpinStart OnSpinStart; public event SpinStop OnSpinStop; public event ObjectDuplicate OnObjectDuplicate; @@ -5991,7 +5991,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP handlerDeGrabObject = OnDeGrabObject; if (handlerDeGrabObject != null) { - handlerDeGrabObject(deGrab.ObjectData.LocalID, this); + List touchArgs = new List(); + if ((deGrab.SurfaceInfo != null) && (deGrab.SurfaceInfo.Length > 0)) + { + foreach (ObjectDeGrabPacket.SurfaceInfoBlock surfaceInfo in deGrab.SurfaceInfo) + { + SurfaceTouchEventArgs arg = new SurfaceTouchEventArgs(); + arg.Binormal = surfaceInfo.Binormal; + arg.FaceIndex = surfaceInfo.FaceIndex; + arg.Normal = surfaceInfo.Normal; + arg.Position = surfaceInfo.Position; + arg.STCoord = surfaceInfo.STCoord; + arg.UVCoord = surfaceInfo.UVCoord; + touchArgs.Add(arg); + } + } + handlerDeGrabObject(deGrab.ObjectData.LocalID, this, touchArgs); } break; case PacketType.ObjectSpinStart: diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 2a2384bcb4..f797dbc58f 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -94,7 +94,7 @@ namespace OpenSim.Region.Examples.SimpleModule public event GodKickUser OnGodKickUser; public event ObjectDuplicate OnObjectDuplicate; public event GrabObject OnGrabObject; - public event ObjectSelect OnDeGrabObject; + public event DeGrabObject OnDeGrabObject; public event MoveObject OnGrabUpdate; public event SpinStart OnSpinStart; public event SpinObject OnSpinUpdate; diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index cb1543421c..08ec1aa46b 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -93,7 +93,7 @@ namespace OpenSim.Region.Framework.Scenes public event OnShutdownDelegate OnShutdown; public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); - public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient); + public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); public delegate void ScriptResetDelegate(uint localID, UUID itemID); public delegate void OnPermissionErrorDelegate(UUID user, string reason); @@ -582,12 +582,12 @@ namespace OpenSim.Region.Framework.Scenes } } - public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient) + public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { handlerObjectDeGrab = OnObjectDeGrab; if (handlerObjectDeGrab != null) { - handlerObjectDeGrab(localID, originalID, remoteClient); + handlerObjectDeGrab(localID, originalID, remoteClient, surfaceArgs); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index e0de0294f3..9251aa680d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -269,10 +269,14 @@ namespace OpenSim.Region.Framework.Scenes } } - public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient) + public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List surfaceArgs) { List EntityList = GetEntities(); + SurfaceTouchEventArgs surfaceArg = null; + if (surfaceArgs != null && surfaceArgs.Count > 0) + surfaceArg = surfaceArgs[0]; + foreach (EntityBase ent in EntityList) { if (ent is SceneObjectGroup) @@ -288,9 +292,9 @@ namespace OpenSim.Region.Framework.Scenes // If the touched prim handles touches, deliver it // If not, deliver to root prim if ((part.ScriptEvents & scriptEvents.touch_end) != 0) - EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient); + EventManager.TriggerObjectDeGrab(part.LocalId, 0, remoteClient, surfaceArg); else - EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient); + EventManager.TriggerObjectDeGrab(obj.RootPart.LocalId, part.LocalId, remoteClient, surfaceArg); return; } diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 9c6c44d90b..9002a21e74 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -679,7 +679,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public event ObjectDuplicate OnObjectDuplicate; public event ObjectDuplicateOnRay OnObjectDuplicateOnRay; public event GrabObject OnGrabObject; - public event ObjectSelect OnDeGrabObject; + public event DeGrabObject OnDeGrabObject; public event MoveObject OnGrabUpdate; public event SpinStart OnSpinStart; public event SpinObject OnSpinUpdate; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index cd559cbfe5..0505fe81df 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -200,7 +200,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC public event GodKickUser OnGodKickUser; public event ObjectDuplicate OnObjectDuplicate; public event GrabObject OnGrabObject; - public event ObjectSelect OnDeGrabObject; + public event DeGrabObject OnDeGrabObject; public event MoveObject OnGrabUpdate; public event SpinStart OnSpinStart; public event SpinObject OnSpinUpdate; diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs index b97f62e341..dc49549033 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs @@ -208,7 +208,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine det)); } - public void touch_end(uint localID, uint originalID, IClientAPI remoteClient) + public void touch_end(uint localID, uint originalID, IClientAPI remoteClient, + SurfaceTouchEventArgs surfaceArgs) { // Add to queue for all scripts in ObjectID object DetectParams[] det = new DetectParams[1]; @@ -232,6 +233,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine det[0].LinkNum = originalPart.LinkNum; } + if (surfaceArgs != null) + { + det[0].SurfaceTouchArgs = surfaceArgs; + } + myScriptEngine.PostObjectEvent(localID, new EventParams( "touch_end", new Object[] { new LSL_Types.LSLInteger(1) }, det)); diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index e4db0b55c0..3b9ff2ef32 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs @@ -156,7 +156,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine det)); } - public void touch_end(uint localID, uint originalID, IClientAPI remoteClient) + public void touch_end(uint localID, uint originalID, IClientAPI remoteClient, + SurfaceTouchEventArgs surfaceArgs) { // Add to queue for all scripts in ObjectID object DetectParams[] det = new DetectParams[1]; @@ -178,6 +179,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine det[0].LinkNum = originalPart.LinkNum; } + if (surfaceArgs != null) + { + det[0].SurfaceTouchArgs = surfaceArgs; + } + myScriptEngine.PostObjectEvent(localID, new EventParams( "touch_end", new Object[] { new LSL_Types.LSLInteger(1) }, det)); diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index fdca410cab..64af13d55d 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -106,7 +106,7 @@ namespace OpenSim.Tests.Common.Mock public event GodKickUser OnGodKickUser; public event ObjectDuplicate OnObjectDuplicate; public event GrabObject OnGrabObject; - public event ObjectSelect OnDeGrabObject; + public event DeGrabObject OnDeGrabObject; public event MoveObject OnGrabUpdate; public event SpinStart OnSpinStart; public event SpinObject OnSpinUpdate;