diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 1992bd4ea8..4fac01f436 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -245,7 +245,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments objatt.HasGroupChanged = true; if (doc != null) + { objatt.LoadScriptState(doc); + objatt.ResetOwnerChangeFlag(); + } // Fire after attach, so we don't get messy perms dialogs // 3 == AttachedRez diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 1c6f2d183d..ff471e045b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3931,5 +3931,13 @@ namespace OpenSim.Region.Framework.Scenes return priority; } + + public void ResetOwnerChangeFlag() + { + ForEachPart(delegate(SceneObjectPart part) + { + part.ResetOwnerChangeFlag(); + }); + } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4b2641c7e3..48e65a59e1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4683,5 +4683,17 @@ namespace OpenSim.Region.Framework.Scenes { return new Color4((byte)Color.R, (byte)Color.G, (byte)Color.B, (byte)(0xFF - Color.A)); } + + public void ResetOwnerChangeFlag() + { + List inv = Inventory.GetInventoryList(); + + foreach (UUID itemID in inv) + { + TaskInventoryItem item = Inventory.GetInventoryItem(itemID); + item.OwnerChanged = false; + Inventory.UpdateInventoryItem(item); + } + } } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index ceb43956e2..562232ce99 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4011,15 +4011,24 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos); { string xmlData; XmlDocument d = new XmlDocument(); + UUID asset; if (itemData.TryGetValue(itemID, out xmlData)) { d.LoadXml(xmlData); m_log.InfoFormat("[ATTACHMENT]: Found saved state for item {0}, loading it", itemID); - } - // Rez from inventory - UUID asset - = m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p, true, d); + // Rez from inventory + asset + = m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p, true, d); + + } + else + { + // Rez from inventory (with a null doc to let + // CHANGED_OWNER happen) + asset + = m_scene.AttachmentsModule.RezSingleAttachmentFromInventory(ControllingClient, itemID, (uint)p, true, null); + } m_log.InfoFormat( "[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})",