* Fixes http://opensimulator.org/mantis/view.php?id=3959 * Allows for viewing inventory textures outside home gridprioritization
parent
bf68dad643
commit
c0beeb929e
|
@ -31,6 +31,7 @@ using OpenMetaverse;
|
||||||
using OpenMetaverse.Imaging;
|
using OpenMetaverse.Imaging;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Region.Framework.Scenes.Hypergrid;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using log4net;
|
using log4net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
@ -54,6 +55,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
public UUID TextureID;
|
public UUID TextureID;
|
||||||
public IJ2KDecoder J2KDecoder;
|
public IJ2KDecoder J2KDecoder;
|
||||||
public IAssetService AssetService;
|
public IAssetService AssetService;
|
||||||
|
public UUID AgentID;
|
||||||
|
public IHyperAssetService HyperAssets;
|
||||||
public OpenJPEG.J2KLayerInfo[] Layers;
|
public OpenJPEG.J2KLayerInfo[] Layers;
|
||||||
public bool IsDecoded;
|
public bool IsDecoded;
|
||||||
public bool HasAsset;
|
public bool HasAsset;
|
||||||
|
@ -370,6 +373,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
UUID assetID = UUID.Zero;
|
UUID assetID = UUID.Zero;
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
assetID = asset.FullID;
|
assetID = asset.FullID;
|
||||||
|
else if (HyperAssets != null)
|
||||||
|
{
|
||||||
|
// Try the user's inventory, but only if it's different from the regions'
|
||||||
|
string userAssets = HyperAssets.GetUserAssetServer(AgentID);
|
||||||
|
if ((userAssets != string.Empty) && (userAssets != HyperAssets.GetSimAssetServer()))
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id);
|
||||||
|
AssetService.Get(userAssets + "/" + id, this, AssetReceived);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AssetDataCallback(assetID, asset);
|
AssetDataCallback(assetID, asset);
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Framework.Statistics;
|
using OpenSim.Framework.Statistics;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Region.Framework.Scenes.Hypergrid;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using Timer=System.Timers.Timer;
|
using Timer=System.Timers.Timer;
|
||||||
using AssetLandmark = OpenSim.Framework.AssetLandmark;
|
using AssetLandmark = OpenSim.Framework.AssetLandmark;
|
||||||
|
@ -117,6 +118,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
protected int m_packetMTU = 1400;
|
protected int m_packetMTU = 1400;
|
||||||
protected IAssetService m_assetService;
|
protected IAssetService m_assetService;
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
public UUID SecureSessionId { get { return m_secureSessionId; } }
|
public UUID SecureSessionId { get { return m_secureSessionId; } }
|
||||||
|
@ -7013,7 +7015,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
//handlerTextureRequest = null;
|
//handlerTextureRequest = null;
|
||||||
|
|
||||||
for (int i = 0; i < imageRequest.RequestImage.Length; i++)
|
for (int i = 0; i < imageRequest.RequestImage.Length; i++)
|
||||||
{
|
{
|
||||||
if (OnRequestTexture != null)
|
if (OnRequestTexture != null)
|
||||||
|
@ -7024,7 +7025,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
args.PacketNumber = imageRequest.RequestImage[i].Packet;
|
args.PacketNumber = imageRequest.RequestImage[i].Packet;
|
||||||
args.Priority = imageRequest.RequestImage[i].DownloadPriority;
|
args.Priority = imageRequest.RequestImage[i].DownloadPriority;
|
||||||
args.requestSequence = imageRequest.Header.Sequence;
|
args.requestSequence = imageRequest.Header.Sequence;
|
||||||
|
|
||||||
//handlerTextureRequest = OnRequestTexture;
|
//handlerTextureRequest = OnRequestTexture;
|
||||||
|
|
||||||
//if (handlerTextureRequest != null)
|
//if (handlerTextureRequest != null)
|
||||||
|
@ -7047,10 +7047,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
// Validate inventory transfers
|
// Validate inventory transfers
|
||||||
// Has to be done here, because AssetCache can't do it
|
// Has to be done here, because AssetCache can't do it
|
||||||
//
|
//
|
||||||
|
UUID taskID = UUID.Zero;
|
||||||
if (transfer.TransferInfo.SourceType == 3)
|
if (transfer.TransferInfo.SourceType == 3)
|
||||||
{
|
{
|
||||||
UUID taskID = new UUID(transfer.TransferInfo.Params, 48);
|
taskID = new UUID(transfer.TransferInfo.Params, 48);
|
||||||
UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
|
UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
|
||||||
UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
|
UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
|
||||||
if (!(((Scene)m_scene).Permissions.BypassPermissions()))
|
if (!(((Scene)m_scene).Permissions.BypassPermissions()))
|
||||||
|
@ -7121,7 +7121,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
//m_assetCache.AddAssetRequest(this, transfer);
|
//m_assetCache.AddAssetRequest(this, transfer);
|
||||||
|
|
||||||
MakeAssetRequest(transfer);
|
MakeAssetRequest(transfer, taskID);
|
||||||
|
|
||||||
/* RequestAsset = OnRequestAsset;
|
/* RequestAsset = OnRequestAsset;
|
||||||
if (RequestAsset != null)
|
if (RequestAsset != null)
|
||||||
|
@ -10330,7 +10330,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MakeAssetRequest(TransferRequestPacket transferRequest)
|
public void MakeAssetRequest(TransferRequestPacket transferRequest, UUID taskID)
|
||||||
{
|
{
|
||||||
UUID requestID = UUID.Zero;
|
UUID requestID = UUID.Zero;
|
||||||
if (transferRequest.TransferInfo.SourceType == 2)
|
if (transferRequest.TransferInfo.SourceType == 2)
|
||||||
|
@ -10343,6 +10343,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
//inventory asset request
|
//inventory asset request
|
||||||
requestID = new UUID(transferRequest.TransferInfo.Params, 80);
|
requestID = new UUID(transferRequest.TransferInfo.Params, 80);
|
||||||
//m_log.Debug("asset request " + requestID);
|
//m_log.Debug("asset request " + requestID);
|
||||||
|
if (taskID == UUID.Zero) // Agent
|
||||||
|
if (m_scene is HGScene)
|
||||||
|
{
|
||||||
|
// We may need to fetch the asset from the user's asset server into the local asset server
|
||||||
|
HGAssetMapper mapper = ((HGScene)m_scene).AssetMapper;
|
||||||
|
mapper.Get(requestID, AgentId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//check to see if asset is in local cache, if not we need to request it from asset server.
|
//check to see if asset is in local cache, if not we need to request it from asset server.
|
||||||
|
|
|
@ -59,6 +59,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer());
|
private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer());
|
||||||
private object m_syncRoot = new object();
|
private object m_syncRoot = new object();
|
||||||
|
|
||||||
|
private IHyperAssetService m_hyperAssets;
|
||||||
|
|
||||||
public LLClientView Client { get { return m_client; } }
|
public LLClientView Client { get { return m_client; } }
|
||||||
public AssetBase MissingImage { get { return m_missingImage; } }
|
public AssetBase MissingImage { get { return m_missingImage; } }
|
||||||
|
|
||||||
|
@ -74,6 +76,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client");
|
m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client");
|
||||||
|
|
||||||
m_j2kDecodeModule = pJ2kDecodeModule;
|
m_j2kDecodeModule = pJ2kDecodeModule;
|
||||||
|
m_hyperAssets = client.Scene.RequestModuleInterface<IHyperAssetService>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -146,6 +149,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
imgrequest = new J2KImage(this);
|
imgrequest = new J2KImage(this);
|
||||||
imgrequest.J2KDecoder = m_j2kDecodeModule;
|
imgrequest.J2KDecoder = m_j2kDecodeModule;
|
||||||
imgrequest.AssetService = m_assetCache;
|
imgrequest.AssetService = m_assetCache;
|
||||||
|
imgrequest.AgentID = m_client.AgentId;
|
||||||
|
imgrequest.HyperAssets = m_hyperAssets;
|
||||||
imgrequest.DiscardLevel = newRequest.DiscardLevel;
|
imgrequest.DiscardLevel = newRequest.DiscardLevel;
|
||||||
imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber);
|
imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber);
|
||||||
imgrequest.Priority = newRequest.Priority;
|
imgrequest.Priority = newRequest.Priority;
|
||||||
|
|
|
@ -31,6 +31,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Server.Base;
|
using OpenSim.Server.Base;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
@ -40,7 +41,7 @@ using OpenMetaverse;
|
||||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
{
|
{
|
||||||
public class HGAssetBroker :
|
public class HGAssetBroker :
|
||||||
ISharedRegionModule, IAssetService
|
ISharedRegionModule, IAssetService, IHyperAssetService
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(
|
LogManager.GetLogger(
|
||||||
|
@ -50,6 +51,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
private IAssetService m_GridService;
|
private IAssetService m_GridService;
|
||||||
private IAssetService m_HGService;
|
private IAssetService m_HGService;
|
||||||
|
|
||||||
|
private Scene m_aScene;
|
||||||
|
private string m_LocalAssetServiceURI;
|
||||||
|
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
|
|
||||||
public Type ReplaceableInterface
|
public Type ReplaceableInterface
|
||||||
|
@ -114,6 +118,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_LocalAssetServiceURI = assetConfig.GetString("AssetServerURI", string.Empty);
|
||||||
|
if (m_LocalAssetServiceURI == string.Empty)
|
||||||
|
{
|
||||||
|
IConfig netConfig = source.Configs["Network"];
|
||||||
|
m_LocalAssetServiceURI = netConfig.GetString("asset_server_url", string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_LocalAssetServiceURI != string.Empty)
|
||||||
|
m_LocalAssetServiceURI = m_LocalAssetServiceURI.Trim('/');
|
||||||
|
|
||||||
m_Enabled = true;
|
m_Enabled = true;
|
||||||
m_log.Info("[HG ASSET CONNECTOR]: HG asset broker enabled");
|
m_log.Info("[HG ASSET CONNECTOR]: HG asset broker enabled");
|
||||||
}
|
}
|
||||||
|
@ -133,7 +147,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
m_aScene = scene;
|
||||||
|
|
||||||
scene.RegisterModuleInterface<IAssetService>(this);
|
scene.RegisterModuleInterface<IAssetService>(this);
|
||||||
|
scene.RegisterModuleInterface<IHyperAssetService>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
|
@ -344,5 +361,30 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
else
|
else
|
||||||
return m_GridService.Delete(id);
|
return m_GridService.Delete(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region IHyperAssetService
|
||||||
|
|
||||||
|
public string GetUserAssetServer(UUID userID)
|
||||||
|
{
|
||||||
|
CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
|
||||||
|
if ((uinfo != null) && (uinfo.UserProfile != null))
|
||||||
|
{
|
||||||
|
if ((uinfo.UserProfile.UserAssetURI == string.Empty) || (uinfo.UserProfile.UserAssetURI == ""))
|
||||||
|
return m_LocalAssetServiceURI;
|
||||||
|
return uinfo.UserProfile.UserAssetURI.Trim('/');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// we don't know anyting about this user
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetSimAssetServer()
|
||||||
|
{
|
||||||
|
return m_LocalAssetServiceURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -759,6 +759,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected bool IsLocalRegion(ulong handle)
|
protected bool IsLocalRegion(ulong handle)
|
||||||
{
|
{
|
||||||
return m_LocalScenes.ContainsKey(handle);
|
return m_LocalScenes.ContainsKey(handle);
|
||||||
|
|
|
@ -159,6 +159,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
/// <returns>true if the item was successfully added</returns>
|
/// <returns>true if the item was successfully added</returns>
|
||||||
public bool AddItem(InventoryItemBase item)
|
public bool AddItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
|
if (item == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (item.Folder == UUID.Zero)
|
if (item.Folder == UUID.Zero)
|
||||||
{
|
{
|
||||||
InventoryFolderBase f = GetFolderForType(item.Owner, (AssetType)item.AssetType);
|
InventoryFolderBase f = GetFolderForType(item.Owner, (AssetType)item.AssetType);
|
||||||
|
|
|
@ -386,7 +386,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (IsLocalGridUser(item.Owner))
|
if (IsLocalGridUser(item.Owner))
|
||||||
|
{
|
||||||
return m_GridService.AddItem(item);
|
return m_GridService.AddItem(item);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID sessionID = GetSessionID(item.Owner);
|
UUID sessionID = GetSessionID(item.Owner);
|
||||||
|
|
|
@ -35,6 +35,7 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Framework.Communications.Clients;
|
using OpenSim.Framework.Communications.Clients;
|
||||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
//using HyperGrid.Framework;
|
//using HyperGrid.Framework;
|
||||||
|
@ -52,13 +53,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||||
|
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
|
|
||||||
private IHyperlinkService m_hyper;
|
private IHyperAssetService m_hyper;
|
||||||
IHyperlinkService HyperlinkService
|
IHyperAssetService HyperlinkAssets
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (m_hyper == null)
|
if (m_hyper == null)
|
||||||
m_hyper = m_scene.RequestModuleInterface<IHyperlinkService>();
|
m_hyper = m_scene.RequestModuleInterface<IHyperAssetService>();
|
||||||
return m_hyper;
|
return m_hyper;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +100,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
m_log.Debug("[HGScene]: Asset made it to asset cache. " + asset.Name + " " + assetID);
|
m_log.DebugFormat("[HGScene]: Copied asset {0} from {1} to local asset server. ", asset.ID, url);
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -129,6 +130,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scene.AssetService.Store(asset1);
|
m_scene.AssetService.Store(asset1);
|
||||||
|
m_log.DebugFormat("[HGScene]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -166,35 +168,33 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||||
#region Public interface
|
#region Public interface
|
||||||
|
|
||||||
public void Get(UUID assetID, UUID ownerID)
|
public void Get(UUID assetID, UUID ownerID)
|
||||||
{
|
|
||||||
if (!HyperlinkService.IsLocalUser(ownerID))
|
|
||||||
{
|
{
|
||||||
// Get the item from the remote asset server onto the local AssetCache
|
// Get the item from the remote asset server onto the local AssetCache
|
||||||
// and place an entry in m_assetMap
|
// and place an entry in m_assetMap
|
||||||
|
|
||||||
string userAssetURL = UserAssetURL(ownerID);
|
string userAssetURL = HyperlinkAssets.GetUserAssetServer(ownerID);
|
||||||
if (userAssetURL != null)
|
if ((userAssetURL != string.Empty) && (userAssetURL != HyperlinkAssets.GetSimAssetServer()))
|
||||||
{
|
{
|
||||||
m_log.Debug("[HGScene]: Fetching object " + assetID + " to asset server " + userAssetURL);
|
m_log.Debug("[HGScene]: Fetching object " + assetID + " from asset server " + userAssetURL);
|
||||||
AssetBase asset = FetchAsset(userAssetURL, assetID);
|
AssetBase asset = FetchAsset(userAssetURL, assetID);
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
m_log.Debug("[HGScene]: Successfully fetched item from remote asset server " + userAssetURL);
|
|
||||||
|
|
||||||
// OK, now fetch the inside.
|
// OK, now fetch the inside.
|
||||||
Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
|
Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
|
||||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
|
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
|
||||||
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
|
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
|
||||||
foreach (UUID uuid in ids.Keys)
|
foreach (UUID uuid in ids.Keys)
|
||||||
FetchAsset(userAssetURL, uuid);
|
FetchAsset(userAssetURL, uuid);
|
||||||
|
|
||||||
|
m_log.DebugFormat("[HGScene]: Successfully fetched asset {0} from asset server {1}", asset.ID, userAssetURL);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL);
|
m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_log.Warn("[HGScene]: Unable to locate foreign user's asset server");
|
m_log.Debug("[HGScene]: user's asset server is the local region's asset server");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo)
|
//public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo)
|
||||||
|
@ -224,14 +224,12 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||||
//}
|
//}
|
||||||
|
|
||||||
public void Post(UUID assetID, UUID ownerID)
|
public void Post(UUID assetID, UUID ownerID)
|
||||||
{
|
|
||||||
if (!HyperlinkService.IsLocalUser(ownerID))
|
|
||||||
{
|
{
|
||||||
// Post the item from the local AssetCache onto the remote asset server
|
// Post the item from the local AssetCache onto the remote asset server
|
||||||
// and place an entry in m_assetMap
|
// and place an entry in m_assetMap
|
||||||
|
|
||||||
string userAssetURL = UserAssetURL(ownerID);
|
string userAssetURL = HyperlinkAssets.GetUserAssetServer(ownerID);
|
||||||
if (userAssetURL != null)
|
if ((userAssetURL != string.Empty) && (userAssetURL != HyperlinkAssets.GetSimAssetServer()))
|
||||||
{
|
{
|
||||||
m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL);
|
m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL);
|
||||||
AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
|
AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
|
||||||
|
@ -243,27 +241,23 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||||
foreach (UUID uuid in ids.Keys)
|
foreach (UUID uuid in ids.Keys)
|
||||||
{
|
{
|
||||||
asset = m_scene.AssetService.Get(uuid.ToString());
|
asset = m_scene.AssetService.Get(uuid.ToString());
|
||||||
if (asset != null)
|
if (asset == null)
|
||||||
m_log.DebugFormat("[HGScene]: Posting {0} {1}", asset.Type.ToString(), asset.Name);
|
|
||||||
else
|
|
||||||
m_log.DebugFormat("[HGScene]: Could not find asset {0}", uuid);
|
m_log.DebugFormat("[HGScene]: Could not find asset {0}", uuid);
|
||||||
|
else
|
||||||
PostAsset(userAssetURL, asset);
|
PostAsset(userAssetURL, asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ids.Count > 0) // maybe it succeeded...
|
// maybe all pieces got there...
|
||||||
m_log.DebugFormat("[HGScene]: Successfully posted item {0} to remote asset server {1}", assetID, userAssetURL);
|
m_log.DebugFormat("[HGScene]: Successfully posted item {0} to asset server {1}", assetID, userAssetURL);
|
||||||
else
|
|
||||||
m_log.WarnFormat("[HGScene]: Could not post asset {0} to remote asset server {1}", assetID, userAssetURL);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_log.Debug("[HGScene]: Something wrong with asset, it could not be found");
|
m_log.DebugFormat("[HGScene]: Something wrong with asset {0}, it could not be found", assetID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_log.Warn("[HGScene]: Unable to locate foreign user's asset server");
|
m_log.Debug("[HGScene]: user's asset server is local region's asset server");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||||
{
|
{
|
||||||
|
@ -41,6 +42,21 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private HGAssetMapper m_assMapper;
|
private HGAssetMapper m_assMapper;
|
||||||
|
public HGAssetMapper AssetMapper
|
||||||
|
{
|
||||||
|
get { return m_assMapper; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private IHyperAssetService m_hyper;
|
||||||
|
private IHyperAssetService HyperAssets
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (m_hyper == null)
|
||||||
|
m_hyper = RequestModuleInterface<IHyperAssetService>();
|
||||||
|
return m_hyper;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -140,6 +156,16 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver)
|
||||||
|
{
|
||||||
|
string userAssetServer = HyperAssets.GetUserAssetServer(sender);
|
||||||
|
if ((userAssetServer != string.Empty) && (userAssetServer != HyperAssets.GetSimAssetServer()))
|
||||||
|
m_assMapper.Get(item.AssetID, sender);
|
||||||
|
|
||||||
|
userAssetServer = HyperAssets.GetUserAssetServer(receiver);
|
||||||
|
if ((userAssetServer != string.Empty) && (userAssetServer != HyperAssets.GetSimAssetServer()))
|
||||||
|
m_assMapper.Post(item.AssetID, receiver);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -408,7 +408,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public virtual InventoryItemBase GiveInventoryItem(
|
public virtual InventoryItemBase GiveInventoryItem(
|
||||||
UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId)
|
UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem");
|
//Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem");
|
||||||
|
|
||||||
InventoryItemBase item = new InventoryItemBase(itemId, senderId);
|
InventoryItemBase item = new InventoryItemBase(itemId, senderId);
|
||||||
item = InventoryService.GetItem(item);
|
item = InventoryService.GetItem(item);
|
||||||
|
@ -472,7 +472,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
itemCopy.SalePrice = item.SalePrice;
|
itemCopy.SalePrice = item.SalePrice;
|
||||||
itemCopy.SaleType = item.SaleType;
|
itemCopy.SaleType = item.SaleType;
|
||||||
|
|
||||||
InventoryService.AddItem(itemCopy);
|
if (InventoryService.AddItem(itemCopy))
|
||||||
|
TransferInventoryAssets(itemCopy, senderId, recipient);
|
||||||
|
|
||||||
if (!Permissions.BypassPermissions())
|
if (!Permissions.BypassPermissions())
|
||||||
{
|
{
|
||||||
|
@ -494,6 +495,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Give an entire inventory folder from one user to another. The entire contents (including all descendent
|
/// Give an entire inventory folder from one user to another. The entire contents (including all descendent
|
||||||
/// folders) is given.
|
/// folders) is given.
|
||||||
|
|
|
@ -299,6 +299,7 @@ namespace OpenSim.Services.Connectors.Inventory
|
||||||
|
|
||||||
if (StringToUrlAndUserID(id, out url, out userID))
|
if (StringToUrlAndUserID(id, out url, out userID))
|
||||||
{
|
{
|
||||||
|
//m_log.DebugFormat("[HGInventory CONNECTOR]: calling {0}", url);
|
||||||
ISessionAuthInventoryService connector = GetConnector(url);
|
ISessionAuthInventoryService connector = GetConnector(url);
|
||||||
return connector.QueryItem(userID, item, sessionID);
|
return connector.QueryItem(userID, item, sessionID);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue