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.
bulletsim
Justin Clark-Casey (justincc) 2011-05-14 00:10:27 +01:00
parent 59d8588ae1
commit 5573fcfa93
1 changed files with 27 additions and 18 deletions

View File

@ -924,9 +924,9 @@ namespace OpenSim.Region.Framework.Scenes
uint callbackID, string description, string name, uint callbackID, string description, string name,
sbyte invType, sbyte type, UUID olditemID) sbyte invType, sbyte type, UUID olditemID)
{ {
m_log.DebugFormat( // m_log.DebugFormat(
"[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}", // "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}",
remoteClient.Name, name, folderID, olditemID); // remoteClient.Name, name, folderID, olditemID);
if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId))
return; return;
@ -934,20 +934,25 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence presence; ScenePresence presence;
if (TryGetScenePresence(remoteClient.AgentId, out presence)) if (TryGetScenePresence(remoteClient.AgentId, out presence))
{ {
bool linkAlreadyExists = false; // Disabled the check for duplicate links.
List<InventoryItemBase> existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID); //
foreach (InventoryItemBase item in existingItems) // When outfits are being adjusted, the viewer rapidly sends delete link messages followed by
if (item.AssetID == olditemID) // create links. However, since these are handled asynchronously, the deletes do not complete before
linkAlreadyExists = true; // the creates are handled. Therefore, we cannot enforce a duplicate link check.
// InventoryItemBase existingLink = null;
if (linkAlreadyExists) // List<InventoryItemBase> existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID);
{ // foreach (InventoryItemBase item in existingItems)
m_log.WarnFormat( // if (item.AssetID == olditemID)
"[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link already exists", // existingLink = item;
remoteClient.Name, name, folderID, olditemID); //
// if (existingLink != null)
return; // {
} // 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(); AssetBase asset = new AssetBase();
asset.FullID = olditemID; asset.FullID = olditemID;
@ -975,7 +980,11 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="itemID"></param> /// <param name="itemID"></param>
private void RemoveInventoryItem(IClientAPI remoteClient, List<UUID> itemIDs) private void RemoveInventoryItem(IClientAPI remoteClient, List<UUID> itemIDs)
{ {
//m_log.Debug("[SCENE INVENTORY]: user " + remoteClient.AgentId); // m_log.DebugFormat(
// "[AGENT INVENTORY]: Removing inventory items {0} for {1}",
// string.Join(",", itemIDs.ConvertAll<string>(uuid => uuid.ToString()).ToArray()),
// remoteClient.Name);
InventoryService.DeleteItems(remoteClient.AgentId, itemIDs); InventoryService.DeleteItems(remoteClient.AgentId, itemIDs);
} }