Refix bug where inventory textures don't appear in prim edit texture selection box

unless previously expanded in inventory.
afrisby
Justin Clarke Casey 2007-12-21 19:47:45 +00:00
parent 13f85c9d82
commit 42bc256e4f
4 changed files with 160 additions and 113 deletions

View File

@ -176,11 +176,14 @@ namespace OpenSim.Framework.Communications.Cache
public void HandleFetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, public void HandleFetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder) bool fetchFolders, bool fetchItems, int sortOrder)
{ {
// XXX We're not handling sortOrder yet!
InventoryFolderImpl fold = null; InventoryFolderImpl fold = null;
if (folderID == libraryRoot.folderID) if (folderID == libraryRoot.folderID)
{ {
remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, remoteClient.SendInventoryFolderDetails(
libraryRoot.RequestListOfItems(), libraryRoot.RequestListOfFolders(), libraryRoot.SubFoldersCount); libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems(),
libraryRoot.RequestListOfFolders(), fetchFolders, fetchItems);
return; return;
} }
@ -188,7 +191,9 @@ namespace OpenSim.Framework.Communications.Cache
if ((fold = libraryRoot.HasSubFolder(folderID)) != null) if ((fold = libraryRoot.HasSubFolder(folderID)) != null)
{ {
System.Console.WriteLine("fetching librarysubfolder"); System.Console.WriteLine("fetching librarysubfolder");
remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems(), fold.RequestListOfFolders(), fold.SubFoldersCount); remoteClient.SendInventoryFolderDetails(
libraryRoot.agentID, folderID, fold.RequestListOfItems(),
fold.RequestListOfFolders(), fetchFolders, fetchItems);
return; return;
} }
@ -203,15 +208,19 @@ namespace OpenSim.Framework.Communications.Cache
System.Console.Write("fetching root folder"); System.Console.Write("fetching root folder");
if (fetchItems) if (fetchItems)
{ {
remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, remoteClient.SendInventoryFolderDetails(
userProfile.RootFolder.RequestListOfItems(), userProfile.RootFolder.RequestListOfFolders(), userProfile.RootFolder.SubFoldersCount); remoteClient.AgentId, folderID, userProfile.RootFolder.RequestListOfItems(),
userProfile.RootFolder.RequestListOfFolders(),
fetchFolders, fetchItems);
} }
} }
else else
{ {
if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null) if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null)
{ {
remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, fold.RequestListOfItems(), fold.RequestListOfFolders(), fold.SubFoldersCount); remoteClient.SendInventoryFolderDetails(
remoteClient.AgentId, folderID, fold.RequestListOfItems(),
fold.RequestListOfFolders(), fetchFolders, fetchItems);
return; return;
} }
} }

View File

@ -540,7 +540,9 @@ namespace OpenSim.Framework
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity); LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity);
void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int subFoldersCount); void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items,
List<InventoryFolderBase> folders, bool fetchFolders,
bool fetchItems);
void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item);
/// <summary> /// <summary>

View File

@ -898,37 +898,46 @@ namespace OpenSim.Region.ClientStack
/// <summary> /// <summary>
/// Send information about the items contained in a folder to the client. /// Send information about the items contained in a folder to the client.
///
/// XXX This method needs some refactoring loving
/// </summary> /// </summary>
/// <param name="ownerID">The owner of the folder</param> /// <param name="ownerID">The owner of the folder</param>
/// <param name="folderID">The id of the folder</param> /// <param name="folderID">The id of the folder</param>
/// <param name="items">The items contained in the folder identified by folderID</param> /// <param name="items">The items contained in the folder identified by folderID</param>
/// <param name="subFoldersCount">The number of subfolders contained in the given folder. This is necessary since /// <param name="fetchFolders">Do we need to send folder information?</param>
/// the client is expecting inventory packets which incorporate this number into the descendents field, even though /// <param name="fetchItems">Do we need to send item information?</param>
/// we send back no details of the folders themselves (only the items).</param> public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items,
public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int subFoldersCount) List<InventoryFolderBase> folders,
bool fetchFolders, bool fetchItems)
{ {
Encoding enc = Encoding.ASCII; Encoding enc = Encoding.ASCII;
uint FULL_MASK_PERMISSIONS = 2147483647; uint FULL_MASK_PERMISSIONS = 2147483647;
if (fetchItems)
{
InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID); InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
int count = 0;
if (items.Count < 40) if (items.Count < 40)
{ {
descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count]; descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count];
// In the very first packet, also include the sub folders count so that the total descendents the descend.AgentData.Descendents = items.Count;
// 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 else
{ {
descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[40]; descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[40];
// In the very first packet, also include the sub folders count so that the total descendents the descend.AgentData.Descendents = 40;
// 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;
} }
// Even if we aren't fetching the folders, we still need to include the folder count
// in the total number of descendents. Failure to do so will cause subtle bugs such
// as the failure of textures which haven't been expanded in inventory to show up
// in the texture prim edit selection panel.
if (!fetchFolders)
{
descend.AgentData.Descendents += folders.Count;
}
int count = 0;
int i = 0; int i = 0;
foreach (InventoryItemBase item in items) foreach (InventoryItemBase item in items)
{ {
@ -988,12 +997,33 @@ namespace OpenSim.Region.ClientStack
{ {
OutPacket(descend, ThrottleOutPacketType.Asset); OutPacket(descend, ThrottleOutPacketType.Asset);
} }
}
//send subfolders //send subfolders
descend = CreateInventoryDescendentsPacket(ownerID, folderID); if (fetchFolders)
{
InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
if (folders.Count < 40)
{
descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count]; descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count];
i = 0; descend.AgentData.Descendents = folders.Count;
count = 0; }
else
{
descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[40];
descend.AgentData.Descendents = 40;
}
// Not sure if this scenario ever actually occurs, but nonetheless we include the items
// count even if we're not sending item data for the same reasons as above.
if (!fetchItems)
{
descend.AgentData.Descendents += items.Count;
}
int i = 0;
int count = 0;
foreach (InventoryFolderBase folder in folders) foreach (InventoryFolderBase folder in folders)
{ {
descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock(); descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock();
@ -1001,6 +1031,7 @@ namespace OpenSim.Region.ClientStack
descend.FolderData[i].Name = Helpers.StringToField(folder.name); descend.FolderData[i].Name = Helpers.StringToField(folder.name);
descend.FolderData[i].ParentID = folder.parentID; descend.FolderData[i].ParentID = folder.parentID;
descend.FolderData[i].Type = (sbyte)folder.type; descend.FolderData[i].Type = (sbyte)folder.type;
i++; i++;
count++; count++;
if (i == 40) if (i == 40)
@ -1012,7 +1043,7 @@ namespace OpenSim.Region.ClientStack
descend = CreateInventoryDescendentsPacket(ownerID, folderID); descend = CreateInventoryDescendentsPacket(ownerID, folderID);
if ((folders.Count - count) < 40) if ((folders.Count - count) < 40)
{ {
descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[items.Count - count]; descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count];
descend.AgentData.Descendents = folders.Count - count; descend.AgentData.Descendents = folders.Count - count;
} }
else else
@ -1030,6 +1061,7 @@ namespace OpenSim.Region.ClientStack
OutPacket(descend, ThrottleOutPacketType.Asset); OutPacket(descend, ThrottleOutPacketType.Asset);
} }
} }
}
private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID)
{ {

View File

@ -323,7 +323,11 @@ namespace SimpleApp
{ {
} }
public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int subFoldersCount) public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID,
List<InventoryItemBase> items,
List<InventoryFolderBase> folders,
bool fetchFolders,
bool fetchItems)
{ {
} }