From 63c1b7e4754271ec898592ba6209dbc776469370 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 21 Apr 2011 18:12:29 +0100 Subject: Alter uuid gather so that it properly analyzes coalesced objects. This should correct save all the assets required for the items within the coalesced objects in an IAR. This should also correctly gather the items on hypergrid takes. --- .../CoalescedSceneObjectsSerializer.cs | 47 +++++++++++++--------- OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 18 +++++++-- 2 files changed, 43 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs index babcb54..55455cc 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs @@ -117,29 +117,40 @@ namespace OpenSim.Region.Framework.Scenes.Serialization { using (XmlTextReader reader = new XmlTextReader(sr)) { - reader.Read(); - if (reader.Name != "CoalescedObject") + try { -// m_log.DebugFormat( -// "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false", -// reader.Name); + reader.Read(); + if (reader.Name != "CoalescedObject") + { + // m_log.DebugFormat( + // "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false", + // reader.Name); + + return false; + } - return false; - } - - coa = new CoalescedSceneObjects(UUID.Zero); - reader.Read(); - - while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "CoalescedObject") - { - if (reader.Name == "SceneObjectGroup") + coa = new CoalescedSceneObjects(UUID.Zero); + reader.Read(); + + while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "CoalescedObject") { - string soXml = reader.ReadOuterXml(); - coa.Add(SceneObjectSerializer.FromOriginalXmlFormat(soXml)); + if (reader.Name == "SceneObjectGroup") + { + string soXml = reader.ReadOuterXml(); + coa.Add(SceneObjectSerializer.FromOriginalXmlFormat(soXml)); + } } + + reader.ReadEndElement(); // CoalescedObject } - - reader.ReadEndElement(); // CoalescedObject + catch (Exception e) + { + m_log.ErrorFormat( + "[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed with {0} {1}", + e.Message, e.StackTrace); + + return false; + } } } diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 83906d7..77b1535 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -298,10 +298,20 @@ namespace OpenSim.Region.Framework.Scenes if (null != objectAsset) { string xml = Utils.BytesToString(objectAsset.Data); - SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xml); - - if (null != sog) - GatherAssetUuids(sog, assetUuids); + + CoalescedSceneObjects coa; + if (CoalescedSceneObjectsSerializer.TryFromXml(xml, out coa)) + { + foreach (SceneObjectGroup sog in coa.Objects) + GatherAssetUuids(sog, assetUuids); + } + else + { + SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xml); + + if (null != sog) + GatherAssetUuids(sog, assetUuids); + } } } -- cgit v1.1 From e36cab99fddc4dca338386101d5c204e6de5d2c5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 21 Apr 2011 18:45:05 +0100 Subject: minor: small amount of method doc and some commented out odds and ends --- .../Framework/Scenes/SceneObjectGroup.Inventory.cs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index e8095c0..4bca3d0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs @@ -81,16 +81,20 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Add an inventory item to a prim in this group. + /// Add an inventory item from a user's inventory to a prim in this scene object. /// - /// - /// - /// + /// The client adding the item. + /// The local ID of the part receiving the add. + /// The user inventory item being added. /// The item UUID that should be used by the new item. /// public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, UUID copyItemID) { +// m_log.DebugFormat( +// "[PRIM INVENTORY]: Adding inventory item {0} from {1} to part with local ID {2}", +// item.Name, remoteClient.Name, localID); + UUID newItemId = (copyItemID != UUID.Zero) ? copyItemID : item.ID; SceneObjectPart part = GetChildPart(localID); @@ -132,15 +136,20 @@ namespace OpenSim.Region.Framework.Scenes taskItem.GroupPermissions = item.GroupPermissions; taskItem.NextPermissions = item.NextPermissions; } - + taskItem.Flags = item.Flags; + +// m_log.DebugFormat( +// "[PRIM INVENTORY]: Flags are 0x{0:X} for item {1} added to part {2} by {3}", +// taskItem.Flags, taskItem.Name, localID, remoteClient.Name); + // TODO: These are pending addition of those fields to TaskInventoryItem // taskItem.SalePrice = item.SalePrice; // taskItem.SaleType = item.SaleType; taskItem.CreationDate = (uint)item.CreationDate; bool addFromAllowedDrop = false; - if (remoteClient!=null) + if (remoteClient != null) { addFromAllowedDrop = remoteClient.AgentId != part.OwnerID; } -- cgit v1.1