Send continuous touch() events if the left mouse button is held down while moving over an object This conforms with Linden Lab practice Thanks Revolutionmysql-performance
parent
7b53067d6d
commit
05a3e37b85
|
@ -104,6 +104,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
|
||||
|
||||
public event ObjectGrabDelegate OnObjectGrab;
|
||||
public event ObjectGrabDelegate OnObjectGrabbing;
|
||||
public event ObjectDeGrabDelegate OnObjectDeGrab;
|
||||
public event ScriptResetDelegate OnScriptReset;
|
||||
|
||||
|
@ -408,6 +409,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd;
|
||||
private OnShutdownDelegate handlerShutdown = null; //OnShutdown;
|
||||
private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab;
|
||||
private ObjectGrabDelegate handlerObjectGrabbing = null; //OnObjectGrabbing;
|
||||
private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab;
|
||||
private ScriptResetDelegate handlerScriptReset = null; // OnScriptReset
|
||||
private NewRezScript handlerRezScript = null; //OnRezScript;
|
||||
|
@ -620,6 +622,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
|
||||
{
|
||||
handlerObjectGrabbing = OnObjectGrabbing;
|
||||
if (handlerObjectGrabbing != null)
|
||||
{
|
||||
handlerObjectGrabbing(localID, originalID, offsetPos, remoteClient, surfaceArgs);
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
|
||||
{
|
||||
handlerObjectDeGrab = OnObjectDeGrab;
|
||||
|
|
|
@ -292,6 +292,46 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
|
||||
{
|
||||
List<EntityBase> EntityList = GetEntities();
|
||||
|
||||
SurfaceTouchEventArgs surfaceArg = null;
|
||||
if (surfaceArgs != null && surfaceArgs.Count > 0)
|
||||
surfaceArg = surfaceArgs[0];
|
||||
|
||||
foreach (EntityBase ent in EntityList)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
SceneObjectGroup obj = ent as SceneObjectGroup;
|
||||
if (obj != null)
|
||||
{
|
||||
// Is this prim part of the group
|
||||
if (obj.HasChildPrim(objectID))
|
||||
{
|
||||
SceneObjectPart part = obj.GetChildPart(objectID);
|
||||
|
||||
// If the touched prim handles touches, deliver it
|
||||
// If not, deliver to root prim
|
||||
if ((part.ScriptEvents & scriptEvents.touch) != 0)
|
||||
EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
|
||||
// Deliver to the root prim if the touched prim doesn't handle touches
|
||||
// or if we're meant to pass on touches anyway. Don't send to root prim
|
||||
// if prim touched is the root prim as we just did it
|
||||
if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
|
||||
(part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
|
||||
{
|
||||
EventManager.TriggerObjectGrabbing(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
|
||||
{
|
||||
List<EntityBase> EntityList = GetEntities();
|
||||
|
|
|
@ -2675,6 +2675,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily;
|
||||
client.OnObjectPermissions += HandleObjectPermissionsUpdate;
|
||||
client.OnGrabObject += ProcessObjectGrab;
|
||||
client.OnGrabUpdate += ProcessObjectGrabUpdate;
|
||||
client.OnDeGrabObject += ProcessObjectDeGrab;
|
||||
client.OnUndo += m_sceneGraph.HandleUndo;
|
||||
client.OnObjectDescription += m_sceneGraph.PrimDescription;
|
||||
|
|
|
@ -55,6 +55,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
m_log.Info("[XEngine] Hooking up to server events");
|
||||
myScriptEngine.World.EventManager.OnAttach += attach;
|
||||
myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
|
||||
myScriptEngine.World.EventManager.OnObjectGrabbing += touch;
|
||||
myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end;
|
||||
myScriptEngine.World.EventManager.OnScriptChangedEvent += changed;
|
||||
myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target;
|
||||
|
@ -148,7 +149,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
}
|
||||
|
||||
public void touch(uint localID, uint originalID, Vector3 offsetPos,
|
||||
IClientAPI remoteClient)
|
||||
IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
|
||||
{
|
||||
// Add to queue for all scripts in ObjectID object
|
||||
DetectParams[] det = new DetectParams[1];
|
||||
|
@ -172,6 +173,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID);
|
||||
det[0].LinkNum = originalPart.LinkNum;
|
||||
}
|
||||
if (surfaceArgs != null)
|
||||
{
|
||||
det[0].SurfaceTouchArgs = surfaceArgs;
|
||||
}
|
||||
|
||||
myScriptEngine.PostObjectEvent(localID, new EventParams(
|
||||
"touch", new Object[] { new LSL_Types.LSLInteger(1) },
|
||||
|
|
Loading…
Reference in New Issue