From 472f7844f5852a778a70771142d6c6a2ab7b894a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 14 May 2011 00:10:27 +0100 Subject: [PATCH] Fix adding/removing/replacing outfits in viewer 2 To get this to work, I had to disable the dupe link check I put in a couple of commits ago. When the viewer adds wearables to an existing outfit, it first requests deletes of all the existing links before creating a new set. Since these messages are async, the creates were being received before the deletes had a chance to complete, resulting in missing current outfit links. However, the dupe check shouldn't be as important now that broken links have been fixed - it was the broken links that were causing the client to create dupes. Tested on kokua 0.1.0 WIP and SL 2.6.3. I now have no problems managing outfits on my standalone. --- .../Framework/Scenes/Scene.Inventory.cs | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 3bf2c2b61e..e242010120 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -924,9 +924,9 @@ namespace OpenSim.Region.Framework.Scenes uint callbackID, string description, string name, sbyte invType, sbyte type, UUID olditemID) { - m_log.DebugFormat( - "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}", - remoteClient.Name, name, folderID, olditemID); +// m_log.DebugFormat( +// "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}", +// remoteClient.Name, name, folderID, olditemID); if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) return; @@ -934,20 +934,25 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence presence; if (TryGetScenePresence(remoteClient.AgentId, out presence)) { - bool linkAlreadyExists = false; - List existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID); - foreach (InventoryItemBase item in existingItems) - if (item.AssetID == olditemID) - linkAlreadyExists = true; - - if (linkAlreadyExists) - { - m_log.WarnFormat( - "[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link already exists", - remoteClient.Name, name, folderID, olditemID); - - return; - } + // Disabled the check for duplicate links. + // + // When outfits are being adjusted, the viewer rapidly sends delete link messages followed by + // create links. However, since these are handled asynchronously, the deletes do not complete before + // the creates are handled. Therefore, we cannot enforce a duplicate link check. +// InventoryItemBase existingLink = null; +// List existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID); +// foreach (InventoryItemBase item in existingItems) +// if (item.AssetID == olditemID) +// existingLink = item; +// +// if (existingLink != null) +// { +// m_log.WarnFormat( +// "[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link named {4} with id {5} already exists", +// remoteClient.Name, name, folderID, olditemID, existingLink.Name, existingLink.ID); +// +// return; +// } AssetBase asset = new AssetBase(); asset.FullID = olditemID; @@ -975,7 +980,11 @@ namespace OpenSim.Region.Framework.Scenes /// private void RemoveInventoryItem(IClientAPI remoteClient, List itemIDs) { - //m_log.Debug("[SCENE INVENTORY]: user " + remoteClient.AgentId); +// m_log.DebugFormat( +// "[AGENT INVENTORY]: Removing inventory items {0} for {1}", +// string.Join(",", itemIDs.ConvertAll(uuid => uuid.ToString()).ToArray()), +// remoteClient.Name); + InventoryService.DeleteItems(remoteClient.AgentId, itemIDs); }