mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 03:06:05 +08:00
Merge branch 'master' into diva-textures
This commit is contained in:
@@ -34,7 +34,7 @@ using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
{
|
||||
class DeleteToInventoryHolder
|
||||
{
|
||||
public DeRezAction action;
|
||||
@@ -49,7 +49,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// up the main client thread.
|
||||
/// </summary>
|
||||
public class AsyncSceneObjectGroupDeleter
|
||||
{
|
||||
{
|
||||
private static readonly ILog m_log
|
||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
@@ -58,16 +58,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </value>
|
||||
public bool Enabled;
|
||||
|
||||
private Timer m_inventoryTicker = new Timer(2000);
|
||||
private readonly Queue<DeleteToInventoryHolder> m_inventoryDeletes = new Queue<DeleteToInventoryHolder>();
|
||||
private Scene m_scene;
|
||||
private Timer m_inventoryTicker = new Timer(2000);
|
||||
private readonly Queue<DeleteToInventoryHolder> m_inventoryDeletes = new Queue<DeleteToInventoryHolder>();
|
||||
private Scene m_scene;
|
||||
|
||||
public AsyncSceneObjectGroupDeleter(Scene scene)
|
||||
{
|
||||
m_scene = scene;
|
||||
|
||||
m_inventoryTicker.AutoReset = false;
|
||||
m_inventoryTicker.Elapsed += InventoryRunDeleteTimer;
|
||||
m_inventoryTicker.Elapsed += InventoryRunDeleteTimer;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -113,7 +113,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
//m_log.Debug("[SCENE]: Sent item successfully to inventory, continuing...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Move the next object in the queue to inventory. Then delete it properly from the scene.
|
||||
@@ -121,7 +121,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <returns></returns>
|
||||
public bool InventoryDeQueueAndDelete()
|
||||
{
|
||||
DeleteToInventoryHolder x = null;
|
||||
DeleteToInventoryHolder x = null;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -142,9 +142,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
try
|
||||
{
|
||||
m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient);
|
||||
m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient);
|
||||
if (x.permissionToDelete)
|
||||
m_scene.DeleteSceneObject(x.objectGroup, false);
|
||||
m_scene.DeleteSceneObject(x.objectGroup, false);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -166,6 +166,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
m_log.Debug("[SCENE]: No objects left in inventory send queue.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
if (nod.Attributes["name"] != null)
|
||||
{
|
||||
string name = (string)nod.Attributes["name"].Value;
|
||||
string name = (string)nod.Attributes["name"].Value;
|
||||
UUID id = (UUID)nod.InnerText;
|
||||
string animState = (string)nod.Attributes["state"].Value;
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Variable length strings seem to be null terminated in the animation asset.. but..
|
||||
/// Variable length strings seem to be null terminated in the animation asset.. but..
|
||||
/// use with caution, home grown.
|
||||
/// advances the index.
|
||||
/// </summary>
|
||||
@@ -273,7 +273,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
byte[] interm = new byte[endpos-i];
|
||||
for (; i<endpos; i++)
|
||||
{
|
||||
interm[i-startpos] = data[i];
|
||||
interm[i-startpos] = data[i];
|
||||
}
|
||||
i++; // advance past the null character
|
||||
|
||||
@@ -624,7 +624,7 @@ switch (jointname)
|
||||
case "mWristLeft":
|
||||
case "mWristRight":
|
||||
case "mShoulderLeft":
|
||||
case "mShoulderRight":
|
||||
case "mShoulderRight":
|
||||
// ZYX->ZXY
|
||||
t = y;
|
||||
y = z;
|
||||
|
||||
@@ -55,11 +55,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// Creates a Border. The line is perpendicular to the direction cardinal.
|
||||
/// IE: if the direction cardinal is South, the line is West->East
|
||||
/// </summary>
|
||||
/// <param name="lineStart">The starting point for the line of the border.
|
||||
/// The position of an object must be greater then this for this border to trigger.
|
||||
/// <param name="lineStart">The starting point for the line of the border.
|
||||
/// The position of an object must be greater then this for this border to trigger.
|
||||
/// Perpendicular to the direction cardinal</param>
|
||||
/// <param name="lineEnd">The ending point for the line of the border.
|
||||
/// The position of an object must be less then this for this border to trigger.
|
||||
/// <param name="lineEnd">The ending point for the line of the border.
|
||||
/// The position of an object must be less then this for this border to trigger.
|
||||
/// Perpendicular to the direction cardinal</param>
|
||||
/// <param name="triggerCoordinate">The position that triggers border the border
|
||||
/// cross parallel to the direction cardinal. On the North cardinal, this
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public abstract void UpdateMovement();
|
||||
|
||||
/// <summary>
|
||||
/// Performs any updates that need to be done at each frame, as opposed to immediately.
|
||||
/// Performs any updates that need to be done at each frame, as opposed to immediately.
|
||||
/// These included scheduled updates and updates that occur due to physics processing.
|
||||
/// </summary>
|
||||
public abstract void Update();
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
m_log.ErrorFormat("Remove Entity failed for {0}", localID, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ using OpenSim.Framework;
|
||||
using OpenSim.Framework.Client;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using Caps=OpenSim.Framework.Capabilities.Caps;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
@@ -289,7 +290,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// Guid.Empty is returned.
|
||||
/// </summary>
|
||||
public delegate void OarFileSaved(Guid guid, string message);
|
||||
public event OarFileSaved OnOarFileSaved;
|
||||
public event OarFileSaved OnOarFileSaved;
|
||||
|
||||
/// <summary>
|
||||
/// Called when the script compile queue becomes empty
|
||||
@@ -305,6 +306,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
|
||||
public event Attach OnAttach;
|
||||
|
||||
public delegate void RegionUp(GridRegion region);
|
||||
public event RegionUp OnRegionUp;
|
||||
|
||||
public class MoneyTransferArgs : EventArgs
|
||||
{
|
||||
public UUID sender;
|
||||
@@ -446,6 +450,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
private EmptyScriptCompileQueue handlerEmptyScriptCompileQueue = null;
|
||||
|
||||
private Attach handlerOnAttach = null;
|
||||
private RegionUp handlerOnRegionUp = null;
|
||||
|
||||
public void TriggerOnAttach(uint localID, UUID itemID, UUID avatarID)
|
||||
{
|
||||
@@ -999,7 +1004,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
handlerOarFileSaved = OnOarFileSaved;
|
||||
if (handlerOarFileSaved != null)
|
||||
handlerOarFileSaved(requestId, message);
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerEmptyScriptCompileQueue(int numScriptsFailed, string message)
|
||||
{
|
||||
@@ -1035,5 +1040,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (handlerSetRootAgentScene != null)
|
||||
handlerSetRootAgentScene(agentID, scene);
|
||||
}
|
||||
|
||||
public void TriggerOnRegionUp(GridRegion otherRegion)
|
||||
{
|
||||
handlerOnRegionUp = OnRegionUp;
|
||||
if (handlerOnRegionUp != null)
|
||||
handlerOnRegionUp(otherRegion);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.Services.Interfaces;
|
||||
|
||||
//using HyperGrid.Framework;
|
||||
//using OpenSim.Region.Communications.Hypergrid;
|
||||
@@ -47,10 +48,21 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
// This maps between inventory server urls and inventory server clients
|
||||
private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>();
|
||||
|
||||
// private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>();
|
||||
|
||||
private Scene m_scene;
|
||||
|
||||
private IHyperlinkService m_hyper;
|
||||
IHyperlinkService HyperlinkService
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_hyper == null)
|
||||
m_hyper = m_scene.RequestModuleInterface<IHyperlinkService>();
|
||||
return m_hyper;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
@@ -72,30 +84,14 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
return null;
|
||||
}
|
||||
|
||||
private string UserInventoryURL(UUID userID)
|
||||
{
|
||||
CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
|
||||
if (uinfo != null)
|
||||
return (uinfo.UserProfile.UserInventoryURI == "") ? null : uinfo.UserProfile.UserInventoryURI;
|
||||
return null;
|
||||
}
|
||||
// private string UserInventoryURL(UUID userID)
|
||||
// {
|
||||
// CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
|
||||
// if (uinfo != null)
|
||||
// return (uinfo.UserProfile.UserInventoryURI == "") ? null : uinfo.UserProfile.UserInventoryURI;
|
||||
// return null;
|
||||
// }
|
||||
|
||||
private bool IsLocalUser(UUID userID)
|
||||
{
|
||||
CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
|
||||
|
||||
if (uinfo != null)
|
||||
{
|
||||
if (HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile))
|
||||
{
|
||||
m_log.Debug("[HGScene]: Home user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
m_log.Debug("[HGScene]: Foreign user " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName);
|
||||
return false;
|
||||
}
|
||||
|
||||
public AssetBase FetchAsset(string url, UUID assetID)
|
||||
{
|
||||
@@ -171,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
|
||||
public void Get(UUID assetID, UUID ownerID)
|
||||
{
|
||||
if (!IsLocalUser(ownerID))
|
||||
if (!HyperlinkService.IsLocalUser(ownerID))
|
||||
{
|
||||
// Get the item from the remote asset server onto the local AssetCache
|
||||
// and place an entry in m_assetMap
|
||||
@@ -229,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
|
||||
public void Post(UUID assetID, UUID ownerID)
|
||||
{
|
||||
if (!IsLocalUser(ownerID))
|
||||
if (!HyperlinkService.IsLocalUser(ownerID))
|
||||
{
|
||||
// Post the item from the local AssetCache onto the remote asset server
|
||||
// and place an entry in m_assetMap
|
||||
|
||||
@@ -1,232 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
{
|
||||
public class HGHyperlink
|
||||
{
|
||||
private static readonly ILog m_log =
|
||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static Random random = new Random();
|
||||
|
||||
public static RegionInfo TryLinkRegionToCoords(Scene m_scene, IClientAPI client, string mapName, uint xloc, uint yloc)
|
||||
{
|
||||
string host = "127.0.0.1";
|
||||
string portstr;
|
||||
string regionName = "";
|
||||
uint port = 9000;
|
||||
string[] parts = mapName.Split(new char[] { ':' });
|
||||
if (parts.Length >= 1)
|
||||
{
|
||||
host = parts[0];
|
||||
}
|
||||
if (parts.Length >= 2)
|
||||
{
|
||||
portstr = parts[1];
|
||||
if (!UInt32.TryParse(portstr, out port))
|
||||
regionName = parts[1];
|
||||
}
|
||||
// always take the last one
|
||||
if (parts.Length >= 3)
|
||||
{
|
||||
regionName = parts[2];
|
||||
}
|
||||
|
||||
// Sanity check. Don't ever link to this sim.
|
||||
IPAddress ipaddr = null;
|
||||
try
|
||||
{
|
||||
ipaddr = Util.GetHostFromDNS(host);
|
||||
}
|
||||
catch { }
|
||||
|
||||
if ((ipaddr != null) &&
|
||||
!((m_scene.RegionInfo.ExternalEndPoint.Address.Equals(ipaddr)) && (m_scene.RegionInfo.HttpPort == port)))
|
||||
{
|
||||
RegionInfo regInfo;
|
||||
bool success = TryCreateLink(m_scene, client, xloc, yloc, regionName, port, host, out regInfo);
|
||||
if (success)
|
||||
{
|
||||
regInfo.RegionName = mapName;
|
||||
return regInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static RegionInfo TryLinkRegion(Scene m_scene, IClientAPI client, string mapName)
|
||||
{
|
||||
uint xloc = (uint)(random.Next(0, Int16.MaxValue));
|
||||
return TryLinkRegionToCoords(m_scene, client, mapName, xloc, 0);
|
||||
}
|
||||
|
||||
public static bool TryCreateLink(Scene m_scene, IClientAPI client, uint xloc, uint yloc,
|
||||
string externalRegionName, uint externalPort, string externalHostName, out RegionInfo regInfo)
|
||||
{
|
||||
m_log.DebugFormat("[HGrid]: Link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc);
|
||||
|
||||
regInfo = new RegionInfo();
|
||||
regInfo.RegionName = externalRegionName;
|
||||
regInfo.HttpPort = externalPort;
|
||||
regInfo.ExternalHostName = externalHostName;
|
||||
regInfo.RegionLocX = xloc;
|
||||
regInfo.RegionLocY = yloc;
|
||||
|
||||
try
|
||||
{
|
||||
regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[HGrid]: Wrong format for link-region: " + e.Message);
|
||||
return false;
|
||||
}
|
||||
regInfo.RemotingAddress = regInfo.ExternalEndPoint.Address.ToString();
|
||||
|
||||
// Finally, link it
|
||||
try
|
||||
{
|
||||
m_scene.CommsManager.GridService.RegisterRegion(regInfo);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[HGrid]: Unable to link region: " + e.Message);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint x, y;
|
||||
if (!Check4096(m_scene, regInfo, out x, out y))
|
||||
{
|
||||
m_scene.CommsManager.GridService.DeregisterRegion(regInfo);
|
||||
if (client != null)
|
||||
client.SendAlertMessage("Region is too far (" + x + ", " + y + ")");
|
||||
m_log.Info("[HGrid]: Unable to link, region is too far (" + x + ", " + y + ")");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CheckCoords(m_scene.RegionInfo.RegionLocX, m_scene.RegionInfo.RegionLocY, x, y))
|
||||
{
|
||||
m_scene.CommsManager.GridService.DeregisterRegion(regInfo);
|
||||
if (client != null)
|
||||
client.SendAlertMessage("Region has incompatible coordinates (" + x + ", " + y + ")");
|
||||
m_log.Info("[HGrid]: Unable to link, region has incompatible coordinates (" + x + ", " + y + ")");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_log.Debug("[HGrid]: link region succeeded");
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool TryUnlinkRegion(Scene m_scene, string mapName)
|
||||
{
|
||||
RegionInfo regInfo = null;
|
||||
if (mapName.Contains(":"))
|
||||
{
|
||||
string host = "127.0.0.1";
|
||||
//string portstr;
|
||||
//string regionName = "";
|
||||
uint port = 9000;
|
||||
string[] parts = mapName.Split(new char[] { ':' });
|
||||
if (parts.Length >= 1)
|
||||
{
|
||||
host = parts[0];
|
||||
}
|
||||
// if (parts.Length >= 2)
|
||||
// {
|
||||
// portstr = parts[1];
|
||||
// if (!UInt32.TryParse(portstr, out port))
|
||||
// regionName = parts[1];
|
||||
// }
|
||||
// always take the last one
|
||||
// if (parts.Length >= 3)
|
||||
// {
|
||||
// regionName = parts[2];
|
||||
// }
|
||||
regInfo = m_scene.CommsManager.GridService.RequestNeighbourInfo(host, port);
|
||||
}
|
||||
else
|
||||
{
|
||||
regInfo = m_scene.CommsManager.GridService.RequestNeighbourInfo(mapName);
|
||||
}
|
||||
if (regInfo != null)
|
||||
{
|
||||
return m_scene.CommsManager.GridService.DeregisterRegion(regInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.InfoFormat("[HGrid]: Region {0} not found", mapName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cope with this viewer limitation.
|
||||
/// </summary>
|
||||
/// <param name="regInfo"></param>
|
||||
/// <returns></returns>
|
||||
public static bool Check4096(Scene m_scene, RegionInfo regInfo, out uint x, out uint y)
|
||||
{
|
||||
ulong realHandle;
|
||||
if (UInt64.TryParse(regInfo.regionSecret, out realHandle))
|
||||
{
|
||||
Utils.LongToUInts(realHandle, out x, out y);
|
||||
x = x / Constants.RegionSize;
|
||||
y = y / Constants.RegionSize;
|
||||
|
||||
if ((Math.Abs((int)m_scene.RegionInfo.RegionLocX - (int)x) >= 4096) ||
|
||||
(Math.Abs((int)m_scene.RegionInfo.RegionLocY - (int)y) >= 4096))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_scene.CommsManager.GridService.RegisterRegion(regInfo);
|
||||
m_log.Debug("[HGrid]: Gnomes. Region deregistered.");
|
||||
x = y = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CheckCoords(uint thisx, uint thisy, uint x, uint y)
|
||||
{
|
||||
if ((thisx == x) && (thisy == y))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
{
|
||||
@@ -50,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
|
||||
if (UserProfile != null)
|
||||
{
|
||||
RegionInfo regionInfo = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegion);
|
||||
GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, UserProfile.HomeRegionID);
|
||||
//if (regionInfo != null)
|
||||
//{
|
||||
// UserProfile.HomeRegionID = regionInfo.RegionID;
|
||||
|
||||
@@ -38,6 +38,8 @@ using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
{
|
||||
@@ -45,11 +47,19 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public readonly IHyperlink m_hg;
|
||||
|
||||
public HGSceneCommunicationService(CommunicationsManager commsMan, IHyperlink hg) : base(commsMan)
|
||||
private IHyperlinkService m_hg;
|
||||
IHyperlinkService HyperlinkService
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_hg == null)
|
||||
m_hg = m_scene.RequestModuleInterface<IHyperlinkService>();
|
||||
return m_hg;
|
||||
}
|
||||
}
|
||||
|
||||
public HGSceneCommunicationService(CommunicationsManager commsMan) : base(commsMan)
|
||||
{
|
||||
m_hg = hg;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +87,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
if (regionHandle == m_regionInfo.RegionHandle)
|
||||
{
|
||||
// Teleport within the same region
|
||||
if (position.X < 0 || position.X > Constants.RegionSize || position.Y < 0 || position.Y > Constants.RegionSize || position.Z < 0)
|
||||
if (IsOutsideRegion(avatar.Scene, position) || position.Z < 0)
|
||||
{
|
||||
Vector3 emergencyPos = new Vector3(128, 128, 128);
|
||||
|
||||
@@ -89,7 +99,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
// TODO: Get proper AVG Height
|
||||
float localAVHeight = 1.56f;
|
||||
|
||||
float posZLimit = (float)avatar.Scene.Heightmap[(int)position.X, (int)position.Y];
|
||||
float posZLimit = 22;
|
||||
|
||||
if (position.X > 0 && position.X <= (int)Constants.RegionSize && position.Y > 0 && position.Y <= (int)Constants.RegionSize)
|
||||
{
|
||||
posZLimit = (float) avatar.Scene.Heightmap[(int) position.X, (int) position.Y];
|
||||
}
|
||||
|
||||
float newPosZ = posZLimit + localAVHeight;
|
||||
if (posZLimit >= (position.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ)))
|
||||
{
|
||||
@@ -106,7 +122,10 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
}
|
||||
else
|
||||
{
|
||||
RegionInfo reg = RequestNeighbouringRegionInfo(regionHandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionHandle, out x, out y);
|
||||
GridRegion reg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
|
||||
if (reg != null)
|
||||
{
|
||||
|
||||
@@ -119,13 +138,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
/// Hypergrid mod start
|
||||
///
|
||||
///
|
||||
bool isHyperLink = m_hg.IsHyperlinkRegion(reg.RegionHandle);
|
||||
bool isHyperLink = (HyperlinkService.GetHyperlinkRegion(reg.RegionHandle) != null);
|
||||
bool isHomeUser = true;
|
||||
ulong realHandle = regionHandle;
|
||||
CachedUserInfo uinfo = m_commsProvider.UserProfileCacheService.GetUserDetails(avatar.UUID);
|
||||
if (uinfo != null)
|
||||
{
|
||||
isHomeUser = HGNetworkServersInfo.Singleton.IsLocalUser(uinfo.UserProfile);
|
||||
isHomeUser = HyperlinkService.IsLocalUser(uinfo.UserProfile.ID);
|
||||
realHandle = m_hg.FindRegionHandle(regionHandle);
|
||||
m_log.Debug("XXX ---- home user? " + isHomeUser + " --- hyperlink? " + isHyperLink + " --- real handle: " + realHandle.ToString());
|
||||
}
|
||||
@@ -338,7 +357,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
||||
m_commsProvider.UserProfileCacheService.RemoveUser(avatar.UUID);
|
||||
m_log.DebugFormat(
|
||||
"[HGSceneCommService]: User {0} is going to another region, profile cache removed",
|
||||
avatar.UUID);
|
||||
avatar.UUID);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
|
||||
public class RegionStatsHandler : IStreamedRequestHandler
|
||||
{
|
||||
{
|
||||
private string osRXStatsURI = String.Empty;
|
||||
private string osXStatsURI = String.Empty;
|
||||
//private string osSecret = String.Empty;
|
||||
@@ -87,13 +87,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
public string Path
|
||||
{
|
||||
{
|
||||
// This is for the region and is the regionSecret hashed
|
||||
get { return "/" + osRXStatsURI + "/"; }
|
||||
}
|
||||
|
||||
private string Report()
|
||||
{
|
||||
{
|
||||
OSDMap args = new OSDMap(30);
|
||||
//int time = Util.ToUnixTime(DateTime.Now);
|
||||
args["OSStatsURI"] = OSD.FromString("http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/" + osXStatsURI + "/");
|
||||
|
||||
@@ -1015,7 +1015,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId);
|
||||
|
||||
if (agentItem == null)
|
||||
|
||||
@@ -413,7 +413,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
remoteClient.SendInventoryItemDetails(ownerID, item);
|
||||
}
|
||||
// else shouldn't we send an alert message?
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tell the client about the various child items and folders contained in the requested folder.
|
||||
@@ -485,7 +485,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
// TODO: This code for looking in the folder for the library should be folded back into the
|
||||
// CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc.
|
||||
// can be handled transparently).
|
||||
// can be handled transparently).
|
||||
InventoryFolderImpl fold;
|
||||
if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null)
|
||||
{
|
||||
@@ -515,7 +515,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
return contents;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle an inventory folder creation request from the client.
|
||||
@@ -535,7 +535,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
"[AGENT INVENTORY]: Failed to move create folder for user {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle a client request to update the inventory folder
|
||||
@@ -544,7 +544,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE
|
||||
/// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing,
|
||||
/// and needs to be changed.
|
||||
///
|
||||
///
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="folderID"></param>
|
||||
/// <param name="type"></param>
|
||||
@@ -570,7 +570,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID)
|
||||
{
|
||||
@@ -588,7 +588,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
m_log.WarnFormat("[AGENT INVENTORY]: request to move folder {0} but folder not found", folderID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This should delete all the items and folders in the given directory.
|
||||
@@ -609,7 +609,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
m_log.WarnFormat("[AGENT INVENTORY]: Exception on purge folder for user {0}: {1}", remoteClient.AgentId, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void PurgeFolderAsync(UUID userID, UUID folderID)
|
||||
|
||||
@@ -805,7 +805,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="invType"></param>
|
||||
/// <param name="objectID"></param>
|
||||
/// <param name="userID"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>
|
||||
public bool CanCreateObjectInventory(int invType, UUID objectID, UUID userID)
|
||||
{
|
||||
CreateObjectInventoryHandler handler = OnCreateObjectInventory;
|
||||
@@ -856,7 +856,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
/// <param name="invType"></param>
|
||||
/// <param name="userID"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>
|
||||
public bool CanCreateUserInventory(int invType, UUID userID)
|
||||
{
|
||||
CreateUserInventoryHandler handler = OnCreateUserInventory;
|
||||
@@ -877,7 +877,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
/// <param name="itemID"></param>
|
||||
/// <param name="userID"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>
|
||||
public bool CanEditUserInventory(UUID itemID, UUID userID)
|
||||
{
|
||||
EditUserInventoryHandler handler = OnEditUserInventory;
|
||||
@@ -891,14 +891,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check whether the specified user is allowed to copy the given inventory item from their own inventory.
|
||||
/// </summary>
|
||||
/// <param name="itemID"></param>
|
||||
/// <param name="userID"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>
|
||||
public bool CanCopyUserInventory(UUID itemID, UUID userID)
|
||||
{
|
||||
CopyUserInventoryHandler handler = OnCopyUserInventory;
|
||||
@@ -912,14 +912,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
|
||||
/// </summary>
|
||||
/// <param name="itemID"></param>
|
||||
/// <param name="userID"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>
|
||||
public bool CanDeleteUserInventory(UUID itemID, UUID userID)
|
||||
{
|
||||
DeleteUserInventoryHandler handler = OnDeleteUserInventory;
|
||||
@@ -933,7 +933,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanTeleport(UUID userID)
|
||||
{
|
||||
|
||||
@@ -49,6 +49,7 @@ using OpenSim.Region.Framework.Scenes.Serialization;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using Timer=System.Timers.Timer;
|
||||
using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
@@ -193,6 +194,26 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
protected IGridService m_GridService = null;
|
||||
|
||||
public IGridService GridService
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_GridService == null)
|
||||
{
|
||||
m_GridService = RequestModuleInterface<IGridService>();
|
||||
|
||||
if (m_GridService == null)
|
||||
{
|
||||
throw new Exception("No IGridService available. This could happen if the config_include folder doesn't exist or if the OpenSim.ini [Architecture] section isn't set. Please also check that you have the correct version of your inventory service dll. Sometimes old versions of this dll will still exist. Do a clean checkout and re-create the opensim.ini from the opensim.ini.example.");
|
||||
}
|
||||
}
|
||||
|
||||
return m_GridService;
|
||||
}
|
||||
}
|
||||
|
||||
protected IXMLRPC m_xmlrpcModule;
|
||||
protected IWorldComm m_worldCommModule;
|
||||
protected IAvatarFactory m_AvatarFactory;
|
||||
@@ -566,10 +587,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Another region is up. Gets called from Grid Comms:
|
||||
/// (OGS1 -> LocalBackEnd -> RegionListened -> SceneCommunicationService)
|
||||
/// We have to tell all our ScenePresences about it, and add it to the
|
||||
/// neighbor list.
|
||||
/// Another region is up.
|
||||
///
|
||||
/// We only add it to the neighbor list if it's within 1 region from here.
|
||||
/// Agents may have draw distance values that cross two regions though, so
|
||||
@@ -578,47 +596,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
/// <param name="otherRegion">RegionInfo handle for the new region.</param>
|
||||
/// <returns>True after all operations complete, throws exceptions otherwise.</returns>
|
||||
public override bool OtherRegionUp(RegionInfo otherRegion)
|
||||
public override void OtherRegionUp(GridRegion otherRegion)
|
||||
{
|
||||
m_log.InfoFormat("[SCENE]: Region {0} up in coords {1}-{2}", otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY);
|
||||
uint xcell = (uint)((int)otherRegion.RegionLocX / (int)Constants.RegionSize);
|
||||
uint ycell = (uint)((int)otherRegion.RegionLocY / (int)Constants.RegionSize);
|
||||
m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}",
|
||||
RegionInfo.RegionName, otherRegion.RegionName, xcell, ycell);
|
||||
|
||||
if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
|
||||
{
|
||||
for (int i = 0; i < m_neighbours.Count; i++)
|
||||
{
|
||||
// The purpose of this loop is to re-update the known neighbors
|
||||
// when another region comes up on top of another one.
|
||||
// The latest region in that location ends up in the
|
||||
// 'known neighbors list'
|
||||
// Additionally, the commFailTF property gets reset to false.
|
||||
if (m_neighbours[i].RegionHandle == otherRegion.RegionHandle)
|
||||
{
|
||||
lock (m_neighbours)
|
||||
{
|
||||
m_neighbours[i] = otherRegion;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the value isn't in the neighbours, add it.
|
||||
// If the RegionInfo isn't exact but is for the same XY World location,
|
||||
// then the above loop will fix that.
|
||||
|
||||
if (!(CheckNeighborRegion(otherRegion)))
|
||||
{
|
||||
lock (m_neighbours)
|
||||
{
|
||||
m_neighbours.Add(otherRegion);
|
||||
//m_log.Info("[UP]: " + otherRegion.RegionHandle.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
// If these are cast to INT because long + negative values + abs returns invalid data
|
||||
int resultX = Math.Abs((int)otherRegion.RegionLocX - (int)RegionInfo.RegionLocX);
|
||||
int resultY = Math.Abs((int)otherRegion.RegionLocY - (int)RegionInfo.RegionLocY);
|
||||
int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX);
|
||||
int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY);
|
||||
if (resultX <= 1 && resultY <= 1)
|
||||
{
|
||||
// Let the grid service module know, so this can be cached
|
||||
m_eventManager.TriggerOnRegionUp(otherRegion);
|
||||
|
||||
RegionInfo regInfo = new RegionInfo(xcell, ycell, otherRegion.InternalEndPoint, otherRegion.ExternalHostName);
|
||||
regInfo.RegionID = otherRegion.RegionID;
|
||||
regInfo.RegionName = otherRegion.RegionName;
|
||||
regInfo.ScopeID = otherRegion.ScopeID;
|
||||
regInfo.ExternalHostName = otherRegion.ExternalHostName;
|
||||
|
||||
try
|
||||
{
|
||||
ForEachScenePresence(delegate(ScenePresence agent)
|
||||
@@ -632,7 +633,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
List<ulong> old = new List<ulong>();
|
||||
old.Add(otherRegion.RegionHandle);
|
||||
agent.DropOldNeighbours(old);
|
||||
InformClientOfNeighbor(agent, otherRegion);
|
||||
InformClientOfNeighbor(agent, regInfo);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -643,6 +644,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// This shouldn't happen too often anymore.
|
||||
m_log.Error("[SCENE]: Couldn't inform client of regionup because we got a null reference exception");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -651,7 +653,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
otherRegion.RegionLocY.ToString() + ")");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void AddNeighborRegion(RegionInfo region)
|
||||
@@ -683,9 +684,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
// Alias IncomingHelloNeighbour OtherRegionUp, for now
|
||||
public bool IncomingHelloNeighbour(RegionInfo neighbour)
|
||||
public GridRegion IncomingHelloNeighbour(RegionInfo neighbour)
|
||||
{
|
||||
return OtherRegionUp(neighbour);
|
||||
OtherRegionUp(new GridRegion(neighbour));
|
||||
return new GridRegion(RegionInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -994,7 +996,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
// Loop it
|
||||
if (m_frame == Int32.MaxValue)
|
||||
m_frame = 0;
|
||||
m_frame = 0;
|
||||
|
||||
otherMS = Environment.TickCount;
|
||||
// run through all entities looking for updates (slow)
|
||||
@@ -1336,24 +1338,31 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
RegisterCommsEvents();
|
||||
|
||||
// These two 'commands' *must be* next to each other or sim rebooting fails.
|
||||
m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo);
|
||||
//m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo);
|
||||
|
||||
GridRegion region = new GridRegion(RegionInfo);
|
||||
bool success = GridService.RegisterRegion(RegionInfo.ScopeID, region);
|
||||
if (!success)
|
||||
throw new Exception("Can't register with grid");
|
||||
|
||||
m_sceneGridService.SetScene(this);
|
||||
m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
|
||||
|
||||
Dictionary<string, string> dGridSettings = m_sceneGridService.GetGridSettings();
|
||||
//Dictionary<string, string> dGridSettings = m_sceneGridService.GetGridSettings();
|
||||
|
||||
if (dGridSettings.ContainsKey("allow_forceful_banlines"))
|
||||
{
|
||||
if (dGridSettings["allow_forceful_banlines"] != "TRUE")
|
||||
{
|
||||
m_log.Info("[GRID]: Grid is disabling forceful parcel banlists");
|
||||
EventManager.TriggerSetAllowForcefulBan(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("[GRID]: Grid is allowing forceful parcel banlists");
|
||||
EventManager.TriggerSetAllowForcefulBan(true);
|
||||
}
|
||||
}
|
||||
//if (dGridSettings.ContainsKey("allow_forceful_banlines"))
|
||||
//{
|
||||
// if (dGridSettings["allow_forceful_banlines"] != "TRUE")
|
||||
// {
|
||||
// m_log.Info("[GRID]: Grid is disabling forceful parcel banlists");
|
||||
// EventManager.TriggerSetAllowForcefulBan(false);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_log.Info("[GRID]: Grid is allowing forceful parcel banlists");
|
||||
// EventManager.TriggerSetAllowForcefulBan(true);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2014,12 +2023,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Cardinals.W:
|
||||
case Cardinals.W:
|
||||
foreach (Border b in WestBorders)
|
||||
{
|
||||
if (b.TestCross(position))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2717,10 +2726,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId);
|
||||
if (UserProfile != null)
|
||||
{
|
||||
RegionInfo regionInfo = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegionID);
|
||||
GridRegion regionInfo = GridService.GetRegionByUUID(UUID.Zero, UserProfile.HomeRegionID);
|
||||
if (regionInfo == null)
|
||||
{
|
||||
regionInfo = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegion);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(UserProfile.HomeRegion, out x, out y);
|
||||
regionInfo = GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
|
||||
if (regionInfo != null) // home region can be away temporarily, too
|
||||
{
|
||||
UserProfile.HomeRegionID = regionInfo.RegionID;
|
||||
@@ -3074,7 +3085,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_sceneGridService.OnExpectUser += HandleNewUserConnection;
|
||||
m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing;
|
||||
m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent;
|
||||
m_sceneGridService.OnRegionUp += OtherRegionUp;
|
||||
//m_eventManager.OnRegionUp += OtherRegionUp;
|
||||
//m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
|
||||
m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
|
||||
//m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
|
||||
@@ -3102,7 +3113,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
//m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
|
||||
m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
|
||||
//m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
|
||||
m_sceneGridService.OnRegionUp -= OtherRegionUp;
|
||||
//m_eventManager.OnRegionUp -= OtherRegionUp;
|
||||
m_sceneGridService.OnExpectUser -= HandleNewUserConnection;
|
||||
m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing;
|
||||
m_sceneGridService.OnCloseAgentConnection -= IncomingCloseAgent;
|
||||
@@ -3111,7 +3122,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (m_interregionCommsIn != null)
|
||||
m_interregionCommsIn.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
|
||||
|
||||
// this does nothing; should be removed
|
||||
m_sceneGridService.Close();
|
||||
|
||||
if (!GridService.DeregisterRegion(m_regInfo.RegionID))
|
||||
m_log.WarnFormat("[SCENE]: Deregister from grid failed for region {0}", m_regInfo.RegionName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -3255,7 +3270,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region",
|
||||
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||
//reason = String.Format("You are not currently on the access list for {0}",RegionInfo.RegionName);
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3404,7 +3419,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// We've got an update about an agent that sees into this region,
|
||||
/// send it to ScenePresence for processing It's the full data.
|
||||
/// </summary>
|
||||
/// <param name="cAgentData">Agent that contains all of the relevant things about an agent.
|
||||
/// <param name="cAgentData">Agent that contains all of the relevant things about an agent.
|
||||
/// Appearance, animations, position, etc.</param>
|
||||
/// <returns>true if we handled it.</returns>
|
||||
public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData)
|
||||
@@ -3556,30 +3571,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_sceneGridService.EnableNeighbourChildAgents(presence, m_neighbours);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests information about this region from gridcomms
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <returns></returns>
|
||||
public RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle)
|
||||
{
|
||||
return m_sceneGridService.RequestNeighbouringRegionInfo(regionHandle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests textures for map from minimum region to maximum region in world cordinates
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="minX"></param>
|
||||
/// <param name="minY"></param>
|
||||
/// <param name="maxX"></param>
|
||||
/// <param name="maxY"></param>
|
||||
public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY)
|
||||
{
|
||||
m_log.DebugFormat("[MAPBLOCK]: {0}-{1}, {2}-{3}", minX, minY, maxX, maxY);
|
||||
m_sceneGridService.RequestMapBlocks(remoteClient, minX, minY, maxX, maxY);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to teleport agent to other region.
|
||||
/// </summary>
|
||||
@@ -3591,7 +3582,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position,
|
||||
Vector3 lookat, uint teleportFlags)
|
||||
{
|
||||
RegionInfo regionInfo = m_sceneGridService.RequestClosestRegion(regionName);
|
||||
GridRegion regionInfo = GridService.GetRegionByName(UUID.Zero, regionName);
|
||||
if (regionInfo == null)
|
||||
{
|
||||
// can't find the region: Tell viewer and abort
|
||||
@@ -3680,7 +3671,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="position"></param>
|
||||
public void RequestTeleportLandmark(IClientAPI remoteClient, UUID regionID, Vector3 position)
|
||||
{
|
||||
RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(regionID);
|
||||
GridRegion info = GridService.GetRegionByUUID(UUID.Zero, regionID);
|
||||
|
||||
if (info == null)
|
||||
{
|
||||
@@ -3864,10 +3855,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return LandChannel.GetLandObject((int)x, (int)y).landData;
|
||||
}
|
||||
|
||||
public RegionInfo RequestClosestRegion(string name)
|
||||
{
|
||||
return m_sceneGridService.RequestClosestRegion(name);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -4154,6 +4141,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_sceneGraph.ForEachClient(action);
|
||||
}
|
||||
|
||||
public void ForEachSOG(Action<SceneObjectGroup> action)
|
||||
{
|
||||
m_sceneGraph.ForEachSOG(action);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of the entities in the scene. This is a new list so operations perform on the list itself
|
||||
/// will not affect the original list of objects in the scene.
|
||||
@@ -4178,14 +4170,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public void RegionHandleRequest(IClientAPI client, UUID regionID)
|
||||
{
|
||||
RegionInfo info;
|
||||
ulong handle = 0;
|
||||
if (regionID == RegionInfo.RegionID)
|
||||
info = RegionInfo;
|
||||
handle = RegionInfo.RegionHandle;
|
||||
else
|
||||
info = CommsManager.GridService.RequestNeighbourInfo(regionID);
|
||||
{
|
||||
GridRegion r = GridService.GetRegionByUUID(UUID.Zero, regionID);
|
||||
if (r != null)
|
||||
handle = r.RegionHandle;
|
||||
}
|
||||
|
||||
if (info != null)
|
||||
client.SendRegionHandle(regionID, info.RegionHandle);
|
||||
if (handle != 0)
|
||||
client.SendRegionHandle(regionID, handle);
|
||||
}
|
||||
|
||||
public void TerrainUnAcked(IClientAPI client, int patchX, int patchY)
|
||||
|
||||
@@ -36,6 +36,7 @@ using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
@@ -91,7 +92,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <value>
|
||||
/// Registered classes that are capable of creating entities.
|
||||
/// </value>
|
||||
protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>();
|
||||
protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>();
|
||||
|
||||
/// <summary>
|
||||
/// The last allocated local prim id. When a new local id is requested, the next number in the sequence is
|
||||
@@ -227,7 +228,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract bool OtherRegionUp(RegionInfo thisRegion);
|
||||
public abstract void OtherRegionUp(GridRegion otherRegion);
|
||||
|
||||
public virtual string GetSimulatorVersion()
|
||||
{
|
||||
@@ -278,7 +279,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
_primAllocateMutex.ReleaseMutex();
|
||||
|
||||
return myID;
|
||||
}
|
||||
}
|
||||
|
||||
#region Module Methods
|
||||
|
||||
@@ -472,7 +473,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <summary>
|
||||
/// Shows various details about the sim based on the parameters supplied by the console command in openSimMain.
|
||||
/// </summary>
|
||||
/// <param name="showParams">What to show</param>
|
||||
/// <param name="showParams">What to show</param>
|
||||
public virtual void Show(string[] showParams)
|
||||
{
|
||||
switch (showParams[0])
|
||||
@@ -488,7 +489,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddCommand(object mod, string command, string shorthelp, string longhelp, CommandDelegate callback)
|
||||
{
|
||||
|
||||
@@ -41,6 +41,7 @@ using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OSD = OpenMetaverse.StructuredData.OSD;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
@@ -58,11 +59,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
protected CommunicationsManager m_commsProvider;
|
||||
protected IInterregionCommsOut m_interregionCommsOut;
|
||||
protected RegionInfo m_regionInfo;
|
||||
protected Scene m_scene;
|
||||
|
||||
protected RegionCommsListener regionCommsHost;
|
||||
|
||||
protected List<UUID> m_agentsInTransit;
|
||||
|
||||
public bool RegionLoginsEnabled
|
||||
{
|
||||
get { return m_regionLoginsEnabled; }
|
||||
set { m_regionLoginsEnabled = value; }
|
||||
}
|
||||
private bool m_regionLoginsEnabled = false;
|
||||
|
||||
/// <summary>
|
||||
/// An agent is crossing into this region
|
||||
/// </summary>
|
||||
@@ -84,10 +93,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
public event PrimCrossing OnPrimCrossingIntoRegion;
|
||||
|
||||
/// <summary>
|
||||
/// A New Region is up and available
|
||||
/// </summary>
|
||||
public event RegionUp OnRegionUp;
|
||||
///// <summary>
|
||||
///// A New Region is up and available
|
||||
///// </summary>
|
||||
//public event RegionUp OnRegionUp;
|
||||
|
||||
/// <summary>
|
||||
/// We have a child agent for this avatar and we're getting a status update about it
|
||||
@@ -110,7 +119,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim;
|
||||
private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection;
|
||||
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
|
||||
private RegionUp handlerRegionUp = null; // OnRegionUp;
|
||||
//private RegionUp handlerRegionUp = null; // OnRegionUp;
|
||||
private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate;
|
||||
//private RemoveKnownRegionsFromAvatarList handlerRemoveKnownRegionFromAvatar = null; // OnRemoveKnownRegionFromAvatar;
|
||||
private LogOffUser handlerLogOffUser = null;
|
||||
@@ -124,6 +133,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_agentsInTransit = new List<UUID>();
|
||||
}
|
||||
|
||||
public void SetScene(Scene s)
|
||||
{
|
||||
m_scene = s;
|
||||
m_regionInfo = s.RegionInfo;
|
||||
m_interregionCommsOut = m_scene.RequestModuleInterface<IInterregionCommsOut>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register a region with the grid
|
||||
/// </summary>
|
||||
@@ -131,40 +147,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <exception cref="System.Exception">Thrown if region registration fails.</exception>
|
||||
public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos)
|
||||
{
|
||||
m_interregionCommsOut = comms_out;
|
||||
//m_interregionCommsOut = comms_out;
|
||||
|
||||
m_regionInfo = regionInfos;
|
||||
m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName;
|
||||
regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo);
|
||||
//m_regionInfo = regionInfos;
|
||||
//m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName;
|
||||
//regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo);
|
||||
|
||||
if (regionCommsHost != null)
|
||||
{
|
||||
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString());
|
||||
//if (regionCommsHost != null)
|
||||
//{
|
||||
// //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString());
|
||||
|
||||
regionCommsHost.debugRegionName = regionInfos.RegionName;
|
||||
regionCommsHost.OnExpectPrim += IncomingPrimCrossing;
|
||||
regionCommsHost.OnExpectUser += NewUserConnection;
|
||||
regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
|
||||
regionCommsHost.OnCloseAgentConnection += CloseConnection;
|
||||
regionCommsHost.OnRegionUp += newRegionUp;
|
||||
regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
|
||||
regionCommsHost.OnLogOffUser += GridLogOffUser;
|
||||
regionCommsHost.OnGetLandData += FetchLandData;
|
||||
}
|
||||
else
|
||||
{
|
||||
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got null");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a region with the name closest to string provided
|
||||
/// </summary>
|
||||
/// <param name="name">Partial Region Name for matching</param>
|
||||
/// <returns>Region Information for the region</returns>
|
||||
public RegionInfo RequestClosestRegion(string name)
|
||||
{
|
||||
return m_commsProvider.GridService.RequestClosestRegion(name);
|
||||
// regionCommsHost.debugRegionName = regionInfos.RegionName;
|
||||
// regionCommsHost.OnExpectPrim += IncomingPrimCrossing;
|
||||
// regionCommsHost.OnExpectUser += NewUserConnection;
|
||||
// regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
|
||||
// regionCommsHost.OnCloseAgentConnection += CloseConnection;
|
||||
// regionCommsHost.OnRegionUp += newRegionUp;
|
||||
// regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate;
|
||||
// regionCommsHost.OnLogOffUser += GridLogOffUser;
|
||||
// regionCommsHost.OnGetLandData += FetchLandData;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got null");
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -173,30 +179,31 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
if (regionCommsHost != null)
|
||||
{
|
||||
regionCommsHost.OnLogOffUser -= GridLogOffUser;
|
||||
regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate;
|
||||
regionCommsHost.OnRegionUp -= newRegionUp;
|
||||
regionCommsHost.OnExpectUser -= NewUserConnection;
|
||||
regionCommsHost.OnExpectPrim -= IncomingPrimCrossing;
|
||||
regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
|
||||
regionCommsHost.OnCloseAgentConnection -= CloseConnection;
|
||||
regionCommsHost.OnGetLandData -= FetchLandData;
|
||||
|
||||
//if (regionCommsHost != null)
|
||||
//{
|
||||
// regionCommsHost.OnLogOffUser -= GridLogOffUser;
|
||||
// regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate;
|
||||
// regionCommsHost.OnRegionUp -= newRegionUp;
|
||||
// regionCommsHost.OnExpectUser -= NewUserConnection;
|
||||
// regionCommsHost.OnExpectPrim -= IncomingPrimCrossing;
|
||||
// regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing;
|
||||
// regionCommsHost.OnCloseAgentConnection -= CloseConnection;
|
||||
// regionCommsHost.OnGetLandData -= FetchLandData;
|
||||
|
||||
try
|
||||
{
|
||||
m_commsProvider.GridService.DeregisterRegion(m_regionInfo);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[GRID]: Deregistration of region {0} from the grid failed - {1}. Continuing",
|
||||
m_regionInfo.RegionName, e);
|
||||
}
|
||||
// try
|
||||
// {
|
||||
// m_commsProvider.GridService.DeregisterRegion(m_regionInfo);
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// m_log.ErrorFormat(
|
||||
// "[GRID]: Deregistration of region {0} from the grid failed - {1}. Continuing",
|
||||
// m_regionInfo.RegionName, e);
|
||||
// }
|
||||
|
||||
regionCommsHost = null;
|
||||
}
|
||||
// regionCommsHost = null;
|
||||
//}
|
||||
}
|
||||
|
||||
#region CommsManager Event handlers
|
||||
@@ -231,22 +238,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A New Region is now available. Inform the scene that there is a new region available.
|
||||
/// </summary>
|
||||
/// <param name="region">Information about the new region that is available</param>
|
||||
/// <returns>True if the event was handled</returns>
|
||||
protected bool newRegionUp(RegionInfo region)
|
||||
{
|
||||
handlerRegionUp = OnRegionUp;
|
||||
if (handlerRegionUp != null)
|
||||
{
|
||||
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: newRegionUp Fired for User:" + region.RegionName);
|
||||
handlerRegionUp(region);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inform the scene that we've got an update about a child agent that we have
|
||||
/// </summary>
|
||||
@@ -330,7 +321,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
#region Inform Client of Neighbours
|
||||
|
||||
private delegate void InformClientOfNeighbourDelegate(
|
||||
ScenePresence avatar, AgentCircuitData a, SimpleRegionInfo reg, IPEndPoint endPoint, bool newAgent);
|
||||
ScenePresence avatar, AgentCircuitData a, GridRegion reg, IPEndPoint endPoint, bool newAgent);
|
||||
|
||||
private void InformClientOfNeighbourCompleted(IAsyncResult iar)
|
||||
{
|
||||
@@ -348,7 +339,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="a"></param>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="endPoint"></param>
|
||||
private void InformClientOfNeighbourAsync(ScenePresence avatar, AgentCircuitData a, SimpleRegionInfo reg,
|
||||
private void InformClientOfNeighbourAsync(ScenePresence avatar, AgentCircuitData a, GridRegion reg,
|
||||
IPEndPoint endPoint, bool newAgent)
|
||||
{
|
||||
// Let's wait just a little to give time to originating regions to catch up with closing child agents
|
||||
@@ -366,8 +357,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
string reason = String.Empty;
|
||||
|
||||
//bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, a);
|
||||
|
||||
|
||||
bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, out reason);
|
||||
|
||||
if (regionAccepted && newAgent)
|
||||
@@ -400,17 +390,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
}
|
||||
|
||||
public void RequestNeighbors(RegionInfo region)
|
||||
{
|
||||
// List<SimpleRegionInfo> neighbours =
|
||||
m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
|
||||
//IPEndPoint blah = new IPEndPoint();
|
||||
|
||||
//blah.Address = region.RemotingAddress;
|
||||
//blah.Port = region.RemotingPort;
|
||||
}
|
||||
|
||||
public List<SimpleRegionInfo> RequestNeighbors(Scene pScene, uint pRegionLocX, uint pRegionLocY)
|
||||
public List<GridRegion> RequestNeighbours(Scene pScene, uint pRegionLocX, uint pRegionLocY)
|
||||
{
|
||||
Border[] northBorders = pScene.NorthBorders.ToArray();
|
||||
Border[] southBorders = pScene.SouthBorders.ToArray();
|
||||
@@ -420,50 +400,34 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// Legacy one region. Provided for simplicity while testing the all inclusive method in the else statement.
|
||||
if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1)
|
||||
{
|
||||
return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY);
|
||||
return m_scene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector2 extent = Vector2.Zero;
|
||||
for (int i=0;i<eastBorders.Length;i++)
|
||||
for (int i = 0; i < eastBorders.Length; i++)
|
||||
{
|
||||
extent.X = (eastBorders[i].BorderLine.Z > extent.X) ? eastBorders[i].BorderLine.Z : extent.X;
|
||||
}
|
||||
for (int i=0;i<northBorders.Length;i++)
|
||||
for (int i = 0; i < northBorders.Length; i++)
|
||||
{
|
||||
extent.Y = (northBorders[i].BorderLine.Z > extent.Y) ? northBorders[i].BorderLine.Z : extent.Y;
|
||||
}
|
||||
|
||||
List<SimpleRegionInfo> neighbourList = new List<SimpleRegionInfo>();
|
||||
|
||||
// Loss of fraction on purpose
|
||||
extent.X = ((int)extent.X / (int)Constants.RegionSize) + 1;
|
||||
extent.Y = ((int)extent.Y / (int)Constants.RegionSize) + 1;
|
||||
|
||||
int startX = (int) pRegionLocX - 1;
|
||||
int startY = (int) pRegionLocY - 1;
|
||||
int startX = (int)(pRegionLocX - 1) * (int)Constants.RegionSize;
|
||||
int startY = (int)(pRegionLocY - 1) * (int)Constants.RegionSize;
|
||||
|
||||
int endX = (int) pRegionLocX + (int)extent.X;
|
||||
int endY = (int) pRegionLocY + (int)extent.Y;
|
||||
int endX = ((int)pRegionLocX + (int)extent.X) * (int)Constants.RegionSize;
|
||||
int endY = ((int)pRegionLocY + (int)extent.Y) * (int)Constants.RegionSize;
|
||||
|
||||
for (int i=startX;i<endX;i++)
|
||||
{
|
||||
for (int j=startY;j<endY;j++)
|
||||
{
|
||||
// Skip CurrentRegion
|
||||
if (i == (int)pRegionLocX && j == (int)pRegionLocY)
|
||||
continue;
|
||||
List<GridRegion> neighbours = m_scene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY);
|
||||
neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
|
||||
|
||||
ulong regionHandle = Util.UIntsToLong((uint)(i * Constants.RegionSize),
|
||||
(uint)(j * Constants.RegionSize));
|
||||
RegionInfo neighborreg = m_commsProvider.GridService.RequestNeighbourInfo(regionHandle);
|
||||
if (neighborreg != null)
|
||||
{
|
||||
neighbourList.Add(neighborreg);
|
||||
}
|
||||
}
|
||||
}
|
||||
return neighbourList;
|
||||
return neighbours;
|
||||
//SimpleRegionInfo regionData = m_commsProvider.GridService.RequestNeighbourInfo()
|
||||
//return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY);
|
||||
}
|
||||
@@ -475,29 +439,28 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// </summary>
|
||||
public void EnableNeighbourChildAgents(ScenePresence avatar, List<RegionInfo> lstneighbours)
|
||||
{
|
||||
List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
|
||||
//List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
|
||||
List<GridRegion> neighbours = new List<GridRegion>();
|
||||
|
||||
//m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
|
||||
for (int i = 0; i < lstneighbours.Count; i++)
|
||||
{
|
||||
// We don't want to keep sending to regions that consistently fail on comms.
|
||||
if (!(lstneighbours[i].commFailTF))
|
||||
{
|
||||
neighbours.Add(new SimpleRegionInfo(lstneighbours[i]));
|
||||
}
|
||||
}
|
||||
////m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
|
||||
//for (int i = 0; i < lstneighbours.Count; i++)
|
||||
//{
|
||||
// // We don't want to keep sending to regions that consistently fail on comms.
|
||||
// if (!(lstneighbours[i].commFailTF))
|
||||
// {
|
||||
// neighbours.Add(new SimpleRegionInfo(lstneighbours[i]));
|
||||
// }
|
||||
//}
|
||||
// we're going to be using the above code once neighbour cache is correct. Currently it doesn't appear to be
|
||||
// So we're temporarily going back to the old method of grabbing it from the Grid Server Every time :/
|
||||
if (m_regionInfo != null)
|
||||
{
|
||||
neighbours =
|
||||
RequestNeighbors(avatar.Scene,m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
|
||||
neighbours = RequestNeighbours(avatar.Scene,m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Debug("[ENABLENEIGHBOURCHILDAGENTS]: m_regionInfo was null in EnableNeighbourChildAgents, is this a NPC?");
|
||||
}
|
||||
|
||||
|
||||
/// We need to find the difference between the new regions where there are no child agents
|
||||
/// and the regions where there are already child agents. We only send notification to the former.
|
||||
@@ -540,8 +503,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
/// Create the necessary child agents
|
||||
List<AgentCircuitData> cagents = new List<AgentCircuitData>();
|
||||
foreach (SimpleRegionInfo neighbour in neighbours)
|
||||
{
|
||||
//foreach (SimpleRegionInfo neighbour in neighbours)
|
||||
foreach (GridRegion neighbour in neighbours)
|
||||
{
|
||||
if (neighbour.RegionHandle != avatar.Scene.RegionInfo.RegionHandle)
|
||||
{
|
||||
|
||||
@@ -581,7 +545,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
bool newAgent = false;
|
||||
int count = 0;
|
||||
foreach (SimpleRegionInfo neighbour in neighbours)
|
||||
foreach (GridRegion neighbour in neighbours)
|
||||
{
|
||||
// Don't do it if there's already an agent in that region
|
||||
if (newRegions.Contains(neighbour.RegionHandle))
|
||||
@@ -634,7 +598,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// This informs a single neighboring region about agent "avatar".
|
||||
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
|
||||
/// </summary>
|
||||
public void InformNeighborChildAgent(ScenePresence avatar, SimpleRegionInfo region)
|
||||
public void InformNeighborChildAgent(ScenePresence avatar, GridRegion region)
|
||||
{
|
||||
AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
|
||||
agent.BaseFolder = UUID.Zero;
|
||||
@@ -665,61 +629,63 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="regionhandle"></param>
|
||||
private void InformNeighboursThatRegionIsUpAsync(INeighbourService neighbourService, RegionInfo region, ulong regionhandle)
|
||||
{
|
||||
m_log.Info("[INTERGRID]: Starting to inform neighbors that I'm here");
|
||||
//RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionhandle, out x, out y);
|
||||
|
||||
//bool regionAccepted =
|
||||
// m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region), regionhandle);
|
||||
|
||||
//bool regionAccepted = m_interregionCommsOut.SendHelloNeighbour(regionhandle, region);
|
||||
bool regionAccepted = false;
|
||||
GridRegion neighbour = null;
|
||||
if (neighbourService != null)
|
||||
regionAccepted = neighbourService.HelloNeighbour(regionhandle, region);
|
||||
neighbour = neighbourService.HelloNeighbour(regionhandle, region);
|
||||
else
|
||||
m_log.DebugFormat("[SCS]: No neighbour service provided for informing neigbhours of this region");
|
||||
|
||||
if (regionAccepted)
|
||||
if (neighbour != null)
|
||||
{
|
||||
m_log.Info("[INTERGRID]: Completed informing neighbors that I'm here");
|
||||
handlerRegionUp = OnRegionUp;
|
||||
|
||||
// yes, we're notifying ourselves.
|
||||
if (handlerRegionUp != null)
|
||||
handlerRegionUp(region);
|
||||
m_log.DebugFormat("[INTERGRID]: Successfully informed neighbour {0}-{1} that I'm here", x / Constants.RegionSize, y / Constants.RegionSize);
|
||||
m_scene.EventManager.TriggerOnRegionUp(neighbour);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Warn("[INTERGRID]: Failed to inform neighbors that I'm here.");
|
||||
m_log.WarnFormat("[INTERGRID]: Failed to inform neighbour {0}-{1} that I'm here.", x / Constants.RegionSize, y / Constants.RegionSize);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called by scene when region is initialized (not always when it's listening for agents)
|
||||
/// This is an inter-region message that informs the surrounding neighbors that the sim is up.
|
||||
/// </summary>
|
||||
|
||||
public void InformNeighborsThatRegionisUp(INeighbourService neighbourService, RegionInfo region)
|
||||
{
|
||||
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
|
||||
|
||||
|
||||
List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
|
||||
// This stays uncached because we don't already know about our neighbors at this point.
|
||||
neighbours = m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
|
||||
if (neighbours != null)
|
||||
{
|
||||
for (int i = 0; i < neighbours.Count; i++)
|
||||
{
|
||||
InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
|
||||
for (int x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++)
|
||||
for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++)
|
||||
if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region
|
||||
{
|
||||
ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize);
|
||||
InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
|
||||
|
||||
d.BeginInvoke(neighbourService, region, neighbours[i].RegionHandle,
|
||||
InformNeighborsThatRegionisUpCompleted,
|
||||
d);
|
||||
}
|
||||
}
|
||||
d.BeginInvoke(neighbourService, region, handle,
|
||||
InformNeighborsThatRegionisUpCompleted,
|
||||
d);
|
||||
}
|
||||
|
||||
//List<GridRegion> neighbours = new List<GridRegion>();
|
||||
//// This stays uncached because we don't already know about our neighbors at this point.
|
||||
|
||||
//neighbours = m_scene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID);
|
||||
//if (neighbours != null)
|
||||
//{
|
||||
// for (int i = 0; i < neighbours.Count; i++)
|
||||
// {
|
||||
// InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
|
||||
|
||||
// d.BeginInvoke(neighbourService, region, neighbours[i].RegionHandle,
|
||||
// InformNeighborsThatRegionisUpCompleted,
|
||||
// d);
|
||||
// }
|
||||
//}
|
||||
|
||||
//bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region));
|
||||
}
|
||||
|
||||
|
||||
public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, ulong regionHandle);
|
||||
|
||||
/// <summary>
|
||||
@@ -815,41 +781,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper function to request neighbors from grid-comms
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <returns></returns>
|
||||
public virtual RegionInfo RequestNeighbouringRegionInfo(ulong regionHandle)
|
||||
{
|
||||
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending Grid Services Request about neighbor " + regionHandle.ToString());
|
||||
return m_commsProvider.GridService.RequestNeighbourInfo(regionHandle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper function to request neighbors from grid-comms
|
||||
/// </summary>
|
||||
/// <param name="regionID"></param>
|
||||
/// <returns></returns>
|
||||
public virtual RegionInfo RequestNeighbouringRegionInfo(UUID regionID)
|
||||
{
|
||||
//m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending Grid Services Request about neighbor " + regionID);
|
||||
return m_commsProvider.GridService.RequestNeighbourInfo(regionID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Requests map blocks in area of minX, maxX, minY, MaxY in world cordinates
|
||||
/// </summary>
|
||||
/// <param name="minX"></param>
|
||||
/// <param name="minY"></param>
|
||||
/// <param name="maxX"></param>
|
||||
/// <param name="maxY"></param>
|
||||
public virtual void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY)
|
||||
{
|
||||
List<MapBlockData> mapBlocks;
|
||||
mapBlocks = m_commsProvider.GridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, minX + 4, minY + 4);
|
||||
remoteClient.SendMapBlock(mapBlocks, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to teleport an agent to a new region.
|
||||
@@ -914,7 +845,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
else
|
||||
{
|
||||
RegionInfo reg = RequestNeighbouringRegionInfo(regionHandle);
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(regionHandle, out x, out y);
|
||||
GridRegion reg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
|
||||
if (reg != null)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
@@ -1163,7 +1097,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsOutsideRegion(Scene s, Vector3 pos)
|
||||
protected bool IsOutsideRegion(Scene s, Vector3 pos)
|
||||
{
|
||||
|
||||
if (s.TestBorderCross(pos,Cardinals.N))
|
||||
@@ -1221,10 +1155,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return false;
|
||||
}
|
||||
|
||||
private List<ulong> NeighbourHandles(List<SimpleRegionInfo> neighbours)
|
||||
private List<ulong> NeighbourHandles(List<GridRegion> neighbours)
|
||||
{
|
||||
List<ulong> handles = new List<ulong>();
|
||||
foreach (SimpleRegionInfo reg in neighbours)
|
||||
foreach (GridRegion reg in neighbours)
|
||||
{
|
||||
handles.Add(reg.RegionHandle);
|
||||
}
|
||||
@@ -1475,7 +1409,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_log.DebugFormat("[SCENE COMM]: Crossing agent {0} {1} to {2}-{3}", agent.Firstname, agent.Lastname, neighbourx, neighboury);
|
||||
|
||||
ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
|
||||
SimpleRegionInfo neighbourRegion = RequestNeighbouringRegionInfo(neighbourHandle);
|
||||
|
||||
int x = (int)(neighbourx * Constants.RegionSize), y = (int)(neighboury * Constants.RegionSize);
|
||||
GridRegion neighbourRegion = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||
|
||||
if (neighbourRegion != null && agent.ValidateAttachments())
|
||||
{
|
||||
pos = pos + (agent.Velocity);
|
||||
@@ -1602,11 +1539,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
|
||||
public Dictionary<string, string> GetGridSettings()
|
||||
{
|
||||
return m_commsProvider.GridService.GetGridSettings();
|
||||
}
|
||||
|
||||
public void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat)
|
||||
{
|
||||
m_commsProvider.LogOffUser(userid, regionid, regionhandle, position, lookat);
|
||||
@@ -1643,19 +1575,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return m_commsProvider.GetUserFriendList(friendlistowner);
|
||||
}
|
||||
|
||||
public List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY)
|
||||
{
|
||||
return m_commsProvider.GridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY);
|
||||
}
|
||||
|
||||
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(UUID queryID, string query)
|
||||
{
|
||||
return m_commsProvider.GenerateAgentPickerRequestResponse(queryID, query);
|
||||
}
|
||||
|
||||
public List<RegionInfo> RequestNamedRegions(string name, int maxNumber)
|
||||
public List<GridRegion> RequestNamedRegions(string name, int maxNumber)
|
||||
{
|
||||
return m_commsProvider.GridService.RequestNamedRegions(name, maxNumber);
|
||||
return m_scene.GridService.GetRegionsByName(UUID.Zero, name, maxNumber);
|
||||
}
|
||||
|
||||
//private void Dump(string msg, List<ulong> handles)
|
||||
|
||||
@@ -845,7 +845,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
ScenePresence sp;
|
||||
|
||||
lock (ScenePresences)
|
||||
{
|
||||
{
|
||||
ScenePresences.TryGetValue(agentID, out sp);
|
||||
}
|
||||
|
||||
@@ -1134,6 +1134,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
protected internal void ForEachSOG(Action<SceneObjectGroup> action)
|
||||
{
|
||||
List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
|
||||
foreach (SceneObjectGroup obj in objlist)
|
||||
{
|
||||
try
|
||||
{
|
||||
action(obj);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Catch it and move on. This includes situations where splist has inconsistent info
|
||||
m_log.WarnFormat("[SCENE]: Problem processing action in ForEachSOG: ", e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Client Event handlers
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void SaveCurrentSceneToXml(string filename)
|
||||
{
|
||||
IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
|
||||
if (serialiser != null)
|
||||
if (serialiser != null)
|
||||
serialiser.SavePrimsToXml(CurrentOrFirstScene, filename);
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void LoadCurrentSceneFromXml(string filename, bool generateNewIDs, Vector3 loadOffset)
|
||||
{
|
||||
IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
|
||||
if (serialiser != null)
|
||||
if (serialiser != null)
|
||||
serialiser.LoadPrimsFromXml(CurrentOrFirstScene, filename, generateNewIDs, loadOffset);
|
||||
}
|
||||
|
||||
@@ -216,14 +216,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void SaveCurrentSceneToXml2(string filename)
|
||||
{
|
||||
IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
|
||||
if (serialiser != null)
|
||||
if (serialiser != null)
|
||||
serialiser.SavePrimsToXml2(CurrentOrFirstScene, filename);
|
||||
}
|
||||
|
||||
public void SaveNamedPrimsToXml2(string primName, string filename)
|
||||
{
|
||||
IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
|
||||
if (serialiser != null)
|
||||
if (serialiser != null)
|
||||
serialiser.SaveNamedPrimsToXml2(CurrentOrFirstScene, primName, filename);
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void LoadCurrentSceneFromXml2(string filename)
|
||||
{
|
||||
IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface<IRegionSerialiserModule>();
|
||||
if (serialiser != null)
|
||||
if (serialiser != null)
|
||||
serialiser.LoadPrimsFromXml2(CurrentOrFirstScene, filename);
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void LoadArchiveToCurrentScene(string filename)
|
||||
{
|
||||
IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>();
|
||||
if (archiver != null)
|
||||
if (archiver != null)
|
||||
archiver.DearchiveRegion(filename);
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// Is this scene object acting as an attachment?
|
||||
///
|
||||
/// We return false if the group has already been deleted.
|
||||
///
|
||||
///
|
||||
/// TODO: At the moment set must be done on the part itself. There may be a case for doing it here since I
|
||||
/// presume either all or no parts in a linkset can be part of an attachment (in which
|
||||
/// case the value would get proprogated down into all the descendent parts).
|
||||
@@ -245,6 +245,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsAttachmentCheckFull()
|
||||
{
|
||||
return (IsAttachment || (m_rootPart.Shape.PCode == 9 && m_rootPart.Shape.State != 0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The absolute position of this scene object in the scene
|
||||
/// </summary>
|
||||
@@ -257,8 +262,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
|
||||
|| m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
|
||||
&& !IsAttachment)
|
||||
{
|
||||
&& !IsAttachmentCheckFull())
|
||||
{
|
||||
m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
|
||||
}
|
||||
|
||||
@@ -449,7 +454,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <param name="scene"></param>
|
||||
public void AttachToScene(Scene scene)
|
||||
{
|
||||
m_scene = scene;
|
||||
m_scene = scene;
|
||||
RegionHandle = m_scene.RegionInfo.RegionHandle;
|
||||
|
||||
if (m_rootPart.Shape.PCode != 9 || m_rootPart.Shape.State == 0)
|
||||
@@ -474,9 +479,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
//m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID);
|
||||
}
|
||||
|
||||
ApplyPhysics(m_scene.m_physicalPrim);
|
||||
ApplyPhysics(m_scene.m_physicalPrim);
|
||||
|
||||
ScheduleGroupForFullUpdate();
|
||||
ScheduleGroupForFullUpdate();
|
||||
}
|
||||
|
||||
public Vector3 GroupScale()
|
||||
@@ -1032,12 +1037,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_rootPart = part;
|
||||
if (!IsAttachment)
|
||||
part.ParentID = 0;
|
||||
part.LinkNum = 0;
|
||||
part.LinkNum = 0;
|
||||
|
||||
// No locking required since the SOG should not be in the scene yet - one can't change root parts after
|
||||
// the scene object has been attached to the scene
|
||||
m_parts.Add(m_rootPart.UUID, m_rootPart);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a new part to this scene object. The part must already be correctly configured.
|
||||
@@ -1155,7 +1160,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
/// <summary>
|
||||
/// Delete this group from its scene and tell all the scene presences about that deletion.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
/// <param name="silent">Broadcast deletions to all clients.</param>
|
||||
public void DeleteGroup(bool silent)
|
||||
{
|
||||
@@ -1262,11 +1267,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (part.LocalId != m_rootPart.LocalId)
|
||||
{
|
||||
part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive, m_physicalPrim);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hack to get the physics scene geometries in the right spot
|
||||
ResetChildPrimPhysicsPositions();
|
||||
ResetChildPrimPhysicsPositions();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1489,7 +1494,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
List<SceneObjectPart> partList;
|
||||
|
||||
lock (m_parts)
|
||||
{
|
||||
{
|
||||
partList = new List<SceneObjectPart>(m_parts.Values);
|
||||
}
|
||||
|
||||
@@ -1739,7 +1744,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
rootpart.PhysActor.PIDHoverActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -42,7 +42,7 @@ using OpenSim.Region.Framework.Scenes.Scripting;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
{
|
||||
#region Enumerations
|
||||
|
||||
[Flags]
|
||||
@@ -142,7 +142,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public UUID FromItemID = UUID.Zero;
|
||||
|
||||
/// <value>
|
||||
/// The UUID of the user inventory item from which this object was rezzed if this is a root part.
|
||||
/// The UUID of the user inventory item from which this object was rezzed if this is a root part.
|
||||
/// If UUID.Zero then either this is not a root part or there is no connection with a user inventory item.
|
||||
/// </value>
|
||||
private UUID m_fromUserInventoryItemID = UUID.Zero;
|
||||
@@ -187,7 +187,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public IEntityInventory Inventory
|
||||
{
|
||||
get { return m_inventory; }
|
||||
}
|
||||
}
|
||||
protected SceneObjectPartInventory m_inventory;
|
||||
|
||||
[XmlIgnore]
|
||||
@@ -309,9 +309,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
RotationOffset = rotationOffset;
|
||||
Velocity = new Vector3(0, 0, 0);
|
||||
AngularVelocity = new Vector3(0, 0, 0);
|
||||
Acceleration = new Vector3(0, 0, 0);
|
||||
Acceleration = new Vector3(0, 0, 0);
|
||||
m_TextureAnimation = new byte[0];
|
||||
m_particleSystem = new byte[0];
|
||||
m_particleSystem = new byte[0];
|
||||
|
||||
// Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
|
||||
// this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
|
||||
@@ -363,7 +363,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
/// <summary>
|
||||
/// A relic from when we we thought that prims contained folder objects. In
|
||||
/// reality, prim == folder
|
||||
/// reality, prim == folder
|
||||
/// Exposing this is not particularly good, but it's one of the least evils at the moment to see
|
||||
/// folder id from prim inventory item data, since it's not (yet) actually stored with the prim.
|
||||
/// </summary>
|
||||
@@ -384,7 +384,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
/// <value>
|
||||
/// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes
|
||||
/// </value>
|
||||
/// </value>
|
||||
public TaskInventoryDictionary TaskInventory
|
||||
{
|
||||
get { return m_inventory.Items; }
|
||||
@@ -3386,7 +3386,7 @@ if (m_shape != null) {
|
||||
}
|
||||
else
|
||||
{
|
||||
IsPhantom = false;
|
||||
IsPhantom = false;
|
||||
// If volumedetect is active we don't want phantom to be applied.
|
||||
// If this is a new call to VD out of the state "phantom"
|
||||
// this will also cause the prim to be visible to physics
|
||||
@@ -3455,6 +3455,7 @@ if (m_shape != null) {
|
||||
RotationOffset,
|
||||
UsePhysics);
|
||||
|
||||
pa = PhysActor;
|
||||
if (pa != null)
|
||||
{
|
||||
pa.LocalID = LocalId;
|
||||
@@ -3483,7 +3484,7 @@ if (m_shape != null) {
|
||||
}
|
||||
else // it already has a physical representation
|
||||
{
|
||||
pa.IsPhysical = UsePhysics;
|
||||
pa.IsPhysical = UsePhysics;
|
||||
|
||||
DoPhysicsPropertyUpdate(UsePhysics, false); // Update physical status. If it's phantom this will remove the prim
|
||||
if (m_parentGroup != null)
|
||||
@@ -3513,11 +3514,10 @@ if (m_shape != null) {
|
||||
AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
|
||||
this.VolumeDetectActive = true;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{ // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
|
||||
// (mumbles, well, at least if you have infinte CPU powers :-) )
|
||||
// (mumbles, well, at least if you have infinte CPU powers :-))
|
||||
PhysicsActor pa = this.PhysActor;
|
||||
if (pa != null)
|
||||
{
|
||||
@@ -3775,7 +3775,7 @@ if (m_shape != null) {
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("{0} {1} (parent {2}))", Name, UUID, ParentGroup);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -3823,11 +3823,11 @@ if (m_shape != null) {
|
||||
_everyoneMask &= _nextOwnerMask;
|
||||
|
||||
Inventory.ApplyNextOwnerPermissions();
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanBeDeleted()
|
||||
{
|
||||
return Inventory.CanBeDeleted();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
public void ForceInventoryPersistence()
|
||||
{
|
||||
HasInventoryChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset UUIDs for all the items in the prim's inventory. This involves either generating
|
||||
@@ -164,7 +164,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <summary>
|
||||
/// Change every item in this inventory to a new group.
|
||||
/// </summary>
|
||||
/// <param name="groupID"></param>
|
||||
/// <param name="groupID"></param>
|
||||
public void ChangeInventoryGroup(UUID groupID)
|
||||
{
|
||||
lock (Items)
|
||||
|
||||
@@ -36,6 +36,7 @@ using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes.Types;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
@@ -777,7 +778,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// Moved this from SendInitialData to ensure that m_appearance is initialized
|
||||
// before the inventory is processed in MakeRootAgent. This fixes a race condition
|
||||
// related to the handling of attachments
|
||||
//m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
|
||||
//m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
|
||||
if (m_scene.TestBorderCross(pos, Cardinals.E))
|
||||
{
|
||||
Border crossedBorder = m_scene.GetCrossedBorder(pos, Cardinals.E);
|
||||
@@ -1236,7 +1237,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
|
||||
{
|
||||
StandUp();
|
||||
}
|
||||
}
|
||||
|
||||
// Check if Client has camera in 'follow cam' or 'build' mode.
|
||||
Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation);
|
||||
@@ -1490,7 +1491,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
// m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed));
|
||||
// m_log.DebugFormat(
|
||||
// "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3);
|
||||
// "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3);
|
||||
|
||||
AddNewMovement(agent_control_v3, q);
|
||||
|
||||
@@ -2271,7 +2272,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
//Record the time we enter this state so we know whether to "land" or not
|
||||
m_animPersistUntil = DateTime.Now.Ticks;
|
||||
return "FALLDOWN";
|
||||
return "FALLDOWN"; // this falling animation is invoked too frequently when capsule tilt correction is used - why?
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2307,14 +2308,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// Rotate the avatar to the given rotation and apply a movement in the given relative vector
|
||||
/// </summary>
|
||||
/// <param name="vec">The vector in which to move. This is relative to the rotation argument</param>
|
||||
/// <param name="rotation">The direction in which this avatar should now face.
|
||||
/// <param name="rotation">The direction in which this avatar should now face.
|
||||
public void AddNewMovement(Vector3 vec, Quaternion rotation)
|
||||
{
|
||||
if (m_isChildAgent)
|
||||
{
|
||||
m_log.Debug("DEBUG: AddNewMovement: child agent, Making root agent!");
|
||||
|
||||
// we have to reset the user's child agent connections.
|
||||
// we have to reset the user's child agent connections.
|
||||
// Likely, here they've lost the eventqueue for other regions so border
|
||||
// crossings will fail at this point unless we reset them.
|
||||
|
||||
@@ -2650,7 +2651,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// Tell the client for this scene presence what items it should be wearing now
|
||||
/// </summary>
|
||||
public void SendWearables()
|
||||
{
|
||||
{
|
||||
ControllingClient.SendWearables(m_appearance.Wearables, m_appearance.Serial++);
|
||||
}
|
||||
|
||||
@@ -2959,8 +2960,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
else if (dir > 3 && dir < 7) // Heading Sout
|
||||
neighboury--;
|
||||
|
||||
ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
|
||||
SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
|
||||
int x = (int)(neighbourx * Constants.RegionSize);
|
||||
int y = (int)(neighboury * Constants.RegionSize);
|
||||
GridRegion neighbourRegion = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, x, y);
|
||||
|
||||
if (neighbourRegion == null)
|
||||
{
|
||||
@@ -3198,7 +3200,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
else
|
||||
{
|
||||
wears[i++] = UUID.Zero;
|
||||
wears[i++] = UUID.Zero;
|
||||
wears[i++] = UUID.Zero;
|
||||
}
|
||||
}
|
||||
cAgent.Wearables = wears;
|
||||
@@ -3510,7 +3512,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public bool HasAttachments()
|
||||
{
|
||||
return m_attachments.Count > 0;
|
||||
return m_attachments.Count > 0;
|
||||
}
|
||||
|
||||
public bool HasScriptedAttachments()
|
||||
|
||||
@@ -122,13 +122,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
"[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serialize a scene object to the original xml format
|
||||
/// </summary>
|
||||
/// <param name="sceneObject"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>
|
||||
public static string ToOriginalXmlFormat(SceneObjectGroup sceneObject)
|
||||
{
|
||||
using (StringWriter sw = new StringWriter())
|
||||
@@ -140,13 +140,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
|
||||
return sw.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serialize a scene object to the original xml format
|
||||
/// </summary>
|
||||
/// <param name="sceneObject"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>
|
||||
public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer)
|
||||
{
|
||||
//m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name);
|
||||
@@ -238,13 +238,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
m_log.ErrorFormat("[SERIALIZER]: Deserialization of xml failed with {0}. xml was {1}", e, xmlData);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serialize a scene object to the 'xml2' format.
|
||||
/// </summary>
|
||||
/// <param name="sceneObject"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>
|
||||
public static string ToXml2Format(SceneObjectGroup sceneObject)
|
||||
{
|
||||
using (StringWriter sw = new StringWriter())
|
||||
@@ -262,7 +262,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
/// Serialize a scene object to the 'xml2' format.
|
||||
/// </summary>
|
||||
/// <param name="sceneObject"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns></returns>
|
||||
public static void ToXml2Format(SceneObjectGroup sceneObject, XmlTextWriter writer)
|
||||
{
|
||||
//m_log.DebugFormat("[SERIALIZER]: Starting serialization of SOG {0} to XML2", Name);
|
||||
@@ -288,6 +288,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
writer.WriteEndElement(); // End of SceneObjectGroup
|
||||
|
||||
//m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0} to XML2, {1}ms", Name, System.Environment.TickCount - time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
||||
}
|
||||
|
||||
SavePrimListToXml2(primList, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SavePrimListToXml2(List<EntityBase> entityList, string fileName)
|
||||
{
|
||||
|
||||
@@ -450,7 +450,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
addFrameMS(ms);
|
||||
addAgentMS(ms);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
[TestFixture, LongRunning]
|
||||
public class EntityManagerTests
|
||||
{
|
||||
{
|
||||
static public Random random;
|
||||
SceneObjectGroup found;
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
@@ -81,13 +81,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
|
||||
Assert.That(entman.ContainsKey(obj1), Is.False);
|
||||
Assert.That(entman.ContainsKey(li1), Is.False);
|
||||
Assert.That(entman.ContainsKey(obj2), Is.False);
|
||||
Assert.That(entman.ContainsKey(li2), Is.False);
|
||||
Assert.That(entman.ContainsKey(obj2), Is.False);
|
||||
Assert.That(entman.ContainsKey(li2), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void T011_ThreadAddRemoveTest()
|
||||
{
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
// Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
|
||||
|
||||
@@ -148,12 +148,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
int size = random.Next(40,80);
|
||||
char ch ;
|
||||
for (int i=0; i<size; i++)
|
||||
{
|
||||
{
|
||||
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
|
||||
name.Append(ch);
|
||||
}
|
||||
return name.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class NewTestThreads
|
||||
@@ -179,4 +179,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
entman.Remove(sog.UUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ using System;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
@@ -65,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override bool OtherRegionUp(RegionInfo thisRegion)
|
||||
public override void OtherRegionUp(GridRegion otherRegion)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -46,13 +46,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class SceneObjectBasicTests
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Test adding an object to a scene.
|
||||
/// </summary>
|
||||
[Test, LongRunning]
|
||||
public void TestAddSceneObject()
|
||||
{
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
|
||||
Scene scene = SceneSetupHelpers.SetupScene();
|
||||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
|
||||
//m_log.Debug("retrievedPart : {0}", retrievedPart);
|
||||
// If the parts have the same UUID then we will consider them as one and the same
|
||||
Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
|
||||
Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -72,11 +72,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
|
||||
TestScene scene = SceneSetupHelpers.SetupScene();
|
||||
TestScene scene = SceneSetupHelpers.SetupScene();
|
||||
SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene);
|
||||
scene.DeleteSceneObject(part.ParentGroup, false);
|
||||
|
||||
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
|
||||
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
|
||||
Assert.That(retrievedPart, Is.Null);
|
||||
}
|
||||
|
||||
@@ -115,19 +115,19 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
//[Test]
|
||||
//public void TestDeleteSceneObjectAsyncToUserInventory()
|
||||
//{
|
||||
// TestHelper.InMethod();
|
||||
// //log4net.Config.XmlConfigurator.Configure();
|
||||
// TestHelper.InMethod();
|
||||
// //log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
// UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
||||
// string myObjectName = "Fred";
|
||||
|
||||
// TestScene scene = SceneSetupHelpers.SetupScene();
|
||||
// TestScene scene = SceneSetupHelpers.SetupScene();
|
||||
// SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene, myObjectName);
|
||||
|
||||
// Assert.That(
|
||||
// scene.CommsManager.UserAdminService.AddUser(
|
||||
// "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId),
|
||||
// Is.EqualTo(agentId));
|
||||
// Is.EqualTo(agentId));
|
||||
|
||||
// IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
/// <summary>
|
||||
/// Linking tests
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
[TestFixture]
|
||||
public class SceneObjectLinkingTests
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
@@ -94,10 +94,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
}
|
||||
|
||||
// root part should have no offset position or rotation
|
||||
Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity);
|
||||
Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity,
|
||||
"root part should have no offset position or rotation");
|
||||
|
||||
// offset position should be root part position - part2.absolute position.
|
||||
Assert.That(part2.OffsetPosition == new Vector3(-10, -10, -10));
|
||||
Assert.That(part2.OffsetPosition == new Vector3(-10, -10, -10),
|
||||
"offset position should be root part position - part2.absolute position.");
|
||||
|
||||
float roll = 0;
|
||||
float pitch = 0;
|
||||
@@ -116,7 +118,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
if (debugtest)
|
||||
m_log.Debug(rotEuler2);
|
||||
|
||||
Assert.That(rotEuler2.ApproxEquals(new Vector3(-180, 0, 0), 0.001f) || rotEuler2.ApproxEquals(new Vector3(180, 0, 0), 0.001f));
|
||||
Assert.That(rotEuler2.ApproxEquals(new Vector3(-180, 0, 0), 0.001f) || rotEuler2.ApproxEquals(new Vector3(180, 0, 0), 0.001f),
|
||||
"Not exactly sure what this is asserting...");
|
||||
|
||||
// Delink part 2
|
||||
grp1.DelinkFromGroup(part2.LocalId);
|
||||
@@ -125,7 +128,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
m_log.Debug("Group2: Prim2: OffsetPosition:" + part2.AbsolutePosition + ", OffsetRotation:" + part2.RotationOffset);
|
||||
|
||||
Assert.That(grp1.Children.Count, Is.EqualTo(1), "Group 1 still contained part2 after delink.");
|
||||
Assert.That(part2.AbsolutePosition == Vector3.Zero);
|
||||
Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -174,13 +177,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
// Link grp4 to grp3.
|
||||
grp3.LinkToGroup(grp4);
|
||||
|
||||
// At this point we should have 4 parts total in two groups.
|
||||
Assert.That(grp1.Children.Count == 2);
|
||||
// At this point we should have 4 parts total in two groups.
|
||||
Assert.That(grp1.Children.Count == 2, "Group1 children count should be 2");
|
||||
Assert.That(grp2.IsDeleted, "Group 2 was not registered as deleted after link.");
|
||||
Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained parts after delink.");
|
||||
Assert.That(grp3.Children.Count == 2);
|
||||
Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained parts after delink.");
|
||||
Assert.That(grp3.Children.Count == 2, "Group3 children count should be 2");
|
||||
Assert.That(grp4.IsDeleted, "Group 4 was not registered as deleted after link.");
|
||||
Assert.That(grp4.Children.Count, Is.EqualTo(0), "Group 4 still contained parts after delink.");
|
||||
Assert.That(grp4.Children.Count, Is.EqualTo(0), "Group 4 still contained parts after delink.");
|
||||
|
||||
if (debugtest)
|
||||
{
|
||||
@@ -194,17 +197,19 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
m_log.Debug("Group3: Pos:"+grp3.AbsolutePosition+", Rot:"+grp3.Rotation);
|
||||
m_log.Debug("Group3: Prim1: OffsetPosition:"+part3.OffsetPosition+", OffsetRotation:"+part3.RotationOffset);
|
||||
m_log.Debug("Group3: Prim2: OffsetPosition:"+part4.OffsetPosition+", OffsetRotation:"+part4.RotationOffset);
|
||||
}
|
||||
}
|
||||
|
||||
// Required for linking
|
||||
grp1.RootPart.UpdateFlag = 0;
|
||||
grp3.RootPart.UpdateFlag = 0;
|
||||
|
||||
// root part should have no offset position or rotation
|
||||
Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity);
|
||||
Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity,
|
||||
"root part should have no offset position or rotation (again)");
|
||||
|
||||
// offset position should be root part position - part2.absolute position.
|
||||
Assert.That(part2.OffsetPosition == new Vector3(-10, -10, -10));
|
||||
Assert.That(part2.OffsetPosition == new Vector3(-10, -10, -10),
|
||||
"offset position should be root part position - part2.absolute position (again)");
|
||||
|
||||
float roll = 0;
|
||||
float pitch = 0;
|
||||
@@ -223,7 +228,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
if (debugtest)
|
||||
m_log.Debug(rotEuler2);
|
||||
|
||||
Assert.That(rotEuler2.ApproxEquals(new Vector3(-180, 0, 0), 0.001f) || rotEuler2.ApproxEquals(new Vector3(180, 0, 0), 0.001f));
|
||||
Assert.That(rotEuler2.ApproxEquals(new Vector3(-180, 0, 0), 0.001f) || rotEuler2.ApproxEquals(new Vector3(180, 0, 0), 0.001f),
|
||||
"Not sure what this assertion is all about...");
|
||||
|
||||
// Now we're linking the first group to the third group. This will make the first group child parts of the third one.
|
||||
grp3.LinkToGroup(grp1);
|
||||
@@ -246,13 +252,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
m_log.Debug("Group3: Prim2: OffsetPosition:" + part4.OffsetPosition + ", OffsetRotation:" + part4.RotationOffset);
|
||||
}
|
||||
|
||||
Assert.That(part2.AbsolutePosition == Vector3.Zero);
|
||||
Assert.That(part4.OffsetPosition == new Vector3(20, 20, 20));
|
||||
Assert.That(part2.AbsolutePosition == Vector3.Zero, "Badness 1");
|
||||
Assert.That(part4.OffsetPosition == new Vector3(20, 20, 20), "Badness 2");
|
||||
Quaternion compareQuaternion = new Quaternion(0, 0.7071068f, 0, 0.7071068f);
|
||||
Assert.That((part4.RotationOffset.X - compareQuaternion.X < 0.00003)
|
||||
&& (part4.RotationOffset.Y - compareQuaternion.Y < 0.00003)
|
||||
&& (part4.RotationOffset.Z - compareQuaternion.Z < 0.00003)
|
||||
&& (part4.RotationOffset.W - compareQuaternion.W < 0.00003));
|
||||
}
|
||||
&& (part4.RotationOffset.W - compareQuaternion.W < 0.00003),
|
||||
"Badness 3");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,11 +41,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
public class SceneTests
|
||||
{
|
||||
private class FakeStorageManager : StorageManager
|
||||
{
|
||||
{
|
||||
private class FakeRegionDataStore : IRegionDataStore
|
||||
{
|
||||
public void Initialise(string filename)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Teleport tests in a standalone OpenSim
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class StandaloneTeleportTests
|
||||
{
|
||||
@@ -52,7 +52,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
/// Test a teleport between two regions that are not neighbours and do not share any neighbours in common.
|
||||
/// </summary>
|
||||
/// Does not yet do what is says on the tin.
|
||||
[Test, LongRunning]
|
||||
/// Commenting for now
|
||||
//[Test, LongRunning]
|
||||
public void TestSimpleNotNeighboursTeleport()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
@@ -117,14 +118,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
// shared module
|
||||
ISharedRegionModule interregionComms = new RESTInterregionComms();
|
||||
|
||||
Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm);
|
||||
SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
|
||||
sceneA.RegisterRegionWithGrid();
|
||||
|
||||
Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm);
|
||||
Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm, "grid");
|
||||
SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms);
|
||||
sceneB.RegisterRegionWithGrid();
|
||||
|
||||
Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm, "grid");
|
||||
SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms);
|
||||
sceneA.RegisterRegionWithGrid();
|
||||
|
||||
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041");
|
||||
TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Scenes.Types
|
||||
{
|
||||
private Queue<SceneObjectPart> m_queue;
|
||||
|
||||
private List<UUID> m_ids;
|
||||
private Dictionary<UUID, bool> m_ids;
|
||||
|
||||
private object m_syncObject = new object();
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Types
|
||||
public UpdateQueue()
|
||||
{
|
||||
m_queue = new Queue<SceneObjectPart>();
|
||||
m_ids = new List<UUID>();
|
||||
m_ids = new Dictionary<UUID, bool>();
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
@@ -66,9 +66,8 @@ namespace OpenSim.Region.Framework.Scenes.Types
|
||||
{
|
||||
lock (m_syncObject)
|
||||
{
|
||||
if (!m_ids.Contains(part.UUID))
|
||||
{
|
||||
m_ids.Add(part.UUID);
|
||||
if (!m_ids.ContainsKey(part.UUID)) {
|
||||
m_ids.Add(part.UUID, true);
|
||||
m_queue.Enqueue(part);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
/// <summary>
|
||||
/// Gather uuids for a given entity.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
///
|
||||
/// This does a deep inspection of the entity to retrieve all the assets it uses (whether as textures, as scripts
|
||||
/// contained in inventory, as scripts contained in objects contained in another object's inventory, etc. Assets
|
||||
@@ -82,7 +82,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
///
|
||||
/// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param>
|
||||
/// <param name="assetType">The type of the asset for the uuid given</param>
|
||||
/// <param name="assetUuids">The assets gathered</param>
|
||||
/// <param name="assetUuids">The assets gathered</param>
|
||||
public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, int> assetUuids)
|
||||
{
|
||||
assetUuids[assetUuid] = 1;
|
||||
@@ -142,7 +142,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
// If the prim is a sculpt then preserve this information too
|
||||
if (part.Shape.SculptTexture != UUID.Zero)
|
||||
assetUuids[part.Shape.SculptTexture] = 1;
|
||||
assetUuids[part.Shape.SculptTexture] = 1;
|
||||
|
||||
TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
/// <summary>
|
||||
/// The callback made when we request the asset for an object from the asset service.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
protected void AssetReceived(string id, Object sender, AssetBase asset)
|
||||
{
|
||||
lock (this)
|
||||
@@ -242,7 +242,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
AssetBase assetBase = GetAsset(wearableAssetUuid);
|
||||
|
||||
if (null != assetBase)
|
||||
{
|
||||
{
|
||||
//m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data));
|
||||
AssetWearable wearableAsset = new AssetBodypart(wearableAssetUuid, assetBase.Data);
|
||||
wearableAsset.Decode();
|
||||
@@ -275,6 +275,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xml);
|
||||
GatherAssetUuids(sog, assetUuids);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user