mantis8569: do aggregate script events when a script is deleted; block nonphysical drag if a touch event is triggered, add a time guard on that
parent
6359874d64
commit
618c6ceda5
|
@ -341,7 +341,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if(group == null || group.IsDeleted)
|
if(group == null || group.IsDeleted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.)
|
if (Permissions.CanMoveObject(group, remoteClient))
|
||||||
{
|
{
|
||||||
group.GrabMovement(objectID, offset, pos, remoteClient);
|
group.GrabMovement(objectID, offset, pos, remoteClient);
|
||||||
}
|
}
|
||||||
|
@ -359,17 +359,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Vector3 grabOffset = pos - part.AbsolutePosition;
|
Vector3 grabOffset = pos - part.AbsolutePosition;
|
||||||
// If the touched prim handles touches, deliver it
|
// If the touched prim handles touches, deliver it
|
||||||
if ((part.ScriptEvents & scriptEvents.touch) != 0)
|
if ((part.ScriptEvents & scriptEvents.touch) != 0)
|
||||||
// EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
|
|
||||||
EventManager.TriggerObjectGrabbing(part.LocalId, 0, grabOffset, remoteClient, surfaceArg);
|
EventManager.TriggerObjectGrabbing(part.LocalId, 0, grabOffset, remoteClient, surfaceArg);
|
||||||
|
|
||||||
// Deliver to the root prim if the touched prim doesn't handle touches
|
// Deliver to the root prim if the touched prim doesn't handle touches
|
||||||
// or if we're meant to pass on touches anyway.
|
// or if we're meant to pass on touches anyway.
|
||||||
if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
|
if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
|
||||||
(part.PassTouches && (part.LocalId != group.RootPart.LocalId)))
|
(part.PassTouches && (part.LocalId != group.RootPart.LocalId)))
|
||||||
{
|
|
||||||
// EventManager.TriggerObjectGrabbing(group.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
|
|
||||||
EventManager.TriggerObjectGrabbing(group.RootPart.LocalId, part.LocalId, grabOffset, remoteClient, surfaceArg);
|
EventManager.TriggerObjectGrabbing(group.RootPart.LocalId, part.LocalId, grabOffset, remoteClient, surfaceArg);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
|
public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2086,13 +2086,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void ObjectGrabHandler(uint localId, Vector3 offsetPos, IClientAPI remoteClient)
|
public void ObjectGrabHandler(uint localId, Vector3 offsetPos, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (m_rootPart.LocalId == localId)
|
if (m_rootPart.LocalId == localId)
|
||||||
{
|
{
|
||||||
|
if((RootPart.ScriptEvents & scriptEvents.anytouch) != 0)
|
||||||
|
lastTouchTime = Util.GetTimeStampMS();
|
||||||
OnGrabGroup(offsetPos, remoteClient);
|
OnGrabGroup(offsetPos, remoteClient);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SceneObjectPart part = GetPart(localId);
|
SceneObjectPart part = GetPart(localId);
|
||||||
|
|
||||||
|
if (((part.ScriptEvents & scriptEvents.anytouch) != 0) ||
|
||||||
|
(part.PassTouches && (RootPart.ScriptEvents & scriptEvents.anytouch) != 0))
|
||||||
|
lastTouchTime = Util.GetTimeStampMS();
|
||||||
OnGrabPart(part, offsetPos, remoteClient);
|
OnGrabPart(part, offsetPos, remoteClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3615,6 +3622,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false);
|
// part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double lastTouchTime = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If object is physical, apply force to move it around
|
/// If object is physical, apply force to move it around
|
||||||
/// If object is not physical, just put it at the resulting location
|
/// If object is not physical, just put it at the resulting location
|
||||||
|
@ -3623,7 +3634,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="offset">Always seems to be 0,0,0, so ignoring</param>
|
/// <param name="offset">Always seems to be 0,0,0, so ignoring</param>
|
||||||
/// <param name="pos">New position. We do the math here to turn it into a force</param>
|
/// <param name="pos">New position. We do the math here to turn it into a force</param>
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
public void GrabMovement(UUID partID, Vector3 offset, Vector3 pos, IClientAPI remoteClient)
|
public void GrabMovement(UUID partID, Vector3 offset, Vector3 pos, IClientAPI remoteClienth)
|
||||||
{
|
{
|
||||||
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
|
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
|
||||||
{
|
{
|
||||||
|
@ -3650,23 +3661,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NonPhysicalGrabMovement(pos);
|
if(IsAttachment)
|
||||||
}
|
return;
|
||||||
}
|
|
||||||
|
// block movement if there was a touch at start
|
||||||
|
double now = Util.GetTimeStampMS();
|
||||||
|
if (now - lastTouchTime < 250)
|
||||||
|
{
|
||||||
|
lastTouchTime = now;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// a touch or pass may had become active ??
|
||||||
/// Apply possition for grabbing non-physical linksets (Ctrl+Drag)
|
if (((part.ScriptEvents & scriptEvents.anytouch) != 0) ||
|
||||||
/// This MUST be blocked for linksets that contain touch scripts because the viewer triggers grab on the touch
|
(part.PassTouches && (RootPart.ScriptEvents & scriptEvents.anytouch) != 0))
|
||||||
/// event (Viewer Bug?) This would allow anyone to drag a linkset with a touch script. SL behaviour is also to
|
|
||||||
/// block grab on prims with touch events.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="pos">New Position</param>
|
|
||||||
public void NonPhysicalGrabMovement(Vector3 pos)
|
|
||||||
{
|
{
|
||||||
if(!IsAttachment && ScriptCount() == 0)
|
lastTouchTime = now;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastTouchTime = 0;
|
||||||
UpdateGroupPosition(pos);
|
UpdateGroupPosition(pos);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If object is physical, prepare for spinning torques (set flag to save old orientation)
|
/// If object is physical, prepare for spinning torques (set flag to save old orientation)
|
||||||
|
|
|
@ -1091,7 +1091,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_part.ParentGroup.InvalidateDeepEffectivePerms();
|
m_part.ParentGroup.InvalidateDeepEffectivePerms();
|
||||||
|
|
||||||
m_inventorySerial++;
|
m_inventorySerial++;
|
||||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
|
||||||
|
|
||||||
HasInventoryChanged = true;
|
HasInventoryChanged = true;
|
||||||
m_part.ParentGroup.HasGroupChanged = true;
|
m_part.ParentGroup.HasGroupChanged = true;
|
||||||
|
@ -1113,8 +1112,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_part.RemFlag(PrimFlags.Scripted);
|
m_part.RemFlag(PrimFlags.Scripted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type == (int)InventoryType.LSL)
|
||||||
|
m_part.aggregateScriptEvents(); // this also does full update
|
||||||
|
else
|
||||||
m_part.ScheduleFullUpdate();
|
m_part.ScheduleFullUpdate();
|
||||||
|
|
||||||
|
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue