diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 299509100f..b0ecb80578 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -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 surfaceArgs) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index c0bafc55ff..dcfe79b66e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -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; + + + /// /// 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 /// Always seems to be 0,0,0, so ignoring /// New position. We do the math here to turn it into a force /// - 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); } } } - /// - /// 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. - /// - /// New Position - public void NonPhysicalGrabMovement(Vector3 pos) - { - if(!IsAttachment && ScriptCount() == 0) - UpdateGroupPosition(pos); - } - /// /// If object is physical, prepare for spinning torques (set flag to save old orientation) /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index a0f895933f..1ba74f4a0a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -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