This fixes HG attachments' missing assets (textures, etc).
Also, further improvements on HGUuidGatherer: if the assets are already in this grid don't fetch them again.connector_plugin
parent
b0da4b8d13
commit
21a6ef5bb6
|
@ -150,6 +150,34 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
if (m_Enabled)
|
||||
scene.RegisterModuleInterface<IUserAgentVerificationModule>(this);
|
||||
|
||||
scene.EventManager.OnIncomingSceneObject += OnIncomingSceneObject;
|
||||
}
|
||||
|
||||
void OnIncomingSceneObject(SceneObjectGroup so)
|
||||
{
|
||||
if (!so.IsAttachment)
|
||||
return;
|
||||
|
||||
if (so.Scene.UserManagementModule.IsLocalGridUser(so.AttachedAvatar))
|
||||
return;
|
||||
|
||||
// foreign user
|
||||
AgentCircuitData aCircuit = so.Scene.AuthenticateHandler.GetAgentCircuitData(so.AttachedAvatar);
|
||||
if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
|
||||
{
|
||||
if (aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI"))
|
||||
{
|
||||
string url = aCircuit.ServiceURLs["AssetServerURI"].ToString();
|
||||
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Incoming attachement {0} for HG user {1} with asset server {2}", so.Name, so.AttachedAvatar, url);
|
||||
Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
|
||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(so.Scene.AssetService, url);
|
||||
uuidGatherer.GatherAssetUuids(so, ids);
|
||||
|
||||
foreach (KeyValuePair<UUID, AssetType> kvp in ids)
|
||||
uuidGatherer.FetchAsset(kvp.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnNewClient(IClientAPI client)
|
||||
|
|
|
@ -377,6 +377,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
: base(assetService)
|
||||
{
|
||||
m_assetServerURL = assetServerURL;
|
||||
if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("="))
|
||||
m_assetServerURL = m_assetServerURL + "/";
|
||||
}
|
||||
|
||||
protected override AssetBase GetAsset(UUID uuid)
|
||||
|
@ -384,22 +386,27 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (string.Empty == m_assetServerURL)
|
||||
return base.GetAsset(uuid);
|
||||
else
|
||||
return FetchAsset(m_assetServerURL, uuid);
|
||||
return FetchAsset(uuid);
|
||||
}
|
||||
|
||||
public AssetBase FetchAsset(string url, UUID assetID)
|
||||
public AssetBase FetchAsset(UUID assetID)
|
||||
{
|
||||
if (!url.EndsWith("/") && !url.EndsWith("="))
|
||||
url = url + "/";
|
||||
|
||||
AssetBase asset = m_assetService.Get(url + assetID.ToString());
|
||||
|
||||
// Test if it's already here
|
||||
AssetBase asset = m_assetService.Get(assetID.ToString());
|
||||
if (asset == null)
|
||||
{
|
||||
// It's not, so fetch it from abroad
|
||||
asset = m_assetService.Get(m_assetServerURL + assetID.ToString());
|
||||
if (asset != null)
|
||||
{
|
||||
m_log.DebugFormat("[HGUUIDGatherer]: Copied asset {0} from {1} to local asset server. ", asset.ID, url);
|
||||
return asset;
|
||||
m_log.DebugFormat("[HGUUIDGatherer]: Copied asset {0} from {1} to local asset server", assetID, m_assetServerURL);
|
||||
else
|
||||
m_log.DebugFormat("[HGUUIDGatherer]: Failed to fetch asset {0} from {1}", assetID, m_assetServerURL);
|
||||
}
|
||||
return null;
|
||||
//else
|
||||
// m_log.DebugFormat("[HGUUIDGatherer]: Asset {0} from {1} was already here", assetID, m_assetServerURL);
|
||||
|
||||
return asset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue