From 3585b0a1392b7f9e93c4156d1d9fad224b4f187a Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 18 Aug 2013 02:59:10 +0100 Subject: [PATCH] Allow updating the wearable type of wearables that have a type of 0. This will allow viewers to fix broken wearables as they detect them. --- .../Framework/Scenes/Scene.Inventory.cs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 8e4e307f1f..c4b07a5dbb 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -416,6 +416,8 @@ namespace OpenSim.Region.Framework.Scenes // itemUpd.NextPermissions, itemUpd.GroupPermissions, itemUpd.EveryOnePermissions, item.Flags, // item.NextPermissions, item.GroupPermissions, item.EveryOnePermissions, item.CurrentPermissions); + bool sendUpdate = false; + if (itemUpd.NextPermissions != 0) // Use this to determine validity. Can never be 0 if valid { // Create a set of base permissions that will not include export if the user @@ -489,11 +491,13 @@ namespace OpenSim.Region.Framework.Scenes item.SalePrice = itemUpd.SalePrice; item.SaleType = itemUpd.SaleType; - InventoryService.UpdateItem(item); + if (item.InvType == (int)InventoryType.Wearable && (item.Flags & 0xf) == 0 && (itemUpd.Flags & 0xf) != 0) + { + item.Flags = (uint)(item.Flags & 0xfffffff0) | (itemUpd.Flags & 0xf); + sendUpdate = true; + } - // We cannot send out a bulk update here, since this will cause editing of clothing to start - // failing frequently. Possibly this is a race with a separate transaction that uploads the asset. -// remoteClient.SendBulkUpdateInventory(item); + InventoryService.UpdateItem(item); } if (UUID.Zero != transactionID) @@ -503,6 +507,14 @@ namespace OpenSim.Region.Framework.Scenes AgentTransactionsModule.HandleItemUpdateFromTransaction(remoteClient, transactionID, item); } } + else + { + // This MAY be problematic, if it is, another solution + // needs to be found. If inventory item flags are updated + // the viewer's notion of the item needs to be refreshed. + if (sendUpdate) + remoteClient.SendBulkUpdateInventory(item); + } } else {