From 4b6c3fd4bb8e4c989a7f0b4c0687379ea4bc63c1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 26 Jun 2012 21:06:47 +0100 Subject: If crossing attachments into another region pre-fatpack, clone objects before changing properties to avoid hud display race condition with update threads. This matches behaviour in fatpack crossing, where attachments are cloned before their properties are changed. This only applies to crossings to simulators running code released before April 2011. --- .../EntityTransfer/EntityTransferModule.cs | 43 +++++++++++++--------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs') diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 7d82060..f5ebe97 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1666,6 +1666,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer #endregion #region Object Transfers + /// /// Move the given scene object into a new region depending on which region its absolute position has moved /// into. @@ -1967,35 +1968,43 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer return successYN; } - protected bool CrossAttachmentsIntoNewRegion(GridRegion destination, ScenePresence sp, bool silent) + /// + /// Cross the attachments for an avatar into the destination region. + /// + /// + /// This is only invoked for simulators released prior to April 2011. Versions of OpenSimulator since then + /// transfer attachments in one go as part of the ChildAgentDataUpdate data passed in the update agent call. + /// + /// + /// + /// + protected void CrossAttachmentsIntoNewRegion(GridRegion destination, ScenePresence sp, bool silent) { - List m_attachments = sp.GetAttachments(); + List attachments = sp.GetAttachments(); - // Validate -// foreach (SceneObjectGroup gobj in m_attachments) -// { -// if (gobj == null || gobj.IsDeleted) -// return false; -// } +// m_log.DebugFormat( +// "[ENTITY TRANSFER MODULE]: Crossing {0} attachments into {1} for {2}", +// m_attachments.Count, destination.RegionName, sp.Name); - foreach (SceneObjectGroup gobj in m_attachments) + foreach (SceneObjectGroup gobj in attachments) { // If the prim group is null then something must have happened to it! if (gobj != null && !gobj.IsDeleted) { - // Set the parent localID to 0 so it transfers over properly. - gobj.RootPart.SetParentLocalId(0); - gobj.AbsolutePosition = gobj.RootPart.AttachedPos; - gobj.IsAttachment = false; + SceneObjectGroup clone = (SceneObjectGroup)gobj.CloneForNewScene(); + clone.RootPart.GroupPosition = gobj.RootPart.AttachedPos; + clone.IsAttachment = false; + //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); - m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName); - CrossPrimGroupIntoNewRegion(destination, Vector3.Zero, gobj, silent); + m_log.DebugFormat( + "[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", + clone.UUID, destination.RegionName); + + CrossPrimGroupIntoNewRegion(destination, Vector3.Zero, clone, silent); } } sp.ClearAttachments(); - - return true; } #endregion -- cgit v1.1