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)
|
||||
return;
|
||||
|
||||
if (Permissions.CanMoveObject(group, remoteClient))// && PermissionsMngr.)
|
||||
if (Permissions.CanMoveObject(group, remoteClient))
|
||||
{
|
||||
group.GrabMovement(objectID, offset, pos, remoteClient);
|
||||
}
|
||||
|
@ -359,16 +359,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
Vector3 grabOffset = pos - part.AbsolutePosition;
|
||||
// If the touched prim handles touches, deliver it
|
||||
if ((part.ScriptEvents & scriptEvents.touch) != 0)
|
||||
// EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
|
||||
EventManager.TriggerObjectGrabbing(part.LocalId, 0, grabOffset, 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.
|
||||
if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
|
||||
(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);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
if (m_rootPart.LocalId == localId)
|
||||
{
|
||||
if((RootPart.ScriptEvents & scriptEvents.anytouch) != 0)
|
||||
lastTouchTime = Util.GetTimeStampMS();
|
||||
OnGrabGroup(offsetPos, remoteClient);
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneObjectPart part = GetPart(localId);
|
||||
|
||||
if (((part.ScriptEvents & scriptEvents.anytouch) != 0) ||
|
||||
(part.PassTouches && (RootPart.ScriptEvents & scriptEvents.anytouch) != 0))
|
||||
lastTouchTime = Util.GetTimeStampMS();
|
||||
OnGrabPart(part, offsetPos, remoteClient);
|
||||
}
|
||||
}
|
||||
|
@ -3615,6 +3622,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false);
|
||||
}
|
||||
|
||||
double lastTouchTime = 0;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// If object is physical, apply force to move it around
|
||||
/// 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="pos">New position. We do the math here to turn it into a force</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))
|
||||
{
|
||||
|
@ -3650,24 +3661,31 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
||||
// a touch or pass may had become active ??
|
||||
if (((part.ScriptEvents & scriptEvents.anytouch) != 0) ||
|
||||
(part.PassTouches && (RootPart.ScriptEvents & scriptEvents.anytouch) != 0))
|
||||
{
|
||||
lastTouchTime = now;
|
||||
return;
|
||||
}
|
||||
|
||||
lastTouchTime = 0;
|
||||
UpdateGroupPosition(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply possition for grabbing non-physical linksets (Ctrl+Drag)
|
||||
/// This MUST be blocked for linksets that contain touch scripts because the viewer triggers grab on the touch
|
||||
/// 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)
|
||||
UpdateGroupPosition(pos);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If object is physical, prepare for spinning torques (set flag to save old orientation)
|
||||
/// </summary>
|
||||
|
|
|
@ -1091,7 +1091,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_part.ParentGroup.InvalidateDeepEffectivePerms();
|
||||
|
||||
m_inventorySerial++;
|
||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||
|
||||
HasInventoryChanged = true;
|
||||
m_part.ParentGroup.HasGroupChanged = true;
|
||||
|
@ -1113,8 +1112,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_part.RemFlag(PrimFlags.Scripted);
|
||||
}
|
||||
|
||||
m_part.ScheduleFullUpdate();
|
||||
if (type == (int)InventoryType.LSL)
|
||||
m_part.aggregateScriptEvents(); // this also does full update
|
||||
else
|
||||
m_part.ScheduleFullUpdate();
|
||||
|
||||
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
|
||||
return type;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue