* refactor: break out archiver's combined sync-async asset request routine ready for analysis of inventory item types other than objects
parent
35bd6e8760
commit
e1782bc249
|
@ -83,6 +83,35 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get an asset synchronously, potentially using an asynchronous callback. If the
|
||||||
|
/// asynchronous callback is used, we will wait for it to complete.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uuid"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected AssetBase GetAsset(LLUUID uuid)
|
||||||
|
{
|
||||||
|
m_waitingForObjectAsset = true;
|
||||||
|
m_scene.AssetCache.GetAsset(uuid, AssetRequestCallback, true);
|
||||||
|
|
||||||
|
// The asset cache callback can either
|
||||||
|
//
|
||||||
|
// 1. Complete on the same thread (if the asset is already in the cache) or
|
||||||
|
// 2. Come in via a different thread (if we need to go fetch it).
|
||||||
|
//
|
||||||
|
// The code below handles both these alternatives.
|
||||||
|
lock (this)
|
||||||
|
{
|
||||||
|
if (m_waitingForObjectAsset)
|
||||||
|
{
|
||||||
|
Monitor.Wait(this);
|
||||||
|
m_waitingForObjectAsset = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_requestedObjectAsset;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get all the asset uuids associated with a given object. This includes both those directly associated with
|
/// Get all the asset uuids associated with a given object. This includes both those directly associated with
|
||||||
/// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained
|
/// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained
|
||||||
|
@ -116,44 +145,27 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
assetUuids[texture.TextureID] = 1;
|
assetUuids[texture.TextureID] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (TaskInventoryItem tii in part.TaskInventory.Values)
|
foreach (TaskInventoryItem tii in part.TaskInventory.Values)
|
||||||
{
|
{
|
||||||
if (!assetUuids.ContainsKey(tii.AssetID))
|
if (!assetUuids.ContainsKey(tii.AssetID))
|
||||||
{
|
{
|
||||||
assetUuids[tii.AssetID] = 1;
|
assetUuids[tii.AssetID] = 1;
|
||||||
|
|
||||||
if (tii.Type != (int)InventoryType.Object)
|
if ((int)InventoryType.Object == tii.Type)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[ARCHIVER]: Recording asset {0} in object {1}", tii.AssetID, part.UUID);
|
AssetBase objectAsset = GetAsset(tii.AssetID);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_waitingForObjectAsset = true;
|
|
||||||
m_scene.AssetCache.GetAsset(tii.AssetID, AssetRequestCallback, true);
|
|
||||||
|
|
||||||
// The asset cache callback can either
|
if (null != objectAsset)
|
||||||
//
|
|
||||||
// 1. Complete on the same thread (if the asset is already in the cache) or
|
|
||||||
// 2. Come in via a different thread (if we need to go fetch it).
|
|
||||||
//
|
|
||||||
// The code below handles both these alternatives.
|
|
||||||
lock (this)
|
|
||||||
{
|
{
|
||||||
if (m_waitingForObjectAsset)
|
string xml = Helpers.FieldToUTF8String(objectAsset.Data);
|
||||||
{
|
|
||||||
Monitor.Wait(this);
|
|
||||||
m_waitingForObjectAsset = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null != m_requestedObjectAsset)
|
|
||||||
{
|
|
||||||
string xml = Helpers.FieldToUTF8String(m_requestedObjectAsset.Data);
|
|
||||||
SceneObjectGroup sog = new SceneObjectGroup(m_scene, m_scene.RegionInfo.RegionHandle, xml);
|
SceneObjectGroup sog = new SceneObjectGroup(m_scene, m_scene.RegionInfo.RegionHandle, xml);
|
||||||
GetSceneObjectAssetUuids(sog, assetUuids);
|
GetSceneObjectAssetUuids(sog, assetUuids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[ARCHIVER]: Recording asset {0} in object {1}", tii.AssetID, part.UUID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue