From f7b28dd32155eac2d55ccf0757b059794d6b5f67 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 7 Sep 2010 03:41:29 +0100
Subject: If a scene object part UUID is changed (only possible when not in a
scene), then adjust the inventory items to point to the new uuid as well
---
OpenSim/Framework/TaskInventoryItem.cs | 10 +++++-----
.../Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | 2 +-
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 10 ++++++++--
OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 3 +++
4 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs
index 2cb7895..df5b936 100644
--- a/OpenSim/Framework/TaskInventoryItem.cs
+++ b/OpenSim/Framework/TaskInventoryItem.cs
@@ -348,15 +348,15 @@ namespace OpenSim.Framework
/// The new part ID to which this item belongs
public void ResetIDs(UUID partID)
{
- _oldID = _itemID;
- _itemID = UUID.Random();
- _parentPartID = partID;
- _parentID = partID;
+ OldItemID = ItemID;
+ ItemID = UUID.Random();
+ ParentPartID = partID;
+ ParentID = partID;
}
public TaskInventoryItem()
{
- _creationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
+ CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
}
}
}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 58698ee..32b3724 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -215,7 +215,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
public void TestLoadOarV0_2()
{
TestHelper.InMethod();
- //log4net.Config.XmlConfigurator.Configure();
+// log4net.Config.XmlConfigurator.Configure();
MemoryStream archiveWriteStream = new MemoryStream();
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 3ed74e1..3753dcb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -494,7 +494,14 @@ namespace OpenSim.Region.Framework.Scenes
public UUID UUID
{
get { return m_uuid; }
- set { m_uuid = value; }
+ set
+ {
+ m_uuid = value;
+
+ // This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part
+ if (Inventory != null)
+ Inventory.ResetInventoryIDs();
+ }
}
public uint LocalId
@@ -2756,7 +2763,6 @@ namespace OpenSim.Region.Framework.Scenes
UUID = UUID.Random();
LinkNum = linkNum;
LocalId = 0;
- Inventory.ResetInventoryIDs();
}
///
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index ca089a1..87c4860 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -119,6 +119,9 @@ namespace OpenSim.Region.Framework.Scenes
/// Link number for the part
public void ResetInventoryIDs()
{
+ if (null == m_part || null == m_part.ParentGroup)
+ return;
+
lock (m_items)
{
if (0 == m_items.Count)
--
cgit v1.1