JustinCC is evil. f7b28dd3 broke script persistence. This fixes it.

viewer-2-initial-appearance
root 2010-09-16 23:12:32 +02:00 committed by Melanie
parent f5e3d5a33a
commit 1b2edfe75f
4 changed files with 40 additions and 1 deletions

View File

@ -57,6 +57,15 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="linkNum">Link number for the part</param>
void ResetInventoryIDs();
/// <summary>
/// Reset parent object UUID for all the items in the prim's inventory.
/// </summary>
///
/// If this method is called and there are inventory items, then we regard the inventory as having changed.
///
/// <param name="linkNum">Link number for the part</param>
void ResetObjectID();
/// <summary>
/// Change every item in this inventory to a new owner.
/// </summary>

View File

@ -511,6 +511,7 @@ namespace OpenSim.Region.Framework.Scenes
if (node.Attributes["UUID"] != null)
{
UUID itemid = new UUID(node.Attributes["UUID"].Value);
m_log.DebugFormat("[SCRIPT STATE]: Adding state for oldID {0}", itemid);
m_savedScriptState.Add(itemid, node.InnerXml);
}
}

View File

@ -500,7 +500,7 @@ namespace OpenSim.Region.Framework.Scenes
// This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part
if (Inventory != null)
Inventory.ResetInventoryIDs();
Inventory.ResetObjectID();
}
}
@ -2763,6 +2763,7 @@ namespace OpenSim.Region.Framework.Scenes
UUID = UUID.Random();
LinkNum = linkNum;
LocalId = 0;
Inventory.ResetInventoryIDs();
}
/// <summary>

View File

@ -140,6 +140,34 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void ResetObjectID()
{
m_items.LockItemsForWrite(true);
if (Items.Count == 0)
{
m_items.LockItemsForWrite(false);
return;
}
HasInventoryChanged = true;
if (m_part.ParentGroup != null)
{
m_part.ParentGroup.HasGroupChanged = true;
}
IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values);
Items.Clear();
foreach (TaskInventoryItem item in items)
{
item.ParentPartID = m_part.UUID;
item.ParentID = m_part.UUID;
Items.Add(item.ItemID, item);
}
m_items.LockItemsForWrite(false);
}
/// <summary>
/// Change every item in this inventory to a new owner.
/// </summary>