From b167507e323a2f0162aa3106ab63d8cf2a5f57ae Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Fri, 30 Nov 2007 20:16:40 +0000 Subject: Patch for mantis 0000015: Textures don't display in the object properties window From Justin Casey (IBM) --- .../Communications/Cache/InventoryFolder.cs | 9 ++++++++- .../Communications/Cache/UserProfileCache.cs | 23 +++++++++++++++------- OpenSim/Framework/IClientAPI.cs | 2 +- OpenSim/Region/ClientStack/ClientView.cs | 22 ++++++++++++++++++--- .../Region/Examples/SimpleApp/MyNpcCharacter.cs | 2 +- 5 files changed, 45 insertions(+), 13 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs index 3495e55..6161c5a 100644 --- a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs +++ b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs @@ -36,6 +36,13 @@ namespace OpenSim.Framework.Communications.Cache public Dictionary Items = new Dictionary(); public Dictionary SubFolders = new Dictionary(); + // Accessors + public int SubFoldersCount + { + get { return SubFolders.Count; } + } + + // Constructors public InventoryFolderImpl(InventoryFolderBase folderbase) { agentID = folderbase.agentID; @@ -132,4 +139,4 @@ namespace OpenSim.Framework.Communications.Cache return itemList; } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs index 117ed36..379ac9d 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs @@ -111,6 +111,15 @@ namespace OpenSim.Framework.Communications.Cache } } + /// + /// Tell the client about the various child items and folders contained in the requested folder. + /// + /// + /// + /// + /// + /// + /// public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) { @@ -118,14 +127,14 @@ namespace OpenSim.Framework.Communications.Cache if (folderID == libraryRoot.folderID) { remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, - libraryRoot.RequestListOfItems()); + libraryRoot.RequestListOfItems(), libraryRoot.SubFoldersCount); return; } if ((fold = libraryRoot.HasSubFolder(folderID)) != null) { - remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems()); + remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems(), fold.SubFoldersCount); return; } @@ -140,16 +149,16 @@ namespace OpenSim.Framework.Communications.Cache if (fetchItems) { remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, - userProfile.RootFolder.RequestListOfItems()); + userProfile.RootFolder.RequestListOfItems(), userProfile.RootFolder.SubFoldersCount); } } else { InventoryFolderImpl folder = userProfile.RootFolder.HasSubFolder(folderID); - if ((folder != null) && fetchItems) + + if (fetchItems && folder != null) { - remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, - folder.RequestListOfItems()); + remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, folder.RequestListOfItems(), folder.SubFoldersCount); } } } @@ -184,4 +193,4 @@ namespace OpenSim.Framework.Communications.Cache m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); } } -} \ No newline at end of file +} diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 0068761..1427516 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -449,7 +449,7 @@ namespace OpenSim.Framework void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation,LLVector3 velocity, LLVector3 rotationalvelocity); - void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items); + void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items, int subFoldersCount); void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); void SendInventoryItemUpdate(InventoryItemBase Item); void SendRemoveInventoryItem(LLUUID itemID); diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 90002c3..86efac1 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -1031,7 +1031,16 @@ namespace OpenSim.Region.ClientStack OutPacket(kill, ThrottleOutPacketType.Task); } - public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items) + /// + /// Send information about the items contained in a folder to the client. + /// + /// The owner of the folder + /// The id of the folder + /// The items contained in the folder identified by folderID + /// The number of subfolders contained in the given folder. This is necessary since + /// the client is expecting inventory packets which incorporate this number into the descendents field, even though + /// we send back no details of the folders themselves (only the items). + public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items, int subFoldersCount) { Encoding enc = Encoding.ASCII; uint FULL_MASK_PERMISSIONS = 2147483647; @@ -1041,13 +1050,20 @@ namespace OpenSim.Region.ClientStack if (items.Count < 40) { descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count]; - descend.AgentData.Descendents = items.Count; + // In the very first packet, also include the sub folders count so that the total descendents the + // client receives matches its expectations. Subsequent inventory packets need contain only the count + // of the number of items actually in them. + descend.AgentData.Descendents = items.Count + subFoldersCount; } else { descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[40]; - descend.AgentData.Descendents = 40; + // In the very first packet, also include the sub folders count so that the total descendents the + // client receives matches its expectations. Subsequent inventory packets need contain only the count + // of the number of items actually in them. + descend.AgentData.Descendents = 40 + subFoldersCount; } + int i = 0; foreach (InventoryItemBase item in items) { diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 56316e6..77a287a 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs @@ -301,7 +301,7 @@ namespace SimpleApp { } - public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items) + public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items, int subFoldersCount) { } -- cgit v1.1