From af8d53657d581404e4719a4f2e75eff3c56f524a Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 9 Dec 2012 22:05:12 -0800 Subject: [PATCH] HGAssetMapper: Get wasn't really working. It's true that some assets are copied in the process of being gathered their UUID, but not all. Specifically, terminal assets like textures aren't copied. We have to go one more time through the ids. --- .../InventoryAccess/HGAssetMapper.cs | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index f8ec6de85d..7871eda5b6 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs @@ -71,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess #region Internal functions - public AssetMetadata FetchMetadata(string url, UUID assetID) + private AssetMetadata FetchMetadata(string url, UUID assetID) { if (!url.EndsWith("/") && !url.EndsWith("=")) url = url + "/"; @@ -86,6 +86,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess return meta; } + private AssetBase FetchAsset(string url, UUID assetID) + { + // Test if it's already here + AssetBase asset = m_scene.AssetService.Get(assetID.ToString()); + if (asset == null) + { + if (!url.EndsWith("/") && !url.EndsWith("=")) + url = url + "/"; + + asset = m_scene.AssetService.Get(url + assetID.ToString()); + + //if (asset != null) + // m_log.DebugFormat("[HG ASSET MAPPER]: Fetched asset {0} of type {1} from {2} ", assetID, asset.Metadata.Type, url); + //else + // m_log.DebugFormat("[HG ASSET MAPPER]: Unable to fetch asset {0} from {1} ", assetID, url); + + } + + return asset; + } + public bool PostAsset(string url, AssetBase asset) { if (asset != null) @@ -228,11 +249,22 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (meta == null) return; - // The act of gathering UUIDs downloads the assets from the remote server + // The act of gathering UUIDs downloads some assets from the remote server + // but not all... Dictionary ids = new Dictionary(); HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, userAssetURL); uuidGatherer.GatherAssetUuids(assetID, (AssetType)meta.Type, ids); + m_log.DebugFormat("[HG ASSET MAPPER]: Preparing to get {0} assets", ids.Count); + bool success = true; + foreach (UUID uuid in ids.Keys) + if (FetchAsset(userAssetURL, uuid) == null) + success = false; + // maybe all pieces got here... + if (!success) + m_log.DebugFormat("[HG ASSET MAPPER]: Problems getting item {0} from asset server {1}", assetID, userAssetURL); + else + m_log.DebugFormat("[HG ASSET MAPPER]: Successfully got item {0} from asset server {1}", assetID, userAssetURL); }