diff options
author | Justin Clark-Casey (justincc) | 2010-01-29 23:12:08 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-01-29 23:12:08 +0000 |
commit | 05a3e37b853fc870b83eb67b47bc70eb724f652e (patch) | |
tree | 8fddceb9442ed0352c1b5f04a79ee2242bd4d6d1 /OpenSim | |
parent | Apply http://opensimulator.org/mantis/view.php?id=4548 (diff) | |
download | opensim-SC-05a3e37b853fc870b83eb67b47bc70eb724f652e.zip opensim-SC-05a3e37b853fc870b83eb67b47bc70eb724f652e.tar.gz opensim-SC-05a3e37b853fc870b83eb67b47bc70eb724f652e.tar.bz2 opensim-SC-05a3e37b853fc870b83eb67b47bc70eb724f652e.tar.xz |
Apply http://opensimulator.org/mantis/view.php?id=3334
Send continuous touch() events if the left mouse button is held down while moving over an object
This conforms with Linden Lab practice
Thanks Revolution
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 40 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/EventManager.cs | 7 |
4 files changed, 58 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 399379e..004ea1f 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -104,6 +104,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
104 | public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; | 104 | public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; |
105 | 105 | ||
106 | public event ObjectGrabDelegate OnObjectGrab; | 106 | public event ObjectGrabDelegate OnObjectGrab; |
107 | public event ObjectGrabDelegate OnObjectGrabbing; | ||
107 | public event ObjectDeGrabDelegate OnObjectDeGrab; | 108 | public event ObjectDeGrabDelegate OnObjectDeGrab; |
108 | public event ScriptResetDelegate OnScriptReset; | 109 | public event ScriptResetDelegate OnScriptReset; |
109 | 110 | ||
@@ -408,6 +409,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
408 | private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd; | 409 | private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd; |
409 | private OnShutdownDelegate handlerShutdown = null; //OnShutdown; | 410 | private OnShutdownDelegate handlerShutdown = null; //OnShutdown; |
410 | private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab; | 411 | private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab; |
412 | private ObjectGrabDelegate handlerObjectGrabbing = null; //OnObjectGrabbing; | ||
411 | private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab; | 413 | private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab; |
412 | private ScriptResetDelegate handlerScriptReset = null; // OnScriptReset | 414 | private ScriptResetDelegate handlerScriptReset = null; // OnScriptReset |
413 | private NewRezScript handlerRezScript = null; //OnRezScript; | 415 | private NewRezScript handlerRezScript = null; //OnRezScript; |
@@ -620,6 +622,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
620 | } | 622 | } |
621 | } | 623 | } |
622 | 624 | ||
625 | public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) | ||
626 | { | ||
627 | handlerObjectGrabbing = OnObjectGrabbing; | ||
628 | if (handlerObjectGrabbing != null) | ||
629 | { | ||
630 | handlerObjectGrabbing(localID, originalID, offsetPos, remoteClient, surfaceArgs); | ||
631 | } | ||
632 | } | ||
633 | |||
623 | public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) | 634 | public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) |
624 | { | 635 | { |
625 | handlerObjectDeGrab = OnObjectDeGrab; | 636 | handlerObjectDeGrab = OnObjectDeGrab; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 47fbeb4..ac04dc7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -292,6 +292,46 @@ namespace OpenSim.Region.Framework.Scenes | |||
292 | } | 292 | } |
293 | } | 293 | } |
294 | 294 | ||
295 | public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) | ||
296 | { | ||
297 | List<EntityBase> EntityList = GetEntities(); | ||
298 | |||
299 | SurfaceTouchEventArgs surfaceArg = null; | ||
300 | if (surfaceArgs != null && surfaceArgs.Count > 0) | ||
301 | surfaceArg = surfaceArgs[0]; | ||
302 | |||
303 | foreach (EntityBase ent in EntityList) | ||
304 | { | ||
305 | if (ent is SceneObjectGroup) | ||
306 | { | ||
307 | SceneObjectGroup obj = ent as SceneObjectGroup; | ||
308 | if (obj != null) | ||
309 | { | ||
310 | // Is this prim part of the group | ||
311 | if (obj.HasChildPrim(objectID)) | ||
312 | { | ||
313 | SceneObjectPart part = obj.GetChildPart(objectID); | ||
314 | |||
315 | // If the touched prim handles touches, deliver it | ||
316 | // If not, deliver to root prim | ||
317 | if ((part.ScriptEvents & scriptEvents.touch) != 0) | ||
318 | EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg); | ||
319 | // Deliver to the root prim if the touched prim doesn't handle touches | ||
320 | // or if we're meant to pass on touches anyway. Don't send to root prim | ||
321 | // if prim touched is the root prim as we just did it | ||
322 | if (((part.ScriptEvents & scriptEvents.touch) == 0) || | ||
323 | (part.PassTouches && (part.LocalId != obj.RootPart.LocalId))) | ||
324 | { | ||
325 | EventManager.TriggerObjectGrabbing(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg); | ||
326 | } | ||
327 | |||
328 | return; | ||
329 | } | ||
330 | } | ||
331 | } | ||
332 | } | ||
333 | } | ||
334 | |||
295 | public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) | 335 | public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) |
296 | { | 336 | { |
297 | List<EntityBase> EntityList = GetEntities(); | 337 | List<EntityBase> EntityList = GetEntities(); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4da05cf..73b0b3e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2675,6 +2675,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2675 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; | 2675 | client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; |
2676 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; | 2676 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; |
2677 | client.OnGrabObject += ProcessObjectGrab; | 2677 | client.OnGrabObject += ProcessObjectGrab; |
2678 | client.OnGrabUpdate += ProcessObjectGrabUpdate; | ||
2678 | client.OnDeGrabObject += ProcessObjectDeGrab; | 2679 | client.OnDeGrabObject += ProcessObjectDeGrab; |
2679 | client.OnUndo += m_sceneGraph.HandleUndo; | 2680 | client.OnUndo += m_sceneGraph.HandleUndo; |
2680 | client.OnObjectDescription += m_sceneGraph.PrimDescription; | 2681 | client.OnObjectDescription += m_sceneGraph.PrimDescription; |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index 16309ef..09b79d0 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs | |||
@@ -55,6 +55,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
55 | m_log.Info("[XEngine] Hooking up to server events"); | 55 | m_log.Info("[XEngine] Hooking up to server events"); |
56 | myScriptEngine.World.EventManager.OnAttach += attach; | 56 | myScriptEngine.World.EventManager.OnAttach += attach; |
57 | myScriptEngine.World.EventManager.OnObjectGrab += touch_start; | 57 | myScriptEngine.World.EventManager.OnObjectGrab += touch_start; |
58 | myScriptEngine.World.EventManager.OnObjectGrabbing += touch; | ||
58 | myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; | 59 | myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; |
59 | myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; | 60 | myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; |
60 | myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; | 61 | myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; |
@@ -148,7 +149,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
148 | } | 149 | } |
149 | 150 | ||
150 | public void touch(uint localID, uint originalID, Vector3 offsetPos, | 151 | public void touch(uint localID, uint originalID, Vector3 offsetPos, |
151 | IClientAPI remoteClient) | 152 | IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) |
152 | { | 153 | { |
153 | // Add to queue for all scripts in ObjectID object | 154 | // Add to queue for all scripts in ObjectID object |
154 | DetectParams[] det = new DetectParams[1]; | 155 | DetectParams[] det = new DetectParams[1]; |
@@ -172,6 +173,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
172 | SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID); | 173 | SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID); |
173 | det[0].LinkNum = originalPart.LinkNum; | 174 | det[0].LinkNum = originalPart.LinkNum; |
174 | } | 175 | } |
176 | if (surfaceArgs != null) | ||
177 | { | ||
178 | det[0].SurfaceTouchArgs = surfaceArgs; | ||
179 | } | ||
175 | 180 | ||
176 | myScriptEngine.PostObjectEvent(localID, new EventParams( | 181 | myScriptEngine.PostObjectEvent(localID, new EventParams( |
177 | "touch", new Object[] { new LSL_Types.LSLInteger(1) }, | 182 | "touch", new Object[] { new LSL_Types.LSLInteger(1) }, |