From 9c0a03731d531430d5c2b8b43d2384c0dd086f88 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 2 Sep 2011 00:41:21 +0100 Subject: [PATCH] Move more of IAM.RezObject() into DoPreRezWhenFromItem() --- .../InventoryAccess/InventoryAccessModule.cs | 51 ++++++++++--------- .../Framework/Scenes/SceneObjectPart.cs | 5 +- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index e94d0593e0..f8515b49ae 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -719,26 +719,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess } SceneObjectGroup group = null; - UUID itemId = UUID.Zero; - - // If we have permission to copy then link the rezzed object back to the user inventory - // item that it came from. This allows us to enable 'save object to inventory' - if (!m_Scene.Permissions.BypassPermissions()) - { - if ((item.CurrentPermissions & (uint)PermissionMask.Copy) - == (uint)PermissionMask.Copy && (item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) - { - itemId = item.ID; - } - } - else - { - if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) - { - // Brave new fullperm world - itemId = item.ID; - } - } string xmlData = Utils.BytesToString(rezAsset.Data); List objlist = @@ -753,8 +733,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (e == null || attachment) // Single { SceneObjectGroup g = - SceneObjectSerializer.FromOriginalXmlFormat( - itemId, xmlData); + SceneObjectSerializer.FromOriginalXmlFormat(UUID.Zero, xmlData); + objlist.Add(g); veclist.Add(new Vector3(0, 0, 0)); @@ -783,8 +763,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess foreach (XmlNode n in groups) { SceneObjectGroup g = - SceneObjectSerializer.FromOriginalXmlFormat( - itemId, n.OuterXml); + SceneObjectSerializer.FromOriginalXmlFormat(UUID.Zero, n.OuterXml); + objlist.Add(g); XmlElement el = (XmlElement)n; @@ -893,6 +873,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess private bool DoPreRezWhenFromItem( IClientAPI remoteClient, InventoryItemBase item, List objlist, Vector3 pos, bool isAttachment) { + UUID fromUserInventoryItemId = UUID.Zero; + + // If we have permission to copy then link the rezzed object back to the user inventory + // item that it came from. This allows us to enable 'save object to inventory' + if (!m_Scene.Permissions.BypassPermissions()) + { + if ((item.CurrentPermissions & (uint)PermissionMask.Copy) + == (uint)PermissionMask.Copy && (item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) + { + fromUserInventoryItemId = item.ID; + } + } + else + { + if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) + { + // Brave new fullperm world + fromUserInventoryItemId = item.ID; + } + } + int primcount = 0; foreach (SceneObjectGroup g in objlist) primcount += g.PrimCount; @@ -958,6 +959,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess foreach (SceneObjectPart part in so.Parts) { + part.FromUserInventoryItemID = fromUserInventoryItemId; + if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a8f2ebd819..9d573dbd78 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -208,13 +208,12 @@ namespace OpenSim.Region.Framework.Scenes /// private UUID m_fromUserInventoryItemID; - public UUID FromUserInventoryItemID { get { return m_fromUserInventoryItemID; } + set { m_fromUserInventoryItemID = value; } } - - + public scriptEvents AggregateScriptEvents;