add error handling
parent
c35f8b3f1b
commit
61cb8c2e85
|
@ -107,53 +107,59 @@ namespace OpenSim.Modules.TextureFetcher
|
|||
|
||||
m_log.Info("[" + Name + "] Process part '" + part.Name + "'");
|
||||
|
||||
List<UUID> allTextures = new List<UUID>();
|
||||
List<TaskInventoryItem> inventoryItems = new List<TaskInventoryItem>();
|
||||
|
||||
//Get all Textures from the scene object
|
||||
Primitive.TextureEntry textures = part.Shape.Textures;
|
||||
int allSides = part.GetNumberOfSides();
|
||||
for (uint i = 0; i < allSides; i++)
|
||||
if (textures.FaceTextures[i] != null)
|
||||
allTextures.Add(textures.FaceTextures[i].TextureID);
|
||||
|
||||
|
||||
//Convert texture uuid list to inventar items.
|
||||
foreach (UUID texture in allTextures)
|
||||
try
|
||||
{
|
||||
if (texture != UUID.Zero)
|
||||
List<UUID> allTextures = new List<UUID>();
|
||||
List<TaskInventoryItem> inventoryItems = new List<TaskInventoryItem>();
|
||||
|
||||
//Get all Textures from the scene object
|
||||
Primitive.TextureEntry textures = part.Shape.Textures;
|
||||
int allSides = part.GetNumberOfSides();
|
||||
for (uint i = 0; i < allSides; i++)
|
||||
if (textures.FaceTextures[i] != null)
|
||||
allTextures.Add(textures.FaceTextures[i].TextureID);
|
||||
|
||||
|
||||
//Convert texture uuid list to inventar items.
|
||||
foreach (UUID texture in allTextures)
|
||||
{
|
||||
TaskInventoryItem item = new TaskInventoryItem();
|
||||
item.AssetID = texture;
|
||||
item.ItemID = UUID.Random();
|
||||
item.OwnerID = part.OwnerID;
|
||||
item.CurrentPermissions = 581639;
|
||||
item.Name = "tf-" + texture.ToString();
|
||||
item.Description = "This item was generated by the texture fetcher module.";
|
||||
item.OwnerID = part.OwnerID;
|
||||
item.CreatorID = part.OwnerID;
|
||||
item.LastOwnerID = part.OwnerID;
|
||||
inventoryItems.Add(item);
|
||||
if (texture != UUID.Zero)
|
||||
{
|
||||
TaskInventoryItem item = new TaskInventoryItem();
|
||||
item.AssetID = texture;
|
||||
item.ItemID = UUID.Random();
|
||||
item.OwnerID = part.OwnerID;
|
||||
item.CurrentPermissions = 581639;
|
||||
item.Name = "tf-" + texture.ToString();
|
||||
item.Description = "This item was generated by the texture fetcher module.";
|
||||
item.OwnerID = part.OwnerID;
|
||||
item.CreatorID = part.OwnerID;
|
||||
item.LastOwnerID = part.OwnerID;
|
||||
inventoryItems.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
//Check if the item is allready in the inventory and then add it.
|
||||
bool updateNeeded = false;
|
||||
foreach (TaskInventoryItem item in inventoryItems)
|
||||
{
|
||||
if (!isAssetInInventory(part, item.AssetID))
|
||||
{
|
||||
updateNeeded = true;
|
||||
part.Inventory.AddInventoryItem(item, false);
|
||||
m_log.Info("[" + Name + "] Add item '" + item.Name + "' to '" + part.Name + "'.");
|
||||
}
|
||||
}
|
||||
|
||||
if (updateNeeded == true)
|
||||
{
|
||||
part.SendFullUpdateToAllClients();
|
||||
}
|
||||
}
|
||||
|
||||
//Check if the item is allready in the inventory and then add it.
|
||||
bool updateNeeded = false;
|
||||
foreach (TaskInventoryItem item in inventoryItems)
|
||||
catch(Exception _error)
|
||||
{
|
||||
if(!isAssetInInventory(part, item.AssetID))
|
||||
{
|
||||
updateNeeded = true;
|
||||
part.Inventory.AddInventoryItem(item, false);
|
||||
m_log.Info("[" + Name + "] Add item '" + item.Name + "' to '" + part.Name + "'.");
|
||||
}
|
||||
m_log.Error("[" + Name + "] ERROR: " + _error.Message);
|
||||
}
|
||||
|
||||
if(updateNeeded == true)
|
||||
{
|
||||
part.SendFullUpdateToAllClients();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue