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> /// <param name="partID">The new part ID to which this item belongs</param>
public void ResetIDs(UUID partID) public void ResetIDs(UUID partID)
{ {
_oldID = _itemID; OldItemID = ItemID;
_itemID = UUID.Random(); ItemID = UUID.Random();
_parentPartID = partID; ParentPartID = partID;
_parentID = partID; ParentID = partID;
} }
public TaskInventoryItem() public TaskInventoryItem()
{ {
_creationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
} }
} }
} }

View File

@ -494,7 +494,14 @@ namespace OpenSim.Region.Framework.Scenes
public UUID UUID public UUID UUID
{ {
get { return m_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 public uint LocalId
@ -2756,7 +2763,6 @@ namespace OpenSim.Region.Framework.Scenes
UUID = UUID.Random(); UUID = UUID.Random();
LinkNum = linkNum; LinkNum = linkNum;
LocalId = 0; LocalId = 0;
Inventory.ResetInventoryIDs();
} }
/// <summary> /// <summary>

View File

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