Merge branch 'master' into careminster-presence-refactor
commit
297bcb5c3d
|
@ -1077,7 +1077,7 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReprioritizeUpdates(UpdatePriorityHandler handler)
|
public void ReprioritizeUpdates()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -618,7 +618,7 @@ namespace OpenSim.Client.Sirikata.ClientStack
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReprioritizeUpdates(UpdatePriorityHandler handler)
|
public void ReprioritizeUpdates()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -624,7 +624,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReprioritizeUpdates(UpdatePriorityHandler handler)
|
public void ReprioritizeUpdates()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -458,8 +458,6 @@ namespace OpenSim.Framework
|
||||||
public delegate void PlacesQuery(UUID QueryID, UUID TransactionID, string QueryText, uint QueryFlags, byte Category, string SimName, IClientAPI client);
|
public delegate void PlacesQuery(UUID QueryID, UUID TransactionID, string QueryText, uint QueryFlags, byte Category, string SimName, IClientAPI client);
|
||||||
|
|
||||||
public delegate void AgentFOV(IClientAPI client, float verticalAngle);
|
public delegate void AgentFOV(IClientAPI client, float verticalAngle);
|
||||||
|
|
||||||
public delegate double UpdatePriorityHandler(UpdatePriorityData data);
|
|
||||||
|
|
||||||
public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int Flags,UUID AgentID);
|
public delegate void MuteListEntryUpdate(IClientAPI client, UUID MuteID, string Name, int Flags,UUID AgentID);
|
||||||
|
|
||||||
|
@ -571,17 +569,16 @@ namespace OpenSim.Framework
|
||||||
public float dwell;
|
public float dwell;
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct UpdatePriorityData {
|
public class EntityUpdate
|
||||||
private double m_priority;
|
{
|
||||||
private uint m_localID;
|
public ISceneEntity Entity;
|
||||||
|
public PrimUpdateFlags Flags;
|
||||||
|
|
||||||
public UpdatePriorityData(double priority, uint localID) {
|
public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags)
|
||||||
this.m_priority = priority;
|
{
|
||||||
this.m_localID = localID;
|
Entity = entity;
|
||||||
|
Flags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double priority { get { return this.m_priority; } }
|
|
||||||
public uint localID { get { return this.m_localID; } }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1026,7 +1023,7 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
void SendAvatarDataImmediate(ISceneEntity avatar);
|
void SendAvatarDataImmediate(ISceneEntity avatar);
|
||||||
void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags);
|
void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags);
|
||||||
void ReprioritizeUpdates(UpdatePriorityHandler handler);
|
void ReprioritizeUpdates();
|
||||||
void FlushPrimUpdates();
|
void FlushPrimUpdates();
|
||||||
|
|
||||||
void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items,
|
void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items,
|
||||||
|
|
|
@ -33,5 +33,6 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
UUID UUID { get; }
|
UUID UUID { get; }
|
||||||
uint LocalId { get; }
|
uint LocalId { get; }
|
||||||
|
Vector3 AbsolutePosition { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
|
@ -85,6 +86,11 @@ namespace OpenSim.Framework.Serialization
|
||||||
/// </value>
|
/// </value>
|
||||||
public const string INVENTORY_NODE_NAME_COMPONENT_SEPARATOR = "__";
|
public const string INVENTORY_NODE_NAME_COMPONENT_SEPARATOR = "__";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Template used for creating filenames in OpenSim Archives.
|
||||||
|
/// </summary>
|
||||||
|
public const string OAR_OBJECT_FILENAME_TEMPLATE = "{0}_{1:000}-{2:000}-{3:000}__{4}.xml";
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// Extensions used for asset types in the archive
|
/// Extensions used for asset types in the archive
|
||||||
/// </value>
|
/// </value>
|
||||||
|
@ -139,5 +145,32 @@ namespace OpenSim.Framework.Serialization
|
||||||
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.tga"] = (sbyte)AssetType.TextureTGA;
|
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.tga"] = (sbyte)AssetType.TextureTGA;
|
||||||
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "trashfolder.txt"] = (sbyte)AssetType.TrashFolder;
|
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "trashfolder.txt"] = (sbyte)AssetType.TrashFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create the filename used to store an object in an OpenSim Archive.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="objectName"></param>
|
||||||
|
/// <param name="uuid"></param>
|
||||||
|
/// <param name="pos"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string CreateOarObjectFilename(string objectName, UUID uuid, Vector3 pos)
|
||||||
|
{
|
||||||
|
return string.Format(
|
||||||
|
OAR_OBJECT_FILENAME_TEMPLATE, objectName,
|
||||||
|
Math.Round(pos.X), Math.Round(pos.Y), Math.Round(pos.Z),
|
||||||
|
uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create the path used to store an object in an OpenSim Archives.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="objectName"></param>
|
||||||
|
/// <param name="uuid"></param>
|
||||||
|
/// <param name="pos"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos)
|
||||||
|
{
|
||||||
|
return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using log4net;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Serialization
|
namespace OpenSim.Framework.Serialization
|
||||||
{
|
{
|
||||||
|
@ -37,7 +39,7 @@ namespace OpenSim.Framework.Serialization
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TarArchiveWriter
|
public class TarArchiveWriter
|
||||||
{
|
{
|
||||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
|
protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
|
||||||
protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding();
|
protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding();
|
||||||
|
@ -148,6 +150,9 @@ namespace OpenSim.Framework.Serialization
|
||||||
/// <param name="fileType"></param>
|
/// <param name="fileType"></param>
|
||||||
protected void WriteEntry(string filePath, byte[] data, char fileType)
|
protected void WriteEntry(string filePath, byte[] data, char fileType)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[TAR ARCHIVE WRITER]: Data for {0} is {1} bytes", filePath, (null == data ? "null" : data.Length.ToString()));
|
||||||
|
|
||||||
byte[] header = new byte[512];
|
byte[] header = new byte[512];
|
||||||
|
|
||||||
// file path field (100)
|
// file path field (100)
|
||||||
|
|
|
@ -50,18 +50,6 @@ using Nini.Config;
|
||||||
|
|
||||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
public class EntityUpdate
|
|
||||||
{
|
|
||||||
public ISceneEntity Entity;
|
|
||||||
public PrimUpdateFlags Flags;
|
|
||||||
|
|
||||||
public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags)
|
|
||||||
{
|
|
||||||
Entity = entity;
|
|
||||||
Flags = flags;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public delegate bool PacketMethod(IClientAPI simClient, Packet packet);
|
public delegate bool PacketMethod(IClientAPI simClient, Packet packet);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -325,6 +313,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
private int m_cachedTextureSerial;
|
private int m_cachedTextureSerial;
|
||||||
private PriorityQueue m_entityUpdates;
|
private PriorityQueue m_entityUpdates;
|
||||||
|
private Prioritizer m_prioritizer;
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// List used in construction of data blocks for an object update packet. This is to stop us having to
|
/// List used in construction of data blocks for an object update packet. This is to stop us having to
|
||||||
|
@ -465,6 +454,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
m_propertiesPacketTimer = new Timer(100);
|
m_propertiesPacketTimer = new Timer(100);
|
||||||
m_propertiesPacketTimer.Elapsed += ProcessObjectPropertiesPacket;
|
m_propertiesPacketTimer.Elapsed += ProcessObjectPropertiesPacket;
|
||||||
|
|
||||||
|
m_prioritizer = new Prioritizer(m_scene);
|
||||||
|
|
||||||
RegisterLocalPacketHandlers();
|
RegisterLocalPacketHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3457,14 +3448,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
|
public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
|
||||||
{
|
{
|
||||||
double priority;
|
double priority = m_prioritizer.GetUpdatePriority(this, entity);
|
||||||
|
|
||||||
if (entity is SceneObjectPart)
|
|
||||||
priority = ((SceneObjectPart)entity).ParentGroup.GetUpdatePriority(this);
|
|
||||||
else if (entity is ScenePresence)
|
|
||||||
priority = ((ScenePresence)entity).GetUpdatePriority(this);
|
|
||||||
else
|
|
||||||
priority = 0.0d;
|
|
||||||
|
|
||||||
lock (m_entityUpdates.SyncRoot)
|
lock (m_entityUpdates.SyncRoot)
|
||||||
m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId);
|
m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId);
|
||||||
|
@ -3613,19 +3597,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
#endregion Packet Sending
|
#endregion Packet Sending
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReprioritizeUpdates(UpdatePriorityHandler handler)
|
public void ReprioritizeUpdates()
|
||||||
{
|
{
|
||||||
//m_log.Debug("[CLIENT]: Reprioritizing prim updates for " + m_firstName + " " + m_lastName);
|
//m_log.Debug("[CLIENT]: Reprioritizing prim updates for " + m_firstName + " " + m_lastName);
|
||||||
|
|
||||||
PriorityQueue.UpdatePriorityHandler update_priority_handler =
|
|
||||||
delegate(ref double priority, uint local_id)
|
|
||||||
{
|
|
||||||
priority = handler(new UpdatePriorityData(priority, local_id));
|
|
||||||
return priority != double.NaN;
|
|
||||||
};
|
|
||||||
|
|
||||||
lock (m_entityUpdates.SyncRoot)
|
lock (m_entityUpdates.SyncRoot)
|
||||||
m_entityUpdates.Reprioritize(update_priority_handler);
|
m_entityUpdates.Reprioritize(UpdatePriorityHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool UpdatePriorityHandler(ref double priority, uint localID)
|
||||||
|
{
|
||||||
|
EntityBase entity;
|
||||||
|
if (m_scene.Entities.TryGetValue(localID, out entity))
|
||||||
|
{
|
||||||
|
priority = m_prioritizer.GetUpdatePriority(this, entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
return priority != double.NaN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FlushPrimUpdates()
|
public void FlushPrimUpdates()
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenMetaverse;
|
||||||
|
using OpenSim.Framework.Serialization;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Helper methods for archive manipulation
|
||||||
|
/// </summary>
|
||||||
|
/// This is a separate class from ArchiveConstants because we need to bring in very OpenSim specific classes.
|
||||||
|
public static class ArchiveHelpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Create the filename used for objects in OpenSim Archives.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="objectName"></param>
|
||||||
|
/// <param name="uuid"></param>
|
||||||
|
/// <param name="pos"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string CreateObjectFilename(SceneObjectGroup sog)
|
||||||
|
{
|
||||||
|
return ArchiveConstants.CreateOarObjectFilename(sog.Name, sog.UUID, sog.AbsolutePosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create the path used to store an object in an OpenSim Archive.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="objectName"></param>
|
||||||
|
/// <param name="uuid"></param>
|
||||||
|
/// <param name="pos"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string CreateObjectPath(SceneObjectGroup sog)
|
||||||
|
{
|
||||||
|
return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,7 +38,6 @@ using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Serialization;
|
using OpenSim.Framework.Serialization;
|
||||||
using OpenSim.Framework.Serialization.External;
|
using OpenSim.Framework.Serialization.External;
|
||||||
|
|
||||||
using OpenSim.Region.CoreModules.World.Terrain;
|
using OpenSim.Region.CoreModules.World.Terrain;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
@ -244,7 +243,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
// to the same scene (when this is possible).
|
// to the same scene (when this is possible).
|
||||||
sceneObject.ResetIDs();
|
sceneObject.ResetIDs();
|
||||||
|
|
||||||
|
|
||||||
foreach (SceneObjectPart part in sceneObject.Children.Values)
|
foreach (SceneObjectPart part in sceneObject.Children.Values)
|
||||||
{
|
{
|
||||||
if (!ResolveUserUuid(part.CreatorID))
|
if (!ResolveUserUuid(part.CreatorID))
|
||||||
|
|
|
@ -145,17 +145,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType());
|
//m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType());
|
||||||
|
|
||||||
Vector3 position = sceneObject.AbsolutePosition;
|
|
||||||
|
|
||||||
string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject);
|
string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject);
|
||||||
string filename
|
m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject);
|
||||||
= string.Format(
|
|
||||||
"{0}{1}_{2:000}-{3:000}-{4:000}__{5}.xml",
|
|
||||||
ArchiveConstants.OBJECTS_PATH, sceneObject.Name,
|
|
||||||
Math.Round(position.X), Math.Round(position.Y), Math.Round(position.Z),
|
|
||||||
sceneObject.UUID);
|
|
||||||
|
|
||||||
m_archiveWriter.WriteFile(filename, serializedObject);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive.");
|
m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive.");
|
||||||
|
|
|
@ -239,7 +239,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[ARCHIVER]: Recording asset {0} as found", id);
|
// m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id);
|
||||||
m_foundAssetUuids.Add(asset.FullID);
|
m_foundAssetUuids.Add(asset.FullID);
|
||||||
m_assetsArchiver.WriteAsset(asset);
|
m_assetsArchiver.WriteAsset(asset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -33,8 +34,8 @@ using log4net.Config;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NUnit.Framework.SyntaxHelpers;
|
using NUnit.Framework.SyntaxHelpers;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.Assets;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
|
||||||
using OpenSim.Framework.Serialization;
|
using OpenSim.Framework.Serialization;
|
||||||
using OpenSim.Framework.Serialization.External;
|
using OpenSim.Framework.Serialization.External;
|
||||||
using OpenSim.Region.CoreModules.World.Serialiser;
|
using OpenSim.Region.CoreModules.World.Serialiser;
|
||||||
|
@ -44,6 +45,9 @@ using OpenSim.Region.Framework.Scenes.Serialization;
|
||||||
using OpenSim.Tests.Common;
|
using OpenSim.Tests.Common;
|
||||||
using OpenSim.Tests.Common.Mock;
|
using OpenSim.Tests.Common.Mock;
|
||||||
using OpenSim.Tests.Common.Setup;
|
using OpenSim.Tests.Common.Setup;
|
||||||
|
using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
|
||||||
|
using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader;
|
||||||
|
using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
{
|
{
|
||||||
|
@ -55,6 +59,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
|
|
||||||
protected TestScene m_scene;
|
protected TestScene m_scene;
|
||||||
protected ArchiverModule m_archiverModule;
|
protected ArchiverModule m_archiverModule;
|
||||||
|
|
||||||
|
protected TaskInventoryItem m_soundItem;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUp()
|
public void SetUp()
|
||||||
|
@ -124,10 +130,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
//log4net.Config.XmlConfigurator.Configure();
|
//log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
SceneObjectPart part1 = CreateSceneObjectPart1();
|
SceneObjectPart part1 = CreateSceneObjectPart1();
|
||||||
m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false);
|
SceneObjectGroup sog1 = new SceneObjectGroup(part1);
|
||||||
|
m_scene.AddNewSceneObject(sog1, false);
|
||||||
|
|
||||||
SceneObjectPart part2 = CreateSceneObjectPart2();
|
SceneObjectPart part2 = CreateSceneObjectPart2();
|
||||||
m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
|
|
||||||
|
AssetNotecard nc = new AssetNotecard("Hello World!");
|
||||||
|
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
|
||||||
|
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
|
||||||
|
AssetBase ncAsset
|
||||||
|
= AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
|
||||||
|
m_scene.AssetService.Store(ncAsset);
|
||||||
|
SceneObjectGroup sog2 = new SceneObjectGroup(part2);
|
||||||
|
TaskInventoryItem ncItem
|
||||||
|
= new TaskInventoryItem { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid };
|
||||||
|
part2.Inventory.AddInventoryItem(ncItem, true);
|
||||||
|
|
||||||
|
m_scene.AddNewSceneObject(sog2, false);
|
||||||
|
|
||||||
MemoryStream archiveWriteStream = new MemoryStream();
|
MemoryStream archiveWriteStream = new MemoryStream();
|
||||||
m_scene.EventManager.OnOarFileSaved += SaveCompleted;
|
m_scene.EventManager.OnOarFileSaved += SaveCompleted;
|
||||||
|
@ -151,18 +170,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
|
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
|
||||||
|
|
||||||
bool gotControlFile = false;
|
bool gotControlFile = false;
|
||||||
bool gotObject1File = false;
|
bool gotNcAssetFile = false;
|
||||||
bool gotObject2File = false;
|
|
||||||
string expectedObject1FileName = string.Format(
|
string expectedNcAssetFileName = string.Format("{0}_{1}", ncAssetUuid, "notecard.txt");
|
||||||
"{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
|
|
||||||
part1.Name,
|
List<string> foundPaths = new List<string>();
|
||||||
Math.Round(part1.GroupPosition.X), Math.Round(part1.GroupPosition.Y), Math.Round(part1.GroupPosition.Z),
|
List<string> expectedPaths = new List<string>();
|
||||||
part1.UUID);
|
expectedPaths.Add(ArchiveHelpers.CreateObjectPath(sog1));
|
||||||
string expectedObject2FileName = string.Format(
|
expectedPaths.Add(ArchiveHelpers.CreateObjectPath(sog2));
|
||||||
"{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
|
|
||||||
part2.Name,
|
|
||||||
Math.Round(part2.GroupPosition.X), Math.Round(part2.GroupPosition.Y), Math.Round(part2.GroupPosition.Z),
|
|
||||||
part2.UUID);
|
|
||||||
|
|
||||||
string filePath;
|
string filePath;
|
||||||
TarArchiveReader.TarEntryType tarEntryType;
|
TarArchiveReader.TarEntryType tarEntryType;
|
||||||
|
@ -173,26 +188,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
{
|
{
|
||||||
gotControlFile = true;
|
gotControlFile = true;
|
||||||
}
|
}
|
||||||
|
else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
|
||||||
|
{
|
||||||
|
string fileName = filePath.Remove(0, ArchiveConstants.ASSETS_PATH.Length);
|
||||||
|
|
||||||
|
Assert.That(fileName, Is.EqualTo(expectedNcAssetFileName));
|
||||||
|
gotNcAssetFile = true;
|
||||||
|
}
|
||||||
else if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH))
|
else if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH))
|
||||||
{
|
{
|
||||||
string fileName = filePath.Remove(0, ArchiveConstants.OBJECTS_PATH.Length);
|
foundPaths.Add(filePath);
|
||||||
|
|
||||||
if (fileName.StartsWith(part1.Name))
|
|
||||||
{
|
|
||||||
Assert.That(fileName, Is.EqualTo(expectedObject1FileName));
|
|
||||||
gotObject1File = true;
|
|
||||||
}
|
|
||||||
else if (fileName.StartsWith(part2.Name))
|
|
||||||
{
|
|
||||||
Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
|
|
||||||
gotObject2File = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.That(gotControlFile, Is.True, "No control file in archive");
|
Assert.That(gotControlFile, Is.True, "No control file in archive");
|
||||||
Assert.That(gotObject1File, Is.True, "No object1 file in archive");
|
Assert.That(gotNcAssetFile, Is.True, "No notecard asset file in archive");
|
||||||
Assert.That(gotObject2File, Is.True, "No object2 file in archive");
|
Assert.That(foundPaths, Is.EquivalentTo(expectedPaths));
|
||||||
|
|
||||||
// TODO: Test presence of more files and contents of files.
|
// TODO: Test presence of more files and contents of files.
|
||||||
}
|
}
|
||||||
|
|
|
@ -548,7 +548,7 @@ namespace OpenSim.Region.Examples.SimpleModule
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReprioritizeUpdates(UpdatePriorityHandler handler)
|
public void ReprioritizeUpdates()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,12 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.Security.Permissions;
|
using System.Security.Permissions;
|
||||||
|
using OpenSim.Framework;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Scenes
|
namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
public abstract class EntityBase
|
public abstract class EntityBase : ISceneEntity
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The scene to which this entity belongs
|
/// The scene to which this entity belongs
|
||||||
|
|
|
@ -0,0 +1,191 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using log4net;
|
||||||
|
using Nini.Config;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Steps to add a new prioritization policy:
|
||||||
|
*
|
||||||
|
* - Add a new value to the UpdatePrioritizationSchemes enum.
|
||||||
|
* - Specify this new value in the [InterestManagement] section of your
|
||||||
|
* OpenSim.ini. The name in the config file must match the enum value name
|
||||||
|
* (although it is not case sensitive).
|
||||||
|
* - Write a new GetPriorityBy*() method in this class.
|
||||||
|
* - Add a new entry to the switch statement in GetUpdatePriority() that calls
|
||||||
|
* your method.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace OpenSim.Region.Framework.Scenes
|
||||||
|
{
|
||||||
|
public enum UpdatePrioritizationSchemes
|
||||||
|
{
|
||||||
|
Time = 0,
|
||||||
|
Distance = 1,
|
||||||
|
SimpleAngularDistance = 2,
|
||||||
|
FrontBack = 3,
|
||||||
|
BestAvatarResponsiveness = 4,
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Prioritizer
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private Scene m_scene;
|
||||||
|
|
||||||
|
public Prioritizer(Scene scene)
|
||||||
|
{
|
||||||
|
m_scene = scene;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double GetUpdatePriority(IClientAPI client, ISceneEntity entity)
|
||||||
|
{
|
||||||
|
switch (m_scene.UpdatePrioritizationScheme)
|
||||||
|
{
|
||||||
|
case UpdatePrioritizationSchemes.Time:
|
||||||
|
return GetPriorityByTime();
|
||||||
|
case UpdatePrioritizationSchemes.Distance:
|
||||||
|
return GetPriorityByDistance(client, entity);
|
||||||
|
case UpdatePrioritizationSchemes.SimpleAngularDistance:
|
||||||
|
return GetPriorityByDistance(client, entity); // TODO: Reimplement SimpleAngularDistance
|
||||||
|
case UpdatePrioritizationSchemes.FrontBack:
|
||||||
|
return GetPriorityByFrontBack(client, entity);
|
||||||
|
case UpdatePrioritizationSchemes.BestAvatarResponsiveness:
|
||||||
|
return GetPriorityByBestAvatarResponsiveness(client, entity);
|
||||||
|
default:
|
||||||
|
throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private double GetPriorityByTime()
|
||||||
|
{
|
||||||
|
return DateTime.UtcNow.ToOADate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private double GetPriorityByDistance(IClientAPI client, ISceneEntity entity)
|
||||||
|
{
|
||||||
|
ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
|
||||||
|
if (presence != null)
|
||||||
|
{
|
||||||
|
// If this is an update for our own avatar give it the highest priority
|
||||||
|
if (presence == entity)
|
||||||
|
return 0.0;
|
||||||
|
|
||||||
|
// Use the camera position for local agents and avatar position for remote agents
|
||||||
|
Vector3 presencePos = (presence.IsChildAgent) ?
|
||||||
|
presence.AbsolutePosition :
|
||||||
|
presence.CameraPosition;
|
||||||
|
|
||||||
|
// Use group position for child prims
|
||||||
|
Vector3 entityPos;
|
||||||
|
if (entity is SceneObjectPart)
|
||||||
|
entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
|
||||||
|
else
|
||||||
|
entityPos = entity.AbsolutePosition;
|
||||||
|
|
||||||
|
return Vector3.DistanceSquared(presencePos, entityPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
return double.NaN;
|
||||||
|
}
|
||||||
|
|
||||||
|
private double GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity)
|
||||||
|
{
|
||||||
|
ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
|
||||||
|
if (presence != null)
|
||||||
|
{
|
||||||
|
// If this is an update for our own avatar give it the highest priority
|
||||||
|
if (presence == entity)
|
||||||
|
return 0.0;
|
||||||
|
|
||||||
|
// Use group position for child prims
|
||||||
|
Vector3 entityPos = entity.AbsolutePosition;
|
||||||
|
if (entity is SceneObjectPart)
|
||||||
|
entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
|
||||||
|
else
|
||||||
|
entityPos = entity.AbsolutePosition;
|
||||||
|
|
||||||
|
if (!presence.IsChildAgent)
|
||||||
|
{
|
||||||
|
// Root agent. Use distance from camera and a priority decrease for objects behind us
|
||||||
|
Vector3 camPosition = presence.CameraPosition;
|
||||||
|
Vector3 camAtAxis = presence.CameraAtAxis;
|
||||||
|
|
||||||
|
// Distance
|
||||||
|
double priority = Vector3.DistanceSquared(camPosition, entityPos);
|
||||||
|
|
||||||
|
// Plane equation
|
||||||
|
float d = -Vector3.Dot(camPosition, camAtAxis);
|
||||||
|
float p = Vector3.Dot(camAtAxis, entityPos) + d;
|
||||||
|
if (p < 0.0f) priority *= 2.0;
|
||||||
|
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Child agent. Use the normal distance method
|
||||||
|
Vector3 presencePos = presence.AbsolutePosition;
|
||||||
|
|
||||||
|
return Vector3.DistanceSquared(presencePos, entityPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return double.NaN;
|
||||||
|
}
|
||||||
|
|
||||||
|
private double GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity)
|
||||||
|
{
|
||||||
|
ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
|
||||||
|
if (presence != null)
|
||||||
|
{
|
||||||
|
// If this is an update for our own avatar give it the highest priority
|
||||||
|
if (presence == entity)
|
||||||
|
return 0.0;
|
||||||
|
|
||||||
|
// Use group position for child prims
|
||||||
|
Vector3 entityPos = entity.AbsolutePosition;
|
||||||
|
if (entity is SceneObjectPart)
|
||||||
|
entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
|
||||||
|
else
|
||||||
|
entityPos = entity.AbsolutePosition;
|
||||||
|
|
||||||
|
if (!presence.IsChildAgent)
|
||||||
|
{
|
||||||
|
if (entity is ScenePresence)
|
||||||
|
return 1.0;
|
||||||
|
|
||||||
|
// Root agent. Use distance from camera and a priority decrease for objects behind us
|
||||||
|
Vector3 camPosition = presence.CameraPosition;
|
||||||
|
Vector3 camAtAxis = presence.CameraAtAxis;
|
||||||
|
|
||||||
|
// Distance
|
||||||
|
double priority = Vector3.DistanceSquared(camPosition, entityPos);
|
||||||
|
|
||||||
|
// Plane equation
|
||||||
|
float d = -Vector3.Dot(camPosition, camAtAxis);
|
||||||
|
float p = Vector3.Dot(camAtAxis, entityPos) + d;
|
||||||
|
if (p < 0.0f) priority *= 2.0;
|
||||||
|
|
||||||
|
if (entity is SceneObjectPart)
|
||||||
|
{
|
||||||
|
PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor;
|
||||||
|
if (physActor == null || !physActor.IsPhysical)
|
||||||
|
priority+=100;
|
||||||
|
}
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Child agent. Use the normal distance method
|
||||||
|
Vector3 presencePos = presence.AbsolutePosition;
|
||||||
|
|
||||||
|
return Vector3.DistanceSquared(presencePos, entityPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return double.NaN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -58,13 +58,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public partial class Scene : SceneBase
|
public partial class Scene : SceneBase
|
||||||
{
|
{
|
||||||
public enum UpdatePrioritizationSchemes {
|
|
||||||
Time = 0,
|
|
||||||
Distance = 1,
|
|
||||||
SimpleAngularDistance = 2,
|
|
||||||
FrontBack = 3,
|
|
||||||
}
|
|
||||||
|
|
||||||
public delegate void SynchronizeSceneHandler(Scene scene);
|
public delegate void SynchronizeSceneHandler(Scene scene);
|
||||||
public SynchronizeSceneHandler SynchronizeScene = null;
|
public SynchronizeSceneHandler SynchronizeScene = null;
|
||||||
|
|
||||||
|
@ -402,12 +395,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private int m_lastUpdate;
|
private int m_lastUpdate;
|
||||||
private bool m_firstHeartbeat = true;
|
private bool m_firstHeartbeat = true;
|
||||||
|
|
||||||
private UpdatePrioritizationSchemes m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
|
|
||||||
private bool m_reprioritization_enabled = true;
|
|
||||||
private double m_reprioritization_interval = 5000.0;
|
|
||||||
private double m_root_reprioritization_distance = 10.0;
|
|
||||||
private double m_child_reprioritization_distance = 20.0;
|
|
||||||
|
|
||||||
private object m_deleting_scene_object = new object();
|
private object m_deleting_scene_object = new object();
|
||||||
|
|
||||||
// the minimum time that must elapse before a changed object will be considered for persisted
|
// the minimum time that must elapse before a changed object will be considered for persisted
|
||||||
|
@ -415,15 +402,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// the maximum time that must elapse before a changed object will be considered for persisted
|
// the maximum time that must elapse before a changed object will be considered for persisted
|
||||||
public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L;
|
public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L;
|
||||||
|
|
||||||
|
private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
|
||||||
|
private bool m_reprioritizationEnabled = true;
|
||||||
|
private double m_reprioritizationInterval = 5000.0;
|
||||||
|
private double m_rootReprioritizationDistance = 10.0;
|
||||||
|
private double m_childReprioritizationDistance = 20.0;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return this.m_update_prioritization_scheme; } }
|
public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } }
|
||||||
public bool IsReprioritizationEnabled { get { return m_reprioritization_enabled; } }
|
public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } }
|
||||||
public double ReprioritizationInterval { get { return m_reprioritization_interval; } }
|
public double ReprioritizationInterval { get { return m_reprioritizationInterval; } }
|
||||||
public double RootReprioritizationDistance { get { return m_root_reprioritization_distance; } }
|
public double RootReprioritizationDistance { get { return m_rootReprioritizationDistance; } }
|
||||||
public double ChildReprioritizationDistance { get { return m_child_reprioritization_distance; } }
|
public double ChildReprioritizationDistance { get { return m_childReprioritizationDistance; } }
|
||||||
|
|
||||||
public AgentCircuitManager AuthenticateHandler
|
public AgentCircuitManager AuthenticateHandler
|
||||||
{
|
{
|
||||||
|
@ -625,6 +618,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this);
|
m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this);
|
||||||
m_asyncSceneObjectDeleter.Enabled = true;
|
m_asyncSceneObjectDeleter.Enabled = true;
|
||||||
|
|
||||||
|
#region Region Settings
|
||||||
|
|
||||||
// Load region settings
|
// Load region settings
|
||||||
m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID);
|
m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID);
|
||||||
m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(m_regInfo.RegionID);
|
m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(m_regInfo.RegionID);
|
||||||
|
@ -673,6 +668,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Region Settings
|
||||||
|
|
||||||
MainConsole.Instance.Commands.AddCommand("region", false, "reload estate",
|
MainConsole.Instance.Commands.AddCommand("region", false, "reload estate",
|
||||||
"reload estate",
|
"reload estate",
|
||||||
"Reload the estate data", HandleReloadEstate);
|
"Reload the estate data", HandleReloadEstate);
|
||||||
|
@ -717,6 +714,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")";
|
m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")";
|
||||||
|
|
||||||
|
#region Region Config
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Region config overrides global config
|
// Region config overrides global config
|
||||||
|
@ -770,38 +769,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
|
m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
|
||||||
|
|
||||||
IConfig interest_management_config = m_config.Configs["InterestManagement"];
|
|
||||||
if (interest_management_config != null)
|
|
||||||
{
|
|
||||||
string update_prioritization_scheme = interest_management_config.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower();
|
|
||||||
switch (update_prioritization_scheme)
|
|
||||||
{
|
|
||||||
case "time":
|
|
||||||
m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
|
|
||||||
break;
|
|
||||||
case "distance":
|
|
||||||
m_update_prioritization_scheme = UpdatePrioritizationSchemes.Distance;
|
|
||||||
break;
|
|
||||||
case "simpleangulardistance":
|
|
||||||
m_update_prioritization_scheme = UpdatePrioritizationSchemes.SimpleAngularDistance;
|
|
||||||
break;
|
|
||||||
case "frontback":
|
|
||||||
m_update_prioritization_scheme = UpdatePrioritizationSchemes.FrontBack;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
m_log.Warn("[SCENE]: UpdatePrioritizationScheme was not recognized, setting to default settomg of Time");
|
|
||||||
m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_reprioritization_enabled = interest_management_config.GetBoolean("ReprioritizationEnabled", true);
|
|
||||||
m_reprioritization_interval = interest_management_config.GetDouble("ReprioritizationInterval", 5000.0);
|
|
||||||
m_root_reprioritization_distance = interest_management_config.GetDouble("RootReprioritizationDistance", 10.0);
|
|
||||||
m_child_reprioritization_distance = interest_management_config.GetDouble("ChildReprioritizationDistance", 20.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.Info("[SCENE]: Using the " + m_update_prioritization_scheme + " prioritization scheme");
|
|
||||||
|
|
||||||
#region BinaryStats
|
#region BinaryStats
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -838,6 +805,38 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_log.Warn("[SCENE]: Failed to load StartupConfig");
|
m_log.Warn("[SCENE]: Failed to load StartupConfig");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Region Config
|
||||||
|
|
||||||
|
#region Interest Management
|
||||||
|
|
||||||
|
if (m_config != null)
|
||||||
|
{
|
||||||
|
IConfig interestConfig = m_config.Configs["InterestManagement"];
|
||||||
|
if (interestConfig != null)
|
||||||
|
{
|
||||||
|
string update_prioritization_scheme = interestConfig.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_priorityScheme = (UpdatePrioritizationSchemes)Enum.Parse(typeof(UpdatePrioritizationSchemes), update_prioritization_scheme, true);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
m_log.Warn("[PRIORITIZER]: UpdatePrioritizationScheme was not recognized, setting to default prioritizer Time");
|
||||||
|
m_priorityScheme = UpdatePrioritizationSchemes.Time;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_reprioritizationEnabled = interestConfig.GetBoolean("ReprioritizationEnabled", true);
|
||||||
|
m_reprioritizationInterval = interestConfig.GetDouble("ReprioritizationInterval", 5000.0);
|
||||||
|
m_rootReprioritizationDistance = interestConfig.GetDouble("RootReprioritizationDistance", 10.0);
|
||||||
|
m_childReprioritizationDistance = interestConfig.GetDouble("ChildReprioritizationDistance", 20.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.Info("[SCENE]: Using the " + m_priorityScheme + " prioritization scheme");
|
||||||
|
|
||||||
|
#endregion Interest Management
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -307,61 +307,64 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
|
if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool alreadyExisted = false;
|
|
||||||
|
|
||||||
if (m_parentScene.m_clampPrimSize)
|
|
||||||
{
|
|
||||||
foreach (SceneObjectPart part in sceneObject.Children.Values)
|
|
||||||
{
|
|
||||||
Vector3 scale = part.Shape.Scale;
|
|
||||||
|
|
||||||
if (scale.X > m_parentScene.m_maxNonphys)
|
|
||||||
scale.X = m_parentScene.m_maxNonphys;
|
|
||||||
if (scale.Y > m_parentScene.m_maxNonphys)
|
|
||||||
scale.Y = m_parentScene.m_maxNonphys;
|
|
||||||
if (scale.Z > m_parentScene.m_maxNonphys)
|
|
||||||
scale.Z = m_parentScene.m_maxNonphys;
|
|
||||||
|
|
||||||
part.Shape.Scale = scale;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sceneObject.AttachToScene(m_parentScene);
|
|
||||||
|
|
||||||
if (sendClientUpdates)
|
|
||||||
sceneObject.ScheduleGroupForFullUpdate();
|
|
||||||
|
|
||||||
lock (sceneObject)
|
lock (sceneObject)
|
||||||
{
|
{
|
||||||
if (!Entities.ContainsKey(sceneObject.UUID))
|
if (Entities.ContainsKey(sceneObject.UUID))
|
||||||
{
|
{
|
||||||
Entities.Add(sceneObject);
|
// m_log.WarnFormat(
|
||||||
m_numPrim += sceneObject.Children.Count;
|
// "[SCENE GRAPH]: Scene object {0} {1} was already in region {2} on add request",
|
||||||
|
// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
|
||||||
if (attachToBackup)
|
return false;
|
||||||
sceneObject.AttachToBackup();
|
}
|
||||||
|
|
||||||
if (OnObjectCreate != null)
|
// m_log.DebugFormat(
|
||||||
OnObjectCreate(sceneObject);
|
// "[SCENE GRAPH]: Adding object {0} {1} to region {2}",
|
||||||
|
// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
|
||||||
lock (m_dictionary_lock)
|
|
||||||
|
if (m_parentScene.m_clampPrimSize)
|
||||||
|
{
|
||||||
|
foreach (SceneObjectPart part in sceneObject.Children.Values)
|
||||||
{
|
{
|
||||||
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
|
Vector3 scale = part.Shape.Scale;
|
||||||
SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
|
|
||||||
foreach (SceneObjectPart part in sceneObject.Children.Values)
|
if (scale.X > m_parentScene.m_maxNonphys)
|
||||||
{
|
scale.X = m_parentScene.m_maxNonphys;
|
||||||
SceneObjectGroupsByFullID[part.UUID] = sceneObject;
|
if (scale.Y > m_parentScene.m_maxNonphys)
|
||||||
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
|
scale.Y = m_parentScene.m_maxNonphys;
|
||||||
}
|
if (scale.Z > m_parentScene.m_maxNonphys)
|
||||||
|
scale.Z = m_parentScene.m_maxNonphys;
|
||||||
|
|
||||||
|
part.Shape.Scale = scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
sceneObject.AttachToScene(m_parentScene);
|
||||||
|
|
||||||
|
if (sendClientUpdates)
|
||||||
|
sceneObject.ScheduleGroupForFullUpdate();
|
||||||
|
|
||||||
|
Entities.Add(sceneObject);
|
||||||
|
m_numPrim += sceneObject.Children.Count;
|
||||||
|
|
||||||
|
if (attachToBackup)
|
||||||
|
sceneObject.AttachToBackup();
|
||||||
|
|
||||||
|
if (OnObjectCreate != null)
|
||||||
|
OnObjectCreate(sceneObject);
|
||||||
|
|
||||||
|
lock (m_dictionary_lock)
|
||||||
{
|
{
|
||||||
alreadyExisted = true;
|
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
|
||||||
|
SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
|
||||||
|
foreach (SceneObjectPart part in sceneObject.Children.Values)
|
||||||
|
{
|
||||||
|
SceneObjectGroupsByFullID[part.UUID] = sceneObject;
|
||||||
|
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return alreadyExisted;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -3841,107 +3841,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
SetFromItemID(uuid);
|
SetFromItemID(uuid);
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
public double GetUpdatePriority(IClientAPI client)
|
|
||||||
{
|
|
||||||
switch (Scene.UpdatePrioritizationScheme)
|
|
||||||
{
|
|
||||||
case Scene.UpdatePrioritizationSchemes.Time:
|
|
||||||
return GetPriorityByTime();
|
|
||||||
case Scene.UpdatePrioritizationSchemes.Distance:
|
|
||||||
return GetPriorityByDistance(client);
|
|
||||||
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
|
||||||
return GetPriorityBySimpleAngularDistance(client);
|
|
||||||
case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
|
|
||||||
return GetPriorityByFrontBack(client);
|
|
||||||
default:
|
|
||||||
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private double GetPriorityByTime()
|
|
||||||
{
|
|
||||||
return DateTime.Now.ToOADate();
|
|
||||||
}
|
|
||||||
|
|
||||||
private double GetPriorityByDistance(IClientAPI client)
|
|
||||||
{
|
|
||||||
ScenePresence presence = Scene.GetScenePresence(client.AgentId);
|
|
||||||
if (presence != null)
|
|
||||||
{
|
|
||||||
return GetPriorityByDistance((presence.IsChildAgent) ?
|
|
||||||
presence.AbsolutePosition : presence.CameraPosition);
|
|
||||||
}
|
|
||||||
return double.NaN;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double GetPriorityBySimpleAngularDistance(IClientAPI client)
|
|
||||||
{
|
|
||||||
ScenePresence presence = Scene.GetScenePresence(client.AgentId);
|
|
||||||
if (presence != null)
|
|
||||||
{
|
|
||||||
return GetPriorityBySimpleAngularDistance((presence.IsChildAgent) ?
|
|
||||||
presence.AbsolutePosition : presence.CameraPosition);
|
|
||||||
}
|
|
||||||
return double.NaN;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double GetPriorityByFrontBack(IClientAPI client)
|
|
||||||
{
|
|
||||||
ScenePresence presence = Scene.GetScenePresence(client.AgentId);
|
|
||||||
if (presence != null)
|
|
||||||
{
|
|
||||||
return GetPriorityByFrontBack(presence.CameraPosition, presence.CameraAtAxis);
|
|
||||||
}
|
|
||||||
return double.NaN;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double GetPriorityByDistance(Vector3 position)
|
|
||||||
{
|
|
||||||
return Vector3.Distance(AbsolutePosition, position);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double GetPriorityBySimpleAngularDistance(Vector3 position)
|
|
||||||
{
|
|
||||||
double distance = Vector3.Distance(position, AbsolutePosition);
|
|
||||||
if (distance >= double.Epsilon)
|
|
||||||
{
|
|
||||||
float height;
|
|
||||||
Vector3 box = GetAxisAlignedBoundingBox(out height);
|
|
||||||
|
|
||||||
double angle = box.X / distance;
|
|
||||||
double max = angle;
|
|
||||||
|
|
||||||
angle = box.Y / distance;
|
|
||||||
if (max < angle)
|
|
||||||
max = angle;
|
|
||||||
|
|
||||||
angle = box.Z / distance;
|
|
||||||
if (max < angle)
|
|
||||||
max = angle;
|
|
||||||
|
|
||||||
return -max;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return double.MinValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double GetPriorityByFrontBack(Vector3 camPosition, Vector3 camAtAxis)
|
|
||||||
{
|
|
||||||
// Distance
|
|
||||||
double priority = Vector3.Distance(camPosition, AbsolutePosition);
|
|
||||||
|
|
||||||
// Scale
|
|
||||||
//priority -= GroupScale().Length();
|
|
||||||
|
|
||||||
// Plane equation
|
|
||||||
float d = -Vector3.Dot(camPosition, camAtAxis);
|
|
||||||
float p = Vector3.Dot(camAtAxis, AbsolutePosition) + d;
|
|
||||||
if (p < 0.0f) priority *= 2.0f;
|
|
||||||
|
|
||||||
return priority;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ResetOwnerChangeFlag()
|
public void ResetOwnerChangeFlag()
|
||||||
{
|
{
|
||||||
|
@ -3950,5 +3849,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
part.ResetOwnerChangeFlag();
|
part.ResetOwnerChangeFlag();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4090,123 +4090,9 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double GetUpdatePriority(IClientAPI client)
|
|
||||||
{
|
|
||||||
switch (Scene.UpdatePrioritizationScheme)
|
|
||||||
{
|
|
||||||
case Scene.UpdatePrioritizationSchemes.Time:
|
|
||||||
return GetPriorityByTime();
|
|
||||||
case Scene.UpdatePrioritizationSchemes.Distance:
|
|
||||||
return GetPriorityByDistance(client);
|
|
||||||
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
|
||||||
return GetPriorityByDistance(client);
|
|
||||||
case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
|
|
||||||
return GetPriorityByFrontBack(client);
|
|
||||||
default:
|
|
||||||
throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private double GetPriorityByTime()
|
|
||||||
{
|
|
||||||
return DateTime.Now.ToOADate();
|
|
||||||
}
|
|
||||||
|
|
||||||
private double GetPriorityByDistance(IClientAPI client)
|
|
||||||
{
|
|
||||||
ScenePresence presence = Scene.GetScenePresence(client.AgentId);
|
|
||||||
if (presence != null)
|
|
||||||
{
|
|
||||||
return GetPriorityByDistance((presence.IsChildAgent) ?
|
|
||||||
presence.AbsolutePosition : presence.CameraPosition);
|
|
||||||
}
|
|
||||||
return double.NaN;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double GetPriorityByFrontBack(IClientAPI client)
|
|
||||||
{
|
|
||||||
ScenePresence presence = Scene.GetScenePresence(client.AgentId);
|
|
||||||
if (presence != null)
|
|
||||||
{
|
|
||||||
return GetPriorityByFrontBack(presence.CameraPosition, presence.CameraAtAxis);
|
|
||||||
}
|
|
||||||
return double.NaN;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double GetPriorityByDistance(Vector3 position)
|
|
||||||
{
|
|
||||||
return Vector3.Distance(AbsolutePosition, position);
|
|
||||||
}
|
|
||||||
|
|
||||||
private double GetPriorityByFrontBack(Vector3 camPosition, Vector3 camAtAxis)
|
|
||||||
{
|
|
||||||
// Distance
|
|
||||||
double priority = Vector3.Distance(camPosition, AbsolutePosition);
|
|
||||||
|
|
||||||
// Plane equation
|
|
||||||
float d = -Vector3.Dot(camPosition, camAtAxis);
|
|
||||||
float p = Vector3.Dot(camAtAxis, AbsolutePosition) + d;
|
|
||||||
if (p < 0.0f) priority *= 2.0f;
|
|
||||||
|
|
||||||
return priority;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double GetSOGUpdatePriority(SceneObjectGroup sog)
|
|
||||||
{
|
|
||||||
switch (Scene.UpdatePrioritizationScheme)
|
|
||||||
{
|
|
||||||
case Scene.UpdatePrioritizationSchemes.Time:
|
|
||||||
throw new InvalidOperationException("UpdatePrioritizationScheme for time not supported for reprioritization");
|
|
||||||
case Scene.UpdatePrioritizationSchemes.Distance:
|
|
||||||
return sog.GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
|
|
||||||
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
|
||||||
return sog.GetPriorityBySimpleAngularDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
|
|
||||||
case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
|
|
||||||
return sog.GetPriorityByFrontBack(CameraPosition, CameraAtAxis);
|
|
||||||
default:
|
|
||||||
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private double UpdatePriority(UpdatePriorityData data)
|
|
||||||
{
|
|
||||||
EntityBase entity;
|
|
||||||
SceneObjectGroup group;
|
|
||||||
|
|
||||||
if (Scene.Entities.TryGetValue(data.localID, out entity))
|
|
||||||
{
|
|
||||||
group = entity as SceneObjectGroup;
|
|
||||||
if (group != null)
|
|
||||||
return GetSOGUpdatePriority(group);
|
|
||||||
|
|
||||||
ScenePresence presence = entity as ScenePresence;
|
|
||||||
if (presence == null)
|
|
||||||
throw new InvalidOperationException("entity found is neither SceneObjectGroup nor ScenePresence");
|
|
||||||
switch (Scene.UpdatePrioritizationScheme)
|
|
||||||
{
|
|
||||||
case Scene.UpdatePrioritizationSchemes.Time:
|
|
||||||
throw new InvalidOperationException("UpdatePrioritization for time not supported for reprioritization");
|
|
||||||
case Scene.UpdatePrioritizationSchemes.Distance:
|
|
||||||
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
|
||||||
return GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
|
|
||||||
case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
|
|
||||||
return GetPriorityByFrontBack(CameraPosition, CameraAtAxis);
|
|
||||||
default:
|
|
||||||
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
group = Scene.GetGroupByPrim(data.localID);
|
|
||||||
if (group != null)
|
|
||||||
return GetSOGUpdatePriority(group);
|
|
||||||
}
|
|
||||||
return double.NaN;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ReprioritizeUpdates()
|
private void ReprioritizeUpdates()
|
||||||
{
|
{
|
||||||
if (Scene.IsReprioritizationEnabled && Scene.UpdatePrioritizationScheme != Scene.UpdatePrioritizationSchemes.Time)
|
if (Scene.IsReprioritizationEnabled && Scene.UpdatePrioritizationScheme != UpdatePrioritizationSchemes.Time)
|
||||||
{
|
{
|
||||||
lock (m_reprioritization_timer)
|
lock (m_reprioritization_timer)
|
||||||
{
|
{
|
||||||
|
@ -4220,7 +4106,7 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
|
||||||
|
|
||||||
private void Reprioritize(object sender, ElapsedEventArgs e)
|
private void Reprioritize(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
m_controllingClient.ReprioritizeUpdates(UpdatePriority);
|
m_controllingClient.ReprioritizeUpdates();
|
||||||
|
|
||||||
lock (m_reprioritization_timer)
|
lock (m_reprioritization_timer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,18 +49,62 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test adding an object to a scene.
|
/// Test adding an object to a scene.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test, LongRunning]
|
[Test]
|
||||||
public void TestAddSceneObject()
|
public void TestAddSceneObject()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
|
|
||||||
Scene scene = SceneSetupHelpers.SetupScene();
|
Scene scene = SceneSetupHelpers.SetupScene();
|
||||||
SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene);
|
|
||||||
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
|
string objName = "obj1";
|
||||||
|
UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001");
|
||||||
|
|
||||||
|
SceneObjectPart part
|
||||||
|
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
|
||||||
|
{ Name = objName, UUID = objUuid };
|
||||||
|
|
||||||
|
Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part), false), Is.True);
|
||||||
|
|
||||||
|
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(objUuid);
|
||||||
|
|
||||||
//m_log.Debug("retrievedPart : {0}", retrievedPart);
|
//m_log.Debug("retrievedPart : {0}", retrievedPart);
|
||||||
// If the parts have the same UUID then we will consider them as one and the same
|
// 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.Name, Is.EqualTo(objName));
|
||||||
|
Assert.That(retrievedPart.UUID, Is.EqualTo(objUuid));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
/// <summary>
|
||||||
|
/// It shouldn't be possible to add a scene object if one with that uuid already exists in the scene.
|
||||||
|
/// </summary>
|
||||||
|
public void TestAddExistingSceneObjectUuid()
|
||||||
|
{
|
||||||
|
TestHelper.InMethod();
|
||||||
|
|
||||||
|
Scene scene = SceneSetupHelpers.SetupScene();
|
||||||
|
|
||||||
|
string obj1Name = "Alfred";
|
||||||
|
string obj2Name = "Betty";
|
||||||
|
UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001");
|
||||||
|
|
||||||
|
SceneObjectPart part1
|
||||||
|
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
|
||||||
|
{ Name = obj1Name, UUID = objUuid };
|
||||||
|
|
||||||
|
Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True);
|
||||||
|
|
||||||
|
SceneObjectPart part2
|
||||||
|
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
|
||||||
|
{ Name = obj2Name, UUID = objUuid };
|
||||||
|
|
||||||
|
Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part2), false), Is.False);
|
||||||
|
|
||||||
|
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(objUuid);
|
||||||
|
|
||||||
|
//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.Name, Is.EqualTo(obj1Name));
|
||||||
|
Assert.That(retrievedPart.UUID, Is.EqualTo(objUuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -58,7 +58,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
|
|
||||||
UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
|
UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
|
||||||
AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, "CORRUPT ASSET", UUID.Zero);
|
AssetBase corruptAsset
|
||||||
|
= AssetHelpers.CreateAsset(corruptAssetUuid, AssetType.Notecard, "CORRUPT ASSET", UUID.Zero);
|
||||||
m_assetService.Store(corruptAsset);
|
m_assetService.Store(corruptAsset);
|
||||||
|
|
||||||
IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>();
|
IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>();
|
||||||
|
|
|
@ -123,8 +123,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
foreach (SceneObjectPart part in sceneObject.GetParts())
|
foreach (SceneObjectPart part in sceneObject.GetParts())
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[ARCHIVER]: Getting part {0}, {1} for object {2}", part.Name, part.UUID, sceneObject.UUID);
|
// "[ARCHIVER]: Getting part {0}, {1} for object {2}", part.Name, part.UUID, sceneObject.UUID);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -155,7 +155,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Now analyze this prim's inventory items to preserve all the uuids that they reference
|
// Now analyze this prim's inventory items to preserve all the uuids that they reference
|
||||||
foreach (TaskInventoryItem tii in taskDictionary.Values)
|
foreach (TaskInventoryItem tii in taskDictionary.Values)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[ARCHIVER]: Analysing item asset type {0}", tii.Type);
|
// m_log.DebugFormat(
|
||||||
|
// "[ARCHIVER]: Analysing item {0} asset type {1} in {2} {3}",
|
||||||
|
// tii.Name, tii.Type, part.Name, part.UUID);
|
||||||
|
|
||||||
if (!assetUuids.ContainsKey(tii.AssetID))
|
if (!assetUuids.ContainsKey(tii.AssetID))
|
||||||
GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids);
|
GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids);
|
||||||
|
|
|
@ -1074,7 +1074,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReprioritizeUpdates(UpdatePriorityHandler handler)
|
public void ReprioritizeUpdates()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -638,7 +638,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReprioritizeUpdates(UpdatePriorityHandler handler)
|
public void ReprioritizeUpdates()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -641,7 +641,7 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReprioritizeUpdates(UpdatePriorityHandler handler)
|
public void ReprioritizeUpdates()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,20 @@ namespace OpenSim.Tests.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create an asset from the given data
|
/// Create an asset from the given data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static AssetBase CreateAsset(UUID assetUuid, string data, UUID creatorID)
|
public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, byte[] data, UUID creatorID)
|
||||||
{
|
{
|
||||||
AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object, creatorID.ToString());
|
AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)assetType, creatorID.ToString());
|
||||||
asset.Data = Encoding.ASCII.GetBytes(data);
|
asset.Data = data;
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create an asset from the given data
|
||||||
|
/// </summary>
|
||||||
|
public static AssetBase CreateAsset(UUID assetUuid, AssetType assetType, string data, UUID creatorID)
|
||||||
|
{
|
||||||
|
return CreateAsset(assetUuid, assetType, Encoding.ASCII.GetBytes(data), creatorID);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create an asset from the given scene object
|
/// Create an asset from the given scene object
|
||||||
|
@ -53,9 +61,11 @@ namespace OpenSim.Tests.Common
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static AssetBase CreateAsset(UUID assetUuid, SceneObjectGroup sog)
|
public static AssetBase CreateAsset(UUID assetUuid, SceneObjectGroup sog)
|
||||||
{
|
{
|
||||||
AssetBase asset = new AssetBase(assetUuid, assetUuid.ToString(), (sbyte)AssetType.Object, sog.OwnerID.ToString());
|
return CreateAsset(
|
||||||
asset.Data = Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(sog));
|
assetUuid,
|
||||||
return asset;
|
AssetType.Object,
|
||||||
|
Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(sog)),
|
||||||
|
sog.OwnerID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ using Nini.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
|
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
|
@ -115,7 +114,6 @@ namespace OpenSim.Tests.Common.Setup
|
||||||
return SetupScene(name, id, x, y,"");
|
return SetupScene(name, id, x, y,"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions
|
/// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions
|
||||||
/// or a different, to get a brand new scene with new shared region modules.
|
/// or a different, to get a brand new scene with new shared region modules.
|
||||||
|
|
Loading…
Reference in New Issue