mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
Merge branch 'master' into htb-throttle
This commit is contained in:
@@ -35,6 +35,7 @@ using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Framework.Communications.Clients;
|
||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
//using HyperGrid.Framework;
|
||||
@@ -52,13 +53,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
private IHyperlinkService m_hyper;
|
||||
IHyperlinkService HyperlinkService
|
||||
private IHyperAssetService m_hyper;
|
||||
IHyperAssetService HyperlinkAssets
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_hyper == null)
|
||||
m_hyper = m_scene.RequestModuleInterface<IHyperlinkService>();
|
||||
m_hyper = m_scene.RequestModuleInterface<IHyperAssetService>();
|
||||
return m_hyper;
|
||||
}
|
||||
}
|
||||
@@ -99,7 +100,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
|
||||
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 null;
|
||||
@@ -129,6 +130,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -167,34 +169,32 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
|
||||
public void Get(UUID assetID, UUID ownerID)
|
||||
{
|
||||
if (!HyperlinkService.IsLocalUser(ownerID))
|
||||
// Get the item from the remote asset server onto the local AssetCache
|
||||
// and place an entry in m_assetMap
|
||||
|
||||
string userAssetURL = HyperlinkAssets.GetUserAssetServer(ownerID);
|
||||
if ((userAssetURL != string.Empty) && (userAssetURL != HyperlinkAssets.GetSimAssetServer()))
|
||||
{
|
||||
// Get the item from the remote asset server onto the local AssetCache
|
||||
// and place an entry in m_assetMap
|
||||
m_log.Debug("[HGScene]: Fetching object " + assetID + " from asset server " + userAssetURL);
|
||||
AssetBase asset = FetchAsset(userAssetURL, assetID);
|
||||
|
||||
string userAssetURL = UserAssetURL(ownerID);
|
||||
if (userAssetURL != null)
|
||||
if (asset != null)
|
||||
{
|
||||
m_log.Debug("[HGScene]: Fetching object " + assetID + " to asset server " + userAssetURL);
|
||||
AssetBase asset = FetchAsset(userAssetURL, assetID);
|
||||
// OK, now fetch the inside.
|
||||
Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
|
||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
|
||||
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
|
||||
foreach (UUID uuid in ids.Keys)
|
||||
FetchAsset(userAssetURL, uuid);
|
||||
|
||||
if (asset != null)
|
||||
{
|
||||
m_log.Debug("[HGScene]: Successfully fetched item from remote asset server " + userAssetURL);
|
||||
m_log.DebugFormat("[HGScene]: Successfully fetched asset {0} from asset server {1}", asset.ID, userAssetURL);
|
||||
|
||||
// OK, now fetch the inside.
|
||||
Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
|
||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
|
||||
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
|
||||
foreach (UUID uuid in ids.Keys)
|
||||
FetchAsset(userAssetURL, uuid);
|
||||
}
|
||||
else
|
||||
m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL);
|
||||
}
|
||||
else
|
||||
m_log.Warn("[HGScene]: Unable to locate foreign user's asset server");
|
||||
m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL);
|
||||
}
|
||||
else
|
||||
m_log.Debug("[HGScene]: user's asset server is the local region's asset server");
|
||||
}
|
||||
|
||||
//public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo)
|
||||
@@ -225,44 +225,38 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
|
||||
public void Post(UUID assetID, UUID ownerID)
|
||||
{
|
||||
if (!HyperlinkService.IsLocalUser(ownerID))
|
||||
{
|
||||
// Post the item from the local AssetCache onto the remote asset server
|
||||
// and place an entry in m_assetMap
|
||||
|
||||
string userAssetURL = UserAssetURL(ownerID);
|
||||
if (userAssetURL != null)
|
||||
string userAssetURL = HyperlinkAssets.GetUserAssetServer(ownerID);
|
||||
if ((userAssetURL != string.Empty) && (userAssetURL != HyperlinkAssets.GetSimAssetServer()))
|
||||
{
|
||||
m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL);
|
||||
AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
|
||||
if (asset != null)
|
||||
{
|
||||
m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL);
|
||||
AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
|
||||
if (asset != null)
|
||||
Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
|
||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty);
|
||||
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
|
||||
foreach (UUID uuid in ids.Keys)
|
||||
{
|
||||
Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
|
||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty);
|
||||
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
|
||||
foreach (UUID uuid in ids.Keys)
|
||||
{
|
||||
asset = m_scene.AssetService.Get(uuid.ToString());
|
||||
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);
|
||||
PostAsset(userAssetURL, asset);
|
||||
}
|
||||
|
||||
if (ids.Count > 0) // maybe it succeeded...
|
||||
m_log.DebugFormat("[HGScene]: Successfully posted item {0} to remote asset server {1}", assetID, userAssetURL);
|
||||
asset = m_scene.AssetService.Get(uuid.ToString());
|
||||
if (asset == null)
|
||||
m_log.DebugFormat("[HGScene]: Could not find asset {0}", uuid);
|
||||
else
|
||||
m_log.WarnFormat("[HGScene]: Could not post asset {0} to remote asset server {1}", assetID, userAssetURL);
|
||||
|
||||
PostAsset(userAssetURL, asset);
|
||||
}
|
||||
else
|
||||
m_log.Debug("[HGScene]: Something wrong with asset, it could not be found");
|
||||
|
||||
// maybe all pieces got there...
|
||||
m_log.DebugFormat("[HGScene]: Successfully posted item {0} to asset server {1}", assetID, userAssetURL);
|
||||
|
||||
}
|
||||
else
|
||||
m_log.Warn("[HGScene]: Unable to locate foreign user's asset server");
|
||||
|
||||
m_log.DebugFormat("[HGScene]: Something wrong with asset {0}, it could not be found", assetID);
|
||||
}
|
||||
else
|
||||
m_log.Debug("[HGScene]: user's asset server is local region's asset server");
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -32,6 +32,7 @@ using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
|
||||
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 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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -408,7 +408,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public virtual InventoryItemBase GiveInventoryItem(
|
||||
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);
|
||||
item = InventoryService.GetItem(item);
|
||||
@@ -472,7 +472,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
itemCopy.SalePrice = item.SalePrice;
|
||||
itemCopy.SaleType = item.SaleType;
|
||||
|
||||
InventoryService.AddItem(itemCopy);
|
||||
if (InventoryService.AddItem(itemCopy))
|
||||
TransferInventoryAssets(itemCopy, senderId, recipient);
|
||||
|
||||
if (!Permissions.BypassPermissions())
|
||||
{
|
||||
@@ -494,6 +495,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
}
|
||||
|
||||
protected virtual void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Give an entire inventory folder from one user to another. The entire contents (including all descendent
|
||||
/// folders) is given.
|
||||
|
||||
@@ -1772,36 +1772,86 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
Vector3 pos = attemptedPosition;
|
||||
|
||||
int changeX = 1;
|
||||
int changeY = 1;
|
||||
|
||||
if (TestBorderCross(attemptedPosition + WestCross, Cardinals.W))
|
||||
{
|
||||
if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
|
||||
{
|
||||
//Border crossedBorderx = GetCrossedBorder(attemptedPosition,Cardinals.W);
|
||||
//Border crossedBordery = GetCrossedBorder(attemptedPosition, Cardinals.S);
|
||||
|
||||
Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
|
||||
|
||||
if (crossedBorderx.BorderLine.Z > 0)
|
||||
{
|
||||
pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
|
||||
changeX = (int)(crossedBorderx.BorderLine.Z /(int) Constants.RegionSize);
|
||||
}
|
||||
else
|
||||
pos.X = ((pos.X + Constants.RegionSize));
|
||||
|
||||
Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
|
||||
//(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
|
||||
pos.X = ((pos.X + Constants.RegionSize));
|
||||
pos.Y = ((pos.Y + Constants.RegionSize));
|
||||
|
||||
if (crossedBordery.BorderLine.Z > 0)
|
||||
{
|
||||
pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
|
||||
}
|
||||
else
|
||||
pos.Y = ((pos.Y + Constants.RegionSize));
|
||||
|
||||
|
||||
|
||||
newRegionHandle
|
||||
= Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize),
|
||||
(uint)((thisy - 1) * Constants.RegionSize));
|
||||
= Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
|
||||
(uint)((thisy - changeY) * Constants.RegionSize));
|
||||
// x - 1
|
||||
// y - 1
|
||||
}
|
||||
else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
|
||||
{
|
||||
pos.X = ((pos.X + Constants.RegionSize));
|
||||
pos.Y = ((pos.Y - Constants.RegionSize));
|
||||
Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
|
||||
|
||||
if (crossedBorderx.BorderLine.Z > 0)
|
||||
{
|
||||
pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
|
||||
changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize);
|
||||
}
|
||||
else
|
||||
pos.X = ((pos.X + Constants.RegionSize));
|
||||
|
||||
|
||||
Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
|
||||
//(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
|
||||
|
||||
if (crossedBordery.BorderLine.Z > 0)
|
||||
{
|
||||
pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
|
||||
changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
|
||||
}
|
||||
else
|
||||
pos.Y = ((pos.Y + Constants.RegionSize));
|
||||
|
||||
newRegionHandle
|
||||
= Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize),
|
||||
(uint)((thisy + 1) * Constants.RegionSize));
|
||||
= Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
|
||||
(uint)((thisy + changeY) * Constants.RegionSize));
|
||||
// x - 1
|
||||
// y + 1
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.X = ((pos.X + Constants.RegionSize));
|
||||
Border crossedBorderx = GetCrossedBorder(attemptedPosition + WestCross, Cardinals.W);
|
||||
|
||||
if (crossedBorderx.BorderLine.Z > 0)
|
||||
{
|
||||
pos.X = ((pos.X + crossedBorderx.BorderLine.Z));
|
||||
changeX = (int)(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize);
|
||||
}
|
||||
else
|
||||
pos.X = ((pos.X + Constants.RegionSize));
|
||||
|
||||
newRegionHandle
|
||||
= Util.UIntsToLong((uint) ((thisx - 1)*Constants.RegionSize),
|
||||
= Util.UIntsToLong((uint)((thisx - changeX) * Constants.RegionSize),
|
||||
(uint) (thisy*Constants.RegionSize));
|
||||
// x - 1
|
||||
}
|
||||
@@ -1810,11 +1860,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
|
||||
{
|
||||
|
||||
pos.X = ((pos.X - Constants.RegionSize));
|
||||
pos.Y = ((pos.Y + Constants.RegionSize));
|
||||
Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
|
||||
//(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
|
||||
|
||||
if (crossedBordery.BorderLine.Z > 0)
|
||||
{
|
||||
pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
|
||||
changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
|
||||
}
|
||||
else
|
||||
pos.Y = ((pos.Y + Constants.RegionSize));
|
||||
|
||||
|
||||
newRegionHandle
|
||||
= Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize),
|
||||
(uint)((thisy - 1) * Constants.RegionSize));
|
||||
= Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
|
||||
(uint)((thisy - changeY) * Constants.RegionSize));
|
||||
// x + 1
|
||||
// y - 1
|
||||
}
|
||||
@@ -1823,8 +1885,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
pos.X = ((pos.X - Constants.RegionSize));
|
||||
pos.Y = ((pos.Y - Constants.RegionSize));
|
||||
newRegionHandle
|
||||
= Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize),
|
||||
(uint)((thisy + 1) * Constants.RegionSize));
|
||||
= Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
|
||||
(uint)((thisy + changeY) * Constants.RegionSize));
|
||||
// x + 1
|
||||
// y + 1
|
||||
}
|
||||
@@ -1832,16 +1894,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
pos.X = ((pos.X - Constants.RegionSize));
|
||||
newRegionHandle
|
||||
= Util.UIntsToLong((uint) ((thisx + 1)*Constants.RegionSize),
|
||||
= Util.UIntsToLong((uint)((thisx + changeX) * Constants.RegionSize),
|
||||
(uint) (thisy*Constants.RegionSize));
|
||||
// x + 1
|
||||
}
|
||||
}
|
||||
else if (TestBorderCross(attemptedPosition + SouthCross, Cardinals.S))
|
||||
{
|
||||
pos.Y = ((pos.Y + Constants.RegionSize));
|
||||
Border crossedBordery = GetCrossedBorder(attemptedPosition + SouthCross, Cardinals.S);
|
||||
//(crossedBorderx.BorderLine.Z / (int)Constants.RegionSize)
|
||||
|
||||
if (crossedBordery.BorderLine.Z > 0)
|
||||
{
|
||||
pos.Y = ((pos.Y + crossedBordery.BorderLine.Z));
|
||||
changeY = (int)(crossedBordery.BorderLine.Z / (int)Constants.RegionSize);
|
||||
}
|
||||
else
|
||||
pos.Y = ((pos.Y + Constants.RegionSize));
|
||||
|
||||
newRegionHandle
|
||||
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize));
|
||||
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - changeY) * Constants.RegionSize));
|
||||
// y - 1
|
||||
}
|
||||
else if (TestBorderCross(attemptedPosition + NorthCross, Cardinals.N))
|
||||
@@ -1849,7 +1921,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
pos.Y = ((pos.Y - Constants.RegionSize));
|
||||
newRegionHandle
|
||||
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize));
|
||||
= Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + changeY) * Constants.RegionSize));
|
||||
// y + 1
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user