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

viewer-2-initial-appearance
Justin Clark-Casey (justincc) 2010-09-07 03:41:29 +01:00
parent 84ad9e4d4e
commit f7b28dd321
4 changed files with 17 additions and 8 deletions

View File

@ -348,15 +348,15 @@ namespace OpenSim.Framework
/// <param name="partID">The new part ID to which this item belongs</param>
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;
}
}
}

View File

@ -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);

View File

@ -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();
}
/// <summary>

View File

@ -119,6 +119,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="linkNum">Link number for the part</param>
public void ResetInventoryIDs()
{
if (null == m_part || null == m_part.ParentGroup)
return;
lock (m_items)
{
if (0 == m_items.Count)