narrange to do basic cleanup of the CMS module
parent
eee0fa73e0
commit
af5c7e52b1
|
@ -1,43 +1,62 @@
|
||||||
|
#region Header
|
||||||
|
|
||||||
// AuraMetaEntity.cs created with MonoDevelop
|
// AuraMetaEntity.cs created with MonoDevelop
|
||||||
// User: bongiojp at 3:03 PM 8/6/2008
|
// User: bongiojp at 3:03 PM 8/6/2008
|
||||||
//
|
//
|
||||||
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
|
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#endregion Header
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using log4net;
|
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
|
||||||
using Axiom.Math;
|
using Axiom.Math;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public class AuraMetaEntity : PointMetaEntity
|
public class AuraMetaEntity : PointMetaEntity
|
||||||
{
|
{
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
//transparency of root part, NOT particle system. Should probably add support for changing particle system transparency.
|
//transparency of root part, NOT particle system. Should probably add support for changing particle system transparency.
|
||||||
public AuraMetaEntity(Scene scene, uint LocalId, LLVector3 groupPos, float transparency, LLVector3 color, LLVector3 scale) : base(scene, LocalId, groupPos, transparency)
|
public AuraMetaEntity(Scene scene, uint LocalId, LLVector3 groupPos, float transparency, LLVector3 color, LLVector3 scale)
|
||||||
|
: base(scene, LocalId, groupPos, transparency)
|
||||||
{
|
{
|
||||||
SetAura(color, scale);
|
SetAura(color, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuraMetaEntity(Scene scene, LLUUID uuid, uint LocalId, LLVector3 groupPos, float transparency, LLVector3 color, LLVector3 scale) : base(scene, uuid, LocalId, groupPos, transparency)
|
public AuraMetaEntity(Scene scene, LLUUID uuid, uint LocalId, LLVector3 groupPos, float transparency, LLVector3 color, LLVector3 scale)
|
||||||
|
: base(scene, uuid, LocalId, groupPos, transparency)
|
||||||
{
|
{
|
||||||
SetAura(color, scale);
|
SetAura(color, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Constructors
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
|
||||||
private float Average(LLVector3 values)
|
private float Average(LLVector3 values)
|
||||||
{
|
{
|
||||||
return (values.X + values.Y + values.Z)/3f;
|
return (values.X + values.Y + values.Z)/3f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Private Methods
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
public void SetAura(LLVector3 color, LLVector3 scale)
|
public void SetAura(LLVector3 color, LLVector3 scale)
|
||||||
{
|
{
|
||||||
SetAura(color, Average(scale) * 2.0f);
|
SetAura(color, Average(scale) * 2.0f);
|
||||||
|
@ -63,6 +82,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
}
|
}
|
||||||
SetAura(From, color, radius, burstRadius, age, burstRate, patternFlags);
|
SetAura(From, color, radius, burstRadius, age, burstRate, patternFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAura(SceneObjectPart From, LLVector3 color, float radius, float burstRadius, float age, float burstRate, libsecondlife.Primitive.ParticleSystem.SourcePattern patternFlags)
|
public void SetAura(SceneObjectPart From, LLVector3 color, float radius, float burstRadius, float age, float burstRate, libsecondlife.Primitive.ParticleSystem.SourcePattern patternFlags)
|
||||||
{
|
{
|
||||||
Primitive.ParticleSystem prules = new Primitive.ParticleSystem();
|
Primitive.ParticleSystem prules = new Primitive.ParticleSystem();
|
||||||
|
@ -110,5 +130,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
prules.CRC = 1; //activates the particle system??
|
prules.CRC = 1; //activates the particle system??
|
||||||
From.AddNewParticleSystem(prules);
|
From.AddNewParticleSystem(prules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Public Methods
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,38 +1,52 @@
|
||||||
|
#region Header
|
||||||
|
|
||||||
// BeamMetaEntity.cs created with MonoDevelop
|
// BeamMetaEntity.cs created with MonoDevelop
|
||||||
// User: bongiojp at 3:03 PM 8/6/2008
|
// User: bongiojp at 3:03 PM 8/6/2008
|
||||||
//
|
//
|
||||||
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
|
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#endregion Header
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using log4net;
|
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
|
||||||
using Axiom.Math;
|
using Axiom.Math;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public class BeamMetaEntity : PointMetaEntity
|
public class BeamMetaEntity : PointMetaEntity
|
||||||
{
|
{
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
public BeamMetaEntity(Scene scene, uint LocalId, LLVector3 groupPos, float transparency, SceneObjectPart To, LLVector3 color) : base(scene, LocalId, groupPos, transparency)
|
public BeamMetaEntity(Scene scene, uint LocalId, LLVector3 groupPos, float transparency, SceneObjectPart To, LLVector3 color)
|
||||||
|
: base(scene, LocalId, groupPos, transparency)
|
||||||
{
|
{
|
||||||
SetBeamToUUID(To, color);
|
SetBeamToUUID(To, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeamMetaEntity(Scene scene, LLUUID uuid, uint LocalId, LLVector3 groupPos, float transparency, SceneObjectPart To, LLVector3 color) : base(scene, uuid, LocalId, groupPos, transparency)
|
public BeamMetaEntity(Scene scene, LLUUID uuid, uint LocalId, LLVector3 groupPos, float transparency, SceneObjectPart To, LLVector3 color)
|
||||||
|
: base(scene, uuid, LocalId, groupPos, transparency)
|
||||||
{
|
{
|
||||||
SetBeamToUUID(To, color);
|
SetBeamToUUID(To, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Constructors
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
public void SetBeamToUUID(SceneObjectPart To, LLVector3 color)
|
public void SetBeamToUUID(SceneObjectPart To, LLVector3 color)
|
||||||
{
|
{
|
||||||
SceneObjectPart From = m_Entity.RootPart;
|
SceneObjectPart From = m_Entity.RootPart;
|
||||||
|
@ -94,5 +108,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
prules.CRC = 1; //activates the particle system??
|
prules.CRC = 1; //activates the particle system??
|
||||||
From.AddNewParticleSystem(prules);
|
From.AddNewParticleSystem(prules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Public Methods
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,68 +1,38 @@
|
||||||
|
#region Header
|
||||||
|
|
||||||
// CMController.cs
|
// CMController.cs
|
||||||
// User: bongiojp
|
// User: bongiojp
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#endregion Header
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
using OpenSim;
|
using OpenSim;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using log4net;
|
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
|
||||||
using Axiom.Math;
|
using Axiom.Math;
|
||||||
using System.Threading;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The controller in a Model-View-Controller framework. This controller catches actions by the avatars, creates work packets, loops through these work packets in a separate thread,
|
/// The controller in a Model-View-Controller framework. This controller catches actions by the avatars, creates work packets, loops through these work packets in a separate thread,
|
||||||
/// then dictates to the model how the data should change and dictates to the view which data should be displayed. The main mechanism for interaction is through the simchat system.
|
/// then dictates to the model how the data should change and dictates to the view which data should be displayed. The main mechanism for interaction is through the simchat system.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CMController
|
public class CMController
|
||||||
{
|
{
|
||||||
|
#region Static Fields
|
||||||
/// <value>
|
|
||||||
/// The structure that defines the basic unit of work which is produced when a user sends commands to the ContentMangaementSystem.
|
|
||||||
/// </value>
|
|
||||||
private struct Work
|
|
||||||
{
|
|
||||||
public WorkType Type;
|
|
||||||
public Object Data1; //Just space for holding data.
|
|
||||||
public Object Data2; //Just more space for holding data.
|
|
||||||
public uint LocalId; //Convenient
|
|
||||||
public LLUUID UUID; //Convenient
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <value>
|
|
||||||
/// Identifies what the data in struct Work should be used for.
|
|
||||||
/// </value>
|
|
||||||
private enum WorkType
|
|
||||||
{
|
|
||||||
NONE,
|
|
||||||
OBJECTATTRIBUTECHANGE,
|
|
||||||
PRIMITIVEADDED,
|
|
||||||
OBJECTDUPLICATED,
|
|
||||||
OBJECTKILLED,
|
|
||||||
UNDODID,
|
|
||||||
NEWCLIENT,
|
|
||||||
SIMCHAT
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <value>
|
|
||||||
/// Used to keep track of whether a list has been produced yet and whether that list is up-to-date compard to latest revision on disk.
|
|
||||||
/// </value>
|
|
||||||
[Flags]
|
|
||||||
private enum State
|
|
||||||
{
|
|
||||||
NONE = 0,
|
|
||||||
DIRTY = 1, // The meta entities may not correctly represent the last revision.
|
|
||||||
SHOWING_CHANGES = 1<<1 // The meta entities are being shown to user.
|
|
||||||
}
|
|
||||||
|
|
||||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
@ -71,24 +41,32 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
/// </value>
|
/// </value>
|
||||||
private static OpenSim.Framework.BlockingQueue<Work> m_WorkQueue = new OpenSim.Framework.BlockingQueue<Work>();
|
private static OpenSim.Framework.BlockingQueue<Work> m_WorkQueue = new OpenSim.Framework.BlockingQueue<Work>();
|
||||||
|
|
||||||
/// <value>
|
#endregion Static Fields
|
||||||
/// A list of all the scenes that should be revisioned. Controller is the only class that keeps track of all scenes in the region.
|
|
||||||
/// </value>
|
#region Fields
|
||||||
Hashtable m_sceneList = Hashtable.Synchronized(new Hashtable());
|
|
||||||
|
bool init = false;
|
||||||
|
int m_channel = -1;
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// The estate module is used to identify which clients are estateManagers. Presently, the controller only pays attention to estate managers.
|
/// The estate module is used to identify which clients are estateManagers. Presently, the controller only pays attention to estate managers.
|
||||||
/// </value>
|
/// </value>
|
||||||
IEstateModule m_estateModule = null;
|
IEstateModule m_estateModule = null;
|
||||||
|
|
||||||
Thread m_thread = null;
|
|
||||||
State m_state = State.NONE;
|
|
||||||
bool init = false;
|
|
||||||
|
|
||||||
//These have to be global variables, threading doesn't allow for passing parameters. (Used in MainLoop)
|
//These have to be global variables, threading doesn't allow for passing parameters. (Used in MainLoop)
|
||||||
CMModel m_model = null;
|
CMModel m_model = null;
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// A list of all the scenes that should be revisioned. Controller is the only class that keeps track of all scenes in the region.
|
||||||
|
/// </value>
|
||||||
|
Hashtable m_sceneList = Hashtable.Synchronized(new Hashtable());
|
||||||
|
State m_state = State.NONE;
|
||||||
|
Thread m_thread = null;
|
||||||
CMView m_view = null;
|
CMView m_view = null;
|
||||||
int m_channel = -1;
|
|
||||||
|
#endregion Fields
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a work thread with an initial scene. Additional scenes should be added through the RegisterNewRegion method.
|
/// Initializes a work thread with an initial scene. Additional scenes should be added through the RegisterNewRegion method.
|
||||||
|
@ -112,6 +90,34 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
Initialize(model, view, scene, channel);
|
Initialize(model, view, scene, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Constructors
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
|
||||||
|
//------------------------------------------------ EVENTS ----------------------------------------------------//
|
||||||
|
private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, LLUUID regionID)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Searches in all scenes for a SceneObjectGroup that contains a part with a specific localID. If found, the object is returned. Else null is returned.
|
||||||
|
/// </summary>
|
||||||
|
private SceneObjectGroup GetGroupByPrim(uint localID)
|
||||||
|
{
|
||||||
|
foreach(Object currScene in m_sceneList.Values)
|
||||||
|
{
|
||||||
|
foreach (EntityBase ent in ((Scene)currScene).GetEntities())
|
||||||
|
{
|
||||||
|
if (ent is SceneObjectGroup)
|
||||||
|
{
|
||||||
|
if (((SceneObjectGroup)ent).HasChildPrim(localID))
|
||||||
|
return (SceneObjectGroup)ent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private void Initialize(CMModel model, CMView view, Scene scene, int channel)
|
private void Initialize(CMModel model, CMView view, Scene scene, int channel)
|
||||||
{
|
{
|
||||||
lock(this)
|
lock(this)
|
||||||
|
@ -126,25 +132,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Register a new scene object to keep track of for revisioning. Starts the controller monitoring actions of clients within the given scene.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="scene">
|
|
||||||
/// A <see cref="Scene"/>
|
|
||||||
/// </param>
|
|
||||||
public void RegisterNewRegion(Scene scene)
|
|
||||||
{
|
|
||||||
m_sceneList.Add(scene.RegionInfo.RegionID, scene);
|
|
||||||
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] Registering new region: " + scene.RegionInfo.RegionID);
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] Initializing Content Management System.");
|
|
||||||
|
|
||||||
scene.EventManager.OnNewClient += StartManaging;
|
|
||||||
scene.EventManager.OnRemovePresence += StopManaging;
|
|
||||||
// scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
|
|
||||||
scene.EventManager.OnObjectBeingRemovedFromScene += GroupBeingDeleted;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Run in a thread of its own. A endless loop that consumes (or blocks on) and work queue. Thw work queue is filled through client actions.
|
/// Run in a thread of its own. A endless loop that consumes (or blocks on) and work queue. Thw work queue is filled through client actions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -199,6 +186,23 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
view.SendMetaEntitiesToNewClient(client);
|
view.SendMetaEntitiesToNewClient(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Only called by the MainLoop.
|
||||||
|
/// </summary>
|
||||||
|
private void ObjectAttributeChanged(CMModel model, CMView view, uint LocalId)
|
||||||
|
{
|
||||||
|
SceneObjectGroup group = null;
|
||||||
|
if ((m_state & State.SHOWING_CHANGES) > 0)
|
||||||
|
{
|
||||||
|
group = GetGroupByPrim(LocalId);
|
||||||
|
if (group != null)
|
||||||
|
{
|
||||||
|
view.DisplayAuras( model.UpdateNormalEntityEffects(group) ); //Might be a normal entity (green aura)
|
||||||
|
m_view.DisplayMetaEntity(group.UUID); //Might be a meta entity (blue aura)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Only called by the MainLoop. Displays new green auras over the newly created part when a part is shift copied.
|
/// Only called by the MainLoop. Displays new green auras over the newly created part when a part is shift copied.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -220,36 +224,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Only called by the MainLoop.
|
|
||||||
/// </summary>
|
|
||||||
private void UndoDid(CMModel model, CMView view, LLUUID uuid)
|
|
||||||
{
|
|
||||||
if ((m_state & State.SHOWING_CHANGES) > 0)
|
|
||||||
{
|
|
||||||
ContentManagementEntity ent = model.FindMetaEntityAffectedByUndo(uuid);
|
|
||||||
if (ent != null)
|
|
||||||
view.DisplayEntity(ent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Only called by the MainLoop.
|
|
||||||
/// </summary>
|
|
||||||
private void ObjectAttributeChanged(CMModel model, CMView view, uint LocalId)
|
|
||||||
{
|
|
||||||
SceneObjectGroup group = null;
|
|
||||||
if ((m_state & State.SHOWING_CHANGES) > 0)
|
|
||||||
{
|
|
||||||
group = GetGroupByPrim(LocalId);
|
|
||||||
if (group != null)
|
|
||||||
{
|
|
||||||
view.DisplayAuras( model.UpdateNormalEntityEffects(group) ); //Might be a normal entity (green aura)
|
|
||||||
m_view.DisplayMetaEntity(group.UUID); //Might be a meta entity (blue aura)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Only called by the MainLoop.
|
/// Only called by the MainLoop.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -263,177 +237,67 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Only called by the MainLoop. Takes the message from a user sent to the channel and executes the proper command.
|
/// Only called by the MainLoop.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SimChat(CMModel model, CMView view, OSChatMessage e, int channel)
|
private void UndoDid(CMModel model, CMView view, LLUUID uuid)
|
||||||
{
|
|
||||||
if (e.Channel != channel)
|
|
||||||
return;
|
|
||||||
if (e.Sender == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] Message received: " + e.Message);
|
|
||||||
|
|
||||||
IClientAPI client = e.Sender;
|
|
||||||
Scene scene = (Scene) e.Scene;
|
|
||||||
string message = e.Message;
|
|
||||||
string[] args = e.Message.Split(new char[] {' '});
|
|
||||||
|
|
||||||
ScenePresence avatar = scene.GetScenePresence(client.AgentId);
|
|
||||||
|
|
||||||
if (!(m_estateModule.IsManager(avatar.UUID)))
|
|
||||||
{
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] Message sent from non Estate Manager ... ignoring.");
|
|
||||||
view.SendSimChatMessage(scene, "You must be an estate manager to perform that action.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(args[0])
|
|
||||||
{
|
|
||||||
case "ci":
|
|
||||||
case "commit":
|
|
||||||
commit(message, scene, model, view);
|
|
||||||
break;
|
|
||||||
case "dm":
|
|
||||||
case "diff-mode":
|
|
||||||
diffmode(scene, model, view);
|
|
||||||
break;
|
|
||||||
case "rb":
|
|
||||||
case "rollback":
|
|
||||||
rollback(scene, model, view);
|
|
||||||
break;
|
|
||||||
case "help":
|
|
||||||
m_view.DisplayHelpMenu(scene);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
view.SendSimChatMessage(scene, "Command not found: " + args[0]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Only called from within the SimChat method. Hides all auras and meta entities,
|
|
||||||
/// retrieves the current scene object list with the most recent revision retrieved from the model for each scene,
|
|
||||||
/// then lets the view update the clients of the new objects.
|
|
||||||
/// </summary>
|
|
||||||
protected void rollback(Scene scene, CMModel model, CMView view)
|
|
||||||
{
|
{
|
||||||
if ((m_state & State.SHOWING_CHANGES) > 0)
|
if ((m_state & State.SHOWING_CHANGES) > 0)
|
||||||
{
|
{
|
||||||
view.HideAllAuras();
|
ContentManagementEntity ent = model.FindMetaEntityAffectedByUndo(uuid);
|
||||||
view.HideAllMetaEntities();
|
if (ent != null)
|
||||||
|
view.DisplayEntity(ent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.Collections.Generic.List<Scene> proximitySceneList = ScenesInOrderOfProximity( m_sceneList, scene);
|
#endregion Private Methods
|
||||||
foreach(Scene currScene in proximitySceneList)
|
|
||||||
model.RollbackRegion(currScene);
|
|
||||||
|
|
||||||
if ((m_state & State.DIRTY) != 0 )
|
#region Protected Methods
|
||||||
|
|
||||||
|
protected void GroupBeingDeleted(SceneObjectGroup group)
|
||||||
{
|
{
|
||||||
model.DeleteAllMetaObjects();
|
m_log.Debug("[CONTENT MANAGEMENT] Something was deleted!!!");
|
||||||
foreach(Scene currScene in proximitySceneList)
|
Work moreWork = new Work();
|
||||||
model.UpdateCMEntities(currScene);
|
moreWork.Type = WorkType.OBJECTKILLED;
|
||||||
|
moreWork.Data1 = group.Copy();
|
||||||
|
m_WorkQueue.Enqueue(moreWork);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_state & State.SHOWING_CHANGES) > 0)
|
protected void ObjectDuplicated(uint localID, LLVector3 offset, uint dupeFlags, LLUUID AgentID, LLUUID GroupID)
|
||||||
view.DisplayRecentChanges();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Only called from within the SimChat method.
|
|
||||||
/// </summary>
|
|
||||||
protected void diffmode(Scene scene, CMModel model, CMView view)
|
|
||||||
{
|
{
|
||||||
System.Collections.Generic.List<Scene> proximitySceneList = ScenesInOrderOfProximity( m_sceneList, scene);
|
Work moreWork = new Work();
|
||||||
|
moreWork.Type = WorkType.OBJECTDUPLICATED;
|
||||||
|
moreWork.LocalId = localID;
|
||||||
|
m_WorkQueue.Enqueue(moreWork);
|
||||||
|
m_log.Debug("[CONTENT MANAGEMENT] dup queue");
|
||||||
|
}
|
||||||
|
|
||||||
if ((m_state & State.SHOWING_CHANGES) > 0) // TURN OFF
|
protected void ObjectDuplicatedOnRay(uint localID, uint dupeFlags, LLUUID AgentID, LLUUID GroupID,
|
||||||
|
LLUUID RayTargetObj, LLVector3 RayEnd, LLVector3 RayStart,
|
||||||
|
bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates)
|
||||||
{
|
{
|
||||||
view.SendSimChatMessage(scene, "Hiding all meta objects.");
|
Work moreWork = new Work();
|
||||||
view.HideAllMetaEntities();
|
moreWork.Type = WorkType.OBJECTDUPLICATED;
|
||||||
view.HideAllAuras();
|
moreWork.LocalId = localID;
|
||||||
view.SendSimChatMessage(scene, "Diff-mode = OFF");
|
m_WorkQueue.Enqueue(moreWork);
|
||||||
|
m_log.Debug("[CONTENT MANAGEMENT] dup queue");
|
||||||
m_state &= ~State.SHOWING_CHANGES;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else // TURN ON
|
|
||||||
|
protected void OnNewClient(IClientAPI client)
|
||||||
{
|
{
|
||||||
if ((m_state & State.DIRTY) != 0 || m_state == State.NONE)
|
Work moreWork = new Work();
|
||||||
|
moreWork.Type = WorkType.NEWCLIENT;
|
||||||
|
moreWork.Data1 = client;
|
||||||
|
m_WorkQueue.Enqueue(moreWork);
|
||||||
|
m_log.Debug("[CONTENT MANAGEMENT] new client");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void OnUnDid(IClientAPI remoteClient, LLUUID primId)
|
||||||
{
|
{
|
||||||
view.SendSimChatMessage(scene, "Hiding meta objects and replacing with latest revision");
|
Work moreWork = new Work();
|
||||||
//Hide objects from users and Forget about them
|
moreWork.Type = WorkType.UNDODID;
|
||||||
view.HideAllMetaEntities();
|
moreWork.UUID = primId;
|
||||||
view.HideAllAuras();
|
m_WorkQueue.Enqueue(moreWork);
|
||||||
model.DeleteAllMetaObjects();
|
m_log.Debug("[CONTENT MANAGEMENT] undid");
|
||||||
//Recreate them from backend files
|
|
||||||
foreach(Object currScene in m_sceneList.Values)
|
|
||||||
model.UpdateCMEntities((Scene) currScene);
|
|
||||||
}
|
|
||||||
else if ((m_state & State.DIRTY) != 0) {
|
|
||||||
view.SendSimChatMessage(scene, "Forming list of meta entities with latest revision");
|
|
||||||
foreach(Scene currScene in proximitySceneList)
|
|
||||||
model.UpdateCMEntities(currScene);
|
|
||||||
}
|
|
||||||
|
|
||||||
view.SendSimChatMessage(scene, "Displaying differences between last revision and current environment");
|
|
||||||
foreach(Scene currScene in proximitySceneList)
|
|
||||||
model.CheckForNewEntitiesMissingAuras(currScene);
|
|
||||||
view.DisplayRecentChanges();
|
|
||||||
|
|
||||||
view.SendSimChatMessage(scene, "Diff-mode = ON");
|
|
||||||
m_state |= State.SHOWING_CHANGES;
|
|
||||||
m_state &= ~State.DIRTY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Only called from within the SimChat method.
|
|
||||||
/// </summary>
|
|
||||||
protected void commit(string message, Scene scene, CMModel model, CMView view)
|
|
||||||
{
|
|
||||||
System.Collections.Generic.List<Scene> proximitySceneList = ScenesInOrderOfProximity( m_sceneList, scene);
|
|
||||||
|
|
||||||
string[] args = message.Split(new char[] {' '});
|
|
||||||
|
|
||||||
char[] logMessage = {' '};
|
|
||||||
if (args.Length > 1)
|
|
||||||
{
|
|
||||||
logMessage = new char[message.Length - (args[0].Length)];
|
|
||||||
message.CopyTo(args[0].Length, logMessage, 0, message.Length - (args[0].Length));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] Saving terrain and objects of region.");
|
|
||||||
foreach(Scene currScene in proximitySceneList)
|
|
||||||
{
|
|
||||||
model.CommitRegion(currScene, new String(logMessage));
|
|
||||||
view.SendSimChatMessage(scene, "Region Saved Successfully: " + currScene.RegionInfo.RegionName);
|
|
||||||
}
|
|
||||||
|
|
||||||
view.SendSimChatMessage(scene, "Successfully saved all regions.");
|
|
||||||
m_state |= State.DIRTY;
|
|
||||||
|
|
||||||
if ((m_state & State.SHOWING_CHANGES) > 0) //DISPLAY NEW CHANGES INSTEAD OF OLD CHANGES
|
|
||||||
{
|
|
||||||
view.SendSimChatMessage(scene, "Updating differences between new revision and current environment.");
|
|
||||||
//Hide objects from users and Forget about them
|
|
||||||
view.HideAllMetaEntities();
|
|
||||||
view.HideAllAuras();
|
|
||||||
model.DeleteAllMetaObjects();
|
|
||||||
|
|
||||||
//Recreate them from backend files
|
|
||||||
foreach(Scene currScene in proximitySceneList)
|
|
||||||
{
|
|
||||||
model.UpdateCMEntities(currScene);
|
|
||||||
view.SendSimChatMessage(scene, "Finished updating differences between current scene and last revision: " + currScene.RegionInfo.RegionName);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Display new objects to users1
|
|
||||||
view.DisplayRecentChanges();
|
|
||||||
view.SendSimChatMessage(scene, "Finished updating for DIFF-MODE.");
|
|
||||||
m_state &= ~(State.DIRTY);
|
|
||||||
m_state |= State.SHOWING_CHANGES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -475,28 +339,15 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
return newList;
|
return newList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
//This is stupid, the same information is contained in the first and second argument
|
||||||
/// Searches in all scenes for a SceneObjectGroup that contains a part with a specific localID. If found, the object is returned. Else null is returned.
|
protected void SimChatSent(Object x, OSChatMessage e)
|
||||||
/// </summary>
|
|
||||||
private SceneObjectGroup GetGroupByPrim(uint localID)
|
|
||||||
{
|
|
||||||
foreach(Object currScene in m_sceneList.Values)
|
|
||||||
{
|
|
||||||
foreach (EntityBase ent in ((Scene)currScene).GetEntities())
|
|
||||||
{
|
|
||||||
if (ent is SceneObjectGroup)
|
|
||||||
{
|
|
||||||
if (((SceneObjectGroup)ent).HasChildPrim(localID))
|
|
||||||
return (SceneObjectGroup)ent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
//------------------------------------------------ EVENTS ----------------------------------------------------//
|
|
||||||
|
|
||||||
private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, LLUUID regionID)
|
|
||||||
{
|
{
|
||||||
|
m_log.Debug("[CONTENT MANAGEMENT] SIMCHAT SENT !!!!!!!");
|
||||||
|
m_log.Debug("[CONTENT MANAGEMENT] message was: " + e.Message);
|
||||||
|
Work moreWork = new Work();
|
||||||
|
moreWork.Type = WorkType.SIMCHAT;
|
||||||
|
moreWork.Data1 = e;
|
||||||
|
m_WorkQueue.Enqueue(moreWork);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -555,94 +406,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void GroupBeingDeleted(SceneObjectGroup group)
|
|
||||||
{
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] Something was deleted!!!");
|
|
||||||
Work moreWork = new Work();
|
|
||||||
moreWork.Type = WorkType.OBJECTKILLED;
|
|
||||||
moreWork.Data1 = group.Copy();
|
|
||||||
m_WorkQueue.Enqueue(moreWork);
|
|
||||||
}
|
|
||||||
|
|
||||||
//This is stupid, the same information is contained in the first and second argument
|
|
||||||
protected void SimChatSent(Object x, OSChatMessage e)
|
|
||||||
{
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] SIMCHAT SENT !!!!!!!");
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] message was: " + e.Message);
|
|
||||||
Work moreWork = new Work();
|
|
||||||
moreWork.Type = WorkType.SIMCHAT;
|
|
||||||
moreWork.Data1 = e;
|
|
||||||
m_WorkQueue.Enqueue(moreWork);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void ObjectDuplicated(uint localID, LLVector3 offset, uint dupeFlags, LLUUID AgentID, LLUUID GroupID)
|
|
||||||
{
|
|
||||||
Work moreWork = new Work();
|
|
||||||
moreWork.Type = WorkType.OBJECTDUPLICATED;
|
|
||||||
moreWork.LocalId = localID;
|
|
||||||
m_WorkQueue.Enqueue(moreWork);
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] dup queue");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void ObjectDuplicatedOnRay(uint localID, uint dupeFlags, LLUUID AgentID, LLUUID GroupID,
|
|
||||||
LLUUID RayTargetObj, LLVector3 RayEnd, LLVector3 RayStart,
|
|
||||||
bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates)
|
|
||||||
{
|
|
||||||
Work moreWork = new Work();
|
|
||||||
moreWork.Type = WorkType.OBJECTDUPLICATED;
|
|
||||||
moreWork.LocalId = localID;
|
|
||||||
m_WorkQueue.Enqueue(moreWork);
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] dup queue");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void OnNewClient(IClientAPI client)
|
|
||||||
{
|
|
||||||
Work moreWork = new Work();
|
|
||||||
moreWork.Type = WorkType.NEWCLIENT;
|
|
||||||
moreWork.Data1 = client;
|
|
||||||
m_WorkQueue.Enqueue(moreWork);
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] new client");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void OnUnDid(IClientAPI remoteClient, LLUUID primId)
|
|
||||||
{
|
|
||||||
Work moreWork = new Work();
|
|
||||||
moreWork.Type = WorkType.UNDODID;
|
|
||||||
moreWork.UUID = primId;
|
|
||||||
m_WorkQueue.Enqueue(moreWork);
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] undid");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void UpdateSinglePosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
|
|
||||||
{
|
|
||||||
Work moreWork = new Work();
|
|
||||||
moreWork.Type = WorkType.OBJECTATTRIBUTECHANGE;
|
|
||||||
moreWork.LocalId = localID;
|
|
||||||
m_WorkQueue.Enqueue(moreWork);
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] move");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
protected void UpdateSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
|
|
||||||
{
|
|
||||||
Work moreWork = new Work();
|
|
||||||
moreWork.Type = WorkType.OBJECTATTRIBUTECHANGE;
|
|
||||||
moreWork.LocalId = localID;
|
|
||||||
m_WorkQueue.Enqueue(moreWork);
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] rot");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void UpdateSingleScale(uint localID, LLVector3 scale, IClientAPI remoteClient)
|
|
||||||
{
|
|
||||||
Work moreWork = new Work();
|
|
||||||
moreWork.Type = WorkType.OBJECTATTRIBUTECHANGE;
|
|
||||||
moreWork.LocalId = localID;
|
|
||||||
m_WorkQueue.Enqueue(moreWork);
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] scale");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void UpdateMultiplePosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
|
protected void UpdateMultiplePosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
Work moreWork = new Work();
|
Work moreWork = new Work();
|
||||||
|
@ -680,5 +443,279 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
m_WorkQueue.Enqueue(moreWork);
|
m_WorkQueue.Enqueue(moreWork);
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] new parts");
|
m_log.Debug("[CONTENT MANAGEMENT] new parts");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void UpdateSinglePosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
|
||||||
|
{
|
||||||
|
Work moreWork = new Work();
|
||||||
|
moreWork.Type = WorkType.OBJECTATTRIBUTECHANGE;
|
||||||
|
moreWork.LocalId = localID;
|
||||||
|
m_WorkQueue.Enqueue(moreWork);
|
||||||
|
m_log.Debug("[CONTENT MANAGEMENT] move");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
protected void UpdateSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
|
||||||
|
{
|
||||||
|
Work moreWork = new Work();
|
||||||
|
moreWork.Type = WorkType.OBJECTATTRIBUTECHANGE;
|
||||||
|
moreWork.LocalId = localID;
|
||||||
|
m_WorkQueue.Enqueue(moreWork);
|
||||||
|
m_log.Debug("[CONTENT MANAGEMENT] rot");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void UpdateSingleScale(uint localID, LLVector3 scale, IClientAPI remoteClient)
|
||||||
|
{
|
||||||
|
Work moreWork = new Work();
|
||||||
|
moreWork.Type = WorkType.OBJECTATTRIBUTECHANGE;
|
||||||
|
moreWork.LocalId = localID;
|
||||||
|
m_WorkQueue.Enqueue(moreWork);
|
||||||
|
m_log.Debug("[CONTENT MANAGEMENT] scale");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Only called from within the SimChat method.
|
||||||
|
/// </summary>
|
||||||
|
protected void commit(string message, Scene scene, CMModel model, CMView view)
|
||||||
|
{
|
||||||
|
System.Collections.Generic.List<Scene> proximitySceneList = ScenesInOrderOfProximity( m_sceneList, scene);
|
||||||
|
|
||||||
|
string[] args = message.Split(new char[] {' '});
|
||||||
|
|
||||||
|
char[] logMessage = {' '};
|
||||||
|
if (args.Length > 1)
|
||||||
|
{
|
||||||
|
logMessage = new char[message.Length - (args[0].Length)];
|
||||||
|
message.CopyTo(args[0].Length, logMessage, 0, message.Length - (args[0].Length));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.Debug("[CONTENT MANAGEMENT] Saving terrain and objects of region.");
|
||||||
|
foreach(Scene currScene in proximitySceneList)
|
||||||
|
{
|
||||||
|
model.CommitRegion(currScene, new String(logMessage));
|
||||||
|
view.SendSimChatMessage(scene, "Region Saved Successfully: " + currScene.RegionInfo.RegionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
view.SendSimChatMessage(scene, "Successfully saved all regions.");
|
||||||
|
m_state |= State.DIRTY;
|
||||||
|
|
||||||
|
if ((m_state & State.SHOWING_CHANGES) > 0) //DISPLAY NEW CHANGES INSTEAD OF OLD CHANGES
|
||||||
|
{
|
||||||
|
view.SendSimChatMessage(scene, "Updating differences between new revision and current environment.");
|
||||||
|
//Hide objects from users and Forget about them
|
||||||
|
view.HideAllMetaEntities();
|
||||||
|
view.HideAllAuras();
|
||||||
|
model.DeleteAllMetaObjects();
|
||||||
|
|
||||||
|
//Recreate them from backend files
|
||||||
|
foreach(Scene currScene in proximitySceneList)
|
||||||
|
{
|
||||||
|
model.UpdateCMEntities(currScene);
|
||||||
|
view.SendSimChatMessage(scene, "Finished updating differences between current scene and last revision: " + currScene.RegionInfo.RegionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Display new objects to users1
|
||||||
|
view.DisplayRecentChanges();
|
||||||
|
view.SendSimChatMessage(scene, "Finished updating for DIFF-MODE.");
|
||||||
|
m_state &= ~(State.DIRTY);
|
||||||
|
m_state |= State.SHOWING_CHANGES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Only called from within the SimChat method.
|
||||||
|
/// </summary>
|
||||||
|
protected void diffmode(Scene scene, CMModel model, CMView view)
|
||||||
|
{
|
||||||
|
System.Collections.Generic.List<Scene> proximitySceneList = ScenesInOrderOfProximity( m_sceneList, scene);
|
||||||
|
|
||||||
|
if ((m_state & State.SHOWING_CHANGES) > 0) // TURN OFF
|
||||||
|
{
|
||||||
|
view.SendSimChatMessage(scene, "Hiding all meta objects.");
|
||||||
|
view.HideAllMetaEntities();
|
||||||
|
view.HideAllAuras();
|
||||||
|
view.SendSimChatMessage(scene, "Diff-mode = OFF");
|
||||||
|
|
||||||
|
m_state &= ~State.SHOWING_CHANGES;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else // TURN ON
|
||||||
|
{
|
||||||
|
if ((m_state & State.DIRTY) != 0 || m_state == State.NONE)
|
||||||
|
{
|
||||||
|
view.SendSimChatMessage(scene, "Hiding meta objects and replacing with latest revision");
|
||||||
|
//Hide objects from users and Forget about them
|
||||||
|
view.HideAllMetaEntities();
|
||||||
|
view.HideAllAuras();
|
||||||
|
model.DeleteAllMetaObjects();
|
||||||
|
//Recreate them from backend files
|
||||||
|
foreach(Object currScene in m_sceneList.Values)
|
||||||
|
model.UpdateCMEntities((Scene) currScene);
|
||||||
|
}
|
||||||
|
else if ((m_state & State.DIRTY) != 0) {
|
||||||
|
view.SendSimChatMessage(scene, "Forming list of meta entities with latest revision");
|
||||||
|
foreach(Scene currScene in proximitySceneList)
|
||||||
|
model.UpdateCMEntities(currScene);
|
||||||
|
}
|
||||||
|
|
||||||
|
view.SendSimChatMessage(scene, "Displaying differences between last revision and current environment");
|
||||||
|
foreach(Scene currScene in proximitySceneList)
|
||||||
|
model.CheckForNewEntitiesMissingAuras(currScene);
|
||||||
|
view.DisplayRecentChanges();
|
||||||
|
|
||||||
|
view.SendSimChatMessage(scene, "Diff-mode = ON");
|
||||||
|
m_state |= State.SHOWING_CHANGES;
|
||||||
|
m_state &= ~State.DIRTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Only called from within the SimChat method. Hides all auras and meta entities,
|
||||||
|
/// retrieves the current scene object list with the most recent revision retrieved from the model for each scene,
|
||||||
|
/// then lets the view update the clients of the new objects.
|
||||||
|
/// </summary>
|
||||||
|
protected void rollback(Scene scene, CMModel model, CMView view)
|
||||||
|
{
|
||||||
|
if ((m_state & State.SHOWING_CHANGES) > 0)
|
||||||
|
{
|
||||||
|
view.HideAllAuras();
|
||||||
|
view.HideAllMetaEntities();
|
||||||
|
}
|
||||||
|
|
||||||
|
System.Collections.Generic.List<Scene> proximitySceneList = ScenesInOrderOfProximity( m_sceneList, scene);
|
||||||
|
foreach(Scene currScene in proximitySceneList)
|
||||||
|
model.RollbackRegion(currScene);
|
||||||
|
|
||||||
|
if ((m_state & State.DIRTY) != 0 )
|
||||||
|
{
|
||||||
|
model.DeleteAllMetaObjects();
|
||||||
|
foreach(Scene currScene in proximitySceneList)
|
||||||
|
model.UpdateCMEntities(currScene);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_state & State.SHOWING_CHANGES) > 0)
|
||||||
|
view.DisplayRecentChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Protected Methods
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Register a new scene object to keep track of for revisioning. Starts the controller monitoring actions of clients within the given scene.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="scene">
|
||||||
|
/// A <see cref="Scene"/>
|
||||||
|
/// </param>
|
||||||
|
public void RegisterNewRegion(Scene scene)
|
||||||
|
{
|
||||||
|
m_sceneList.Add(scene.RegionInfo.RegionID, scene);
|
||||||
|
|
||||||
|
m_log.Debug("[CONTENT MANAGEMENT] Registering new region: " + scene.RegionInfo.RegionID);
|
||||||
|
m_log.Debug("[CONTENT MANAGEMENT] Initializing Content Management System.");
|
||||||
|
|
||||||
|
scene.EventManager.OnNewClient += StartManaging;
|
||||||
|
scene.EventManager.OnRemovePresence += StopManaging;
|
||||||
|
// scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
|
||||||
|
scene.EventManager.OnObjectBeingRemovedFromScene += GroupBeingDeleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Only called by the MainLoop. Takes the message from a user sent to the channel and executes the proper command.
|
||||||
|
/// </summary>
|
||||||
|
public void SimChat(CMModel model, CMView view, OSChatMessage e, int channel)
|
||||||
|
{
|
||||||
|
if (e.Channel != channel)
|
||||||
|
return;
|
||||||
|
if (e.Sender == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_log.Debug("[CONTENT MANAGEMENT] Message received: " + e.Message);
|
||||||
|
|
||||||
|
IClientAPI client = e.Sender;
|
||||||
|
Scene scene = (Scene) e.Scene;
|
||||||
|
string message = e.Message;
|
||||||
|
string[] args = e.Message.Split(new char[] {' '});
|
||||||
|
|
||||||
|
ScenePresence avatar = scene.GetScenePresence(client.AgentId);
|
||||||
|
|
||||||
|
if (!(m_estateModule.IsManager(avatar.UUID)))
|
||||||
|
{
|
||||||
|
m_log.Debug("[CONTENT MANAGEMENT] Message sent from non Estate Manager ... ignoring.");
|
||||||
|
view.SendSimChatMessage(scene, "You must be an estate manager to perform that action.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(args[0])
|
||||||
|
{
|
||||||
|
case "ci":
|
||||||
|
case "commit":
|
||||||
|
commit(message, scene, model, view);
|
||||||
|
break;
|
||||||
|
case "dm":
|
||||||
|
case "diff-mode":
|
||||||
|
diffmode(scene, model, view);
|
||||||
|
break;
|
||||||
|
case "rb":
|
||||||
|
case "rollback":
|
||||||
|
rollback(scene, model, view);
|
||||||
|
break;
|
||||||
|
case "help":
|
||||||
|
m_view.DisplayHelpMenu(scene);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
view.SendSimChatMessage(scene, "Command not found: " + args[0]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Methods
|
||||||
|
|
||||||
|
#region Other
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// Used to keep track of whether a list has been produced yet and whether that list is up-to-date compard to latest revision on disk.
|
||||||
|
/// </value>
|
||||||
|
[Flags]
|
||||||
|
private enum State
|
||||||
|
{
|
||||||
|
NONE = 0,
|
||||||
|
DIRTY = 1, // The meta entities may not correctly represent the last revision.
|
||||||
|
SHOWING_CHANGES = 1<<1 // The meta entities are being shown to user.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// The structure that defines the basic unit of work which is produced when a user sends commands to the ContentMangaementSystem.
|
||||||
|
/// </value>
|
||||||
|
private struct Work
|
||||||
|
{
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
public Object Data1; //Just space for holding data.
|
||||||
|
public Object Data2; //Just more space for holding data.
|
||||||
|
public uint LocalId; //Convenient
|
||||||
|
public WorkType Type;
|
||||||
|
public LLUUID UUID; //Convenient
|
||||||
|
|
||||||
|
#endregion Fields
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// Identifies what the data in struct Work should be used for.
|
||||||
|
/// </value>
|
||||||
|
private enum WorkType
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
|
OBJECTATTRIBUTECHANGE,
|
||||||
|
PRIMITIVEADDED,
|
||||||
|
OBJECTDUPLICATED,
|
||||||
|
OBJECTKILLED,
|
||||||
|
UNDODID,
|
||||||
|
NEWCLIENT,
|
||||||
|
SIMCHAT
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Other
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,31 +1,39 @@
|
||||||
|
#region Header
|
||||||
|
|
||||||
// CMEntityCollection.cs created with MonoDevelop
|
// CMEntityCollection.cs created with MonoDevelop
|
||||||
// User: bongiojp at 10:09 AM 7/7/2008
|
// User: bongiojp at 10:09 AM 7/7/2008
|
||||||
//
|
//
|
||||||
// Creates, Deletes, Stores ContentManagementEntities
|
// Creates, Deletes, Stores ContentManagementEntities
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#endregion Header
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
using OpenSim;
|
using OpenSim;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using log4net;
|
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
|
||||||
using Axiom.Math;
|
using Axiom.Math;
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
{
|
{
|
||||||
|
|
||||||
public class CMEntityCollection
|
public class CMEntityCollection
|
||||||
{
|
{
|
||||||
// private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
#region Fields
|
||||||
|
|
||||||
|
// private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
// Any ContentManagementEntities that represent old versions of current SceneObjectGroups or
|
// Any ContentManagementEntities that represent old versions of current SceneObjectGroups or
|
||||||
// old versions of deleted SceneObjectGroups will be stored in this hash table.
|
// old versions of deleted SceneObjectGroups will be stored in this hash table.
|
||||||
// The LLUUID keys are from the SceneObjectGroup RootPart UUIDs
|
// The LLUUID keys are from the SceneObjectGroup RootPart UUIDs
|
||||||
|
@ -35,18 +43,31 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
// The LLUUID keys are from the SceneObjectPart that they are supposed to be on.
|
// The LLUUID keys are from the SceneObjectPart that they are supposed to be on.
|
||||||
protected Hashtable m_NewlyCreatedEntityAura = Hashtable.Synchronized(new Hashtable()); //LLUUID to AuraMetaEntity
|
protected Hashtable m_NewlyCreatedEntityAura = Hashtable.Synchronized(new Hashtable()); //LLUUID to AuraMetaEntity
|
||||||
|
|
||||||
public Hashtable Entities
|
#endregion Fields
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
public CMEntityCollection()
|
||||||
{
|
{
|
||||||
get { return m_CMEntityHash; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Constructors
|
||||||
|
|
||||||
|
#region Public Properties
|
||||||
|
|
||||||
public Hashtable Auras
|
public Hashtable Auras
|
||||||
{
|
{
|
||||||
get {return m_NewlyCreatedEntityAura; }
|
get {return m_NewlyCreatedEntityAura; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public CMEntityCollection()
|
public Hashtable Entities
|
||||||
{}
|
{
|
||||||
|
get { return m_CMEntityHash; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Properties
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
public bool AddAura(ContentManagementEntity aura)
|
public bool AddAura(ContentManagementEntity aura)
|
||||||
{
|
{
|
||||||
|
@ -64,20 +85,30 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RemoveNewlyCreatedEntityAura(LLUUID uuid)
|
// Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash
|
||||||
|
public System.Collections.ArrayList CheckForMissingEntities(System.Collections.Generic.List<EntityBase> currList)
|
||||||
{
|
{
|
||||||
if (!m_NewlyCreatedEntityAura.ContainsKey(uuid))
|
System.Collections.ArrayList missingList = new System.Collections.ArrayList();
|
||||||
return false;
|
SceneObjectGroup temp = null;
|
||||||
m_NewlyCreatedEntityAura.Remove(uuid);
|
foreach( EntityBase currObj in currList )
|
||||||
return true;
|
{
|
||||||
}
|
if (! (currObj is SceneObjectGroup))
|
||||||
|
continue;
|
||||||
|
temp = (SceneObjectGroup) currObj;
|
||||||
|
|
||||||
public bool RemoveEntity(LLUUID uuid)
|
if (m_CMEntityHash.ContainsKey(temp.UUID))
|
||||||
{
|
{
|
||||||
if (!m_CMEntityHash.ContainsKey(uuid))
|
foreach(SceneObjectPart part in temp.Children.Values)
|
||||||
return false;
|
if (!((ContentManagementEntity)m_CMEntityHash[temp.UUID]).HasChildPrim(part.UUID))
|
||||||
m_CMEntityHash.Remove(uuid);
|
missingList.Add(part);
|
||||||
return true;
|
}
|
||||||
|
else //Entire group is missing from revision. (and is a new part in region)
|
||||||
|
{
|
||||||
|
foreach(SceneObjectPart part in temp.Children.Values)
|
||||||
|
missingList.Add(part);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return missingList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearAll()
|
public void ClearAll()
|
||||||
|
@ -86,8 +117,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
m_NewlyCreatedEntityAura.Clear();
|
m_NewlyCreatedEntityAura.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Old uuid and new sceneobjectgroup
|
// Old uuid and new sceneobjectgroup
|
||||||
public AuraMetaEntity CreateAuraForNewlyCreatedEntity(SceneObjectPart part)
|
public AuraMetaEntity CreateAuraForNewlyCreatedEntity(SceneObjectPart part)
|
||||||
{
|
{
|
||||||
|
@ -119,30 +148,22 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
return ent;
|
return ent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash
|
public bool RemoveEntity(LLUUID uuid)
|
||||||
public System.Collections.ArrayList CheckForMissingEntities(System.Collections.Generic.List<EntityBase> currList)
|
|
||||||
{
|
{
|
||||||
System.Collections.ArrayList missingList = new System.Collections.ArrayList();
|
if (!m_CMEntityHash.ContainsKey(uuid))
|
||||||
SceneObjectGroup temp = null;
|
return false;
|
||||||
foreach( EntityBase currObj in currList )
|
m_CMEntityHash.Remove(uuid);
|
||||||
{
|
return true;
|
||||||
if (! (currObj is SceneObjectGroup))
|
}
|
||||||
continue;
|
|
||||||
temp = (SceneObjectGroup) currObj;
|
|
||||||
|
|
||||||
if (m_CMEntityHash.ContainsKey(temp.UUID))
|
public bool RemoveNewlyCreatedEntityAura(LLUUID uuid)
|
||||||
{
|
{
|
||||||
foreach(SceneObjectPart part in temp.Children.Values)
|
if (!m_NewlyCreatedEntityAura.ContainsKey(uuid))
|
||||||
if (!((ContentManagementEntity)m_CMEntityHash[temp.UUID]).HasChildPrim(part.UUID))
|
return false;
|
||||||
missingList.Add(part);
|
m_NewlyCreatedEntityAura.Remove(uuid);
|
||||||
}
|
return true;
|
||||||
else //Entire group is missing from revision. (and is a new part in region)
|
|
||||||
{
|
|
||||||
foreach(SceneObjectPart part in temp.Children.Values)
|
|
||||||
missingList.Add(part);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return missingList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Public Methods
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,45 +1,126 @@
|
||||||
|
#region Header
|
||||||
|
|
||||||
// CMModel.cs
|
// CMModel.cs
|
||||||
// User: bongiojp
|
// User: bongiojp
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#endregion Header
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
using OpenSim;
|
using OpenSim;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using log4net;
|
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
|
||||||
using Axiom.Math;
|
using Axiom.Math;
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
{
|
{
|
||||||
|
|
||||||
public class CMModel
|
public class CMModel
|
||||||
{
|
{
|
||||||
|
#region Static Fields
|
||||||
|
|
||||||
static float TimeToUpdate = 0;
|
static float TimeToUpdate = 0;
|
||||||
static float TimeToConvertXml = 0;
|
static float TimeToConvertXml = 0;
|
||||||
|
|
||||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
IContentDatabase m_database = null;
|
#endregion Static Fields
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// The class that contains all auras and metaentities used in the CMS.
|
/// The class that contains all auras and metaentities used in the CMS.
|
||||||
/// </value>
|
/// </value>
|
||||||
CMEntityCollection m_MetaEntityCollection = new CMEntityCollection();
|
CMEntityCollection m_MetaEntityCollection = new CMEntityCollection();
|
||||||
|
IContentDatabase m_database = null;
|
||||||
|
|
||||||
|
#endregion Fields
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
public CMModel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Constructors
|
||||||
|
|
||||||
|
#region Public Properties
|
||||||
|
|
||||||
public CMEntityCollection MetaEntityCollection
|
public CMEntityCollection MetaEntityCollection
|
||||||
{
|
{
|
||||||
get { return m_MetaEntityCollection; }
|
get { return m_MetaEntityCollection; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public CMModel()
|
#endregion Public Properties
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Compares the scene's object group list to the list of meta entities. If there is an object group that does not have a corresponding meta entity
|
||||||
|
/// it is a new part that must have a green aura (for diff mode).
|
||||||
|
/// Returns list of ContentManagementEntities
|
||||||
|
/// </summary>
|
||||||
|
public ArrayList CheckForNewEntitiesMissingAuras(Scene scene)
|
||||||
{
|
{
|
||||||
|
ArrayList missingList = null;
|
||||||
|
ArrayList newList = new ArrayList();
|
||||||
|
|
||||||
|
m_log.Debug("[CONTENT MANAGEMENT] Checking for new scene object parts in scene: " + scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
|
//Check if the current scene has groups not included in the current list of MetaEntities
|
||||||
|
//If so, then the current scene's parts that are new should be marked green.
|
||||||
|
missingList = m_MetaEntityCollection.CheckForMissingEntities(scene.GetEntities());
|
||||||
|
|
||||||
|
foreach(Object missingPart in missingList)
|
||||||
|
{
|
||||||
|
if (m_MetaEntityCollection.Auras.ContainsKey(((SceneObjectPart)missingPart).UUID))
|
||||||
|
continue;
|
||||||
|
newList.Add(m_MetaEntityCollection.CreateAuraForNewlyCreatedEntity((SceneObjectPart)missingPart));
|
||||||
|
}
|
||||||
|
m_log.Info("Number of missing objects found: " + newList.Count);
|
||||||
|
return newList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Uses the database to serialize all current scene objects into xml and save into a database with an accompanying log message.
|
||||||
|
/// </summary>
|
||||||
|
public void CommitRegion(Scene scene, String logMessage)
|
||||||
|
{
|
||||||
|
m_log.Debug("[CONTENT MANAG] saving " + scene.RegionInfo.RegionName + " with log message: " + logMessage + " length of message: " + logMessage.Length);
|
||||||
|
m_database.SaveRegion(scene.RegionInfo.RegionID, scene.RegionInfo.RegionName, logMessage);
|
||||||
|
m_log.Debug("[CONTENT MANAG] the region name we are dealing with heeeeeeeere: " + scene.RegionInfo.RegionName );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteAllMetaObjects()
|
||||||
|
{
|
||||||
|
m_MetaEntityCollection.ClearAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContentManagementEntity FindMetaEntityAffectedByUndo(LLUUID uuid)
|
||||||
|
{
|
||||||
|
ContentManagementEntity ent = GetMetaGroupByPrim(uuid);
|
||||||
|
return ent;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------- HELPERS --------------------------------------------------------------------//
|
||||||
|
public ContentManagementEntity GetMetaGroupByPrim(LLUUID uuid)
|
||||||
|
{
|
||||||
|
foreach (Object ent in m_MetaEntityCollection.Entities.Values)
|
||||||
|
{
|
||||||
|
if (((ContentManagementEntity)ent).HasChildPrim(uuid))
|
||||||
|
return (ContentManagementEntity)ent;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(string database)
|
public void Initialise(string database)
|
||||||
|
@ -63,12 +144,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
m_database.PostInitialise();
|
m_database.PostInitialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContentManagementEntity FindMetaEntityAffectedByUndo(LLUUID uuid)
|
|
||||||
{
|
|
||||||
ContentManagementEntity ent = GetMetaGroupByPrim(uuid);
|
|
||||||
return ent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes the green aura when an a new scene object group is deleted.
|
/// Removes the green aura when an a new scene object group is deleted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -80,16 +155,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
m_MetaEntityCollection.RemoveNewlyCreatedEntityAura(part.UUID);
|
m_MetaEntityCollection.RemoveNewlyCreatedEntityAura(part.UUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Uses the database to serialize all current scene objects into xml and save into a database with an accompanying log message.
|
|
||||||
/// </summary>
|
|
||||||
public void CommitRegion(Scene scene, String logMessage)
|
|
||||||
{
|
|
||||||
m_log.Debug("[CONTENT MANAG] saving " + scene.RegionInfo.RegionName + " with log message: " + logMessage + " length of message: " + logMessage.Length);
|
|
||||||
m_database.SaveRegion(scene.RegionInfo.RegionID, scene.RegionInfo.RegionName, logMessage);
|
|
||||||
m_log.Debug("[CONTENT MANAG] the region name we are dealing with heeeeeeeere: " + scene.RegionInfo.RegionName );
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the latest revision of a region in xml form,
|
/// Retrieves the latest revision of a region in xml form,
|
||||||
/// converts it to scene object groups and scene presences,
|
/// converts it to scene object groups and scene presences,
|
||||||
|
@ -207,32 +272,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
scene.Backup();
|
scene.Backup();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Detects if a scene object group from the scene list has moved or changed scale. The green aura
|
|
||||||
/// that surrounds the object is then moved or scaled with the group.
|
|
||||||
/// </summary>
|
|
||||||
public System.Collections.ArrayList UpdateNormalEntityEffects(SceneObjectGroup group)
|
|
||||||
{
|
|
||||||
System.Collections.ArrayList auraList = new System.Collections.ArrayList();
|
|
||||||
if (group == null)
|
|
||||||
return null;
|
|
||||||
foreach(SceneObjectPart part in group.Children.Values)
|
|
||||||
{
|
|
||||||
if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID))
|
|
||||||
{
|
|
||||||
((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]).SetAura(new LLVector3(0,254,0), part.Scale);
|
|
||||||
((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]).RootPart.GroupPosition = part.GetWorldPosition();
|
|
||||||
auraList.Add((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return auraList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteAllMetaObjects()
|
|
||||||
{
|
|
||||||
m_MetaEntityCollection.ClearAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Downloads the latest revision of the given scene and converts the xml file to CMEntities. After this method, the view can find the differences
|
/// Downloads the latest revision of the given scene and converts the xml file to CMEntities. After this method, the view can find the differences
|
||||||
/// and display the differences to clients.
|
/// and display the differences to clients.
|
||||||
|
@ -265,45 +304,29 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
TimeToUpdate += x.ElapsedMilliseconds;
|
TimeToUpdate += x.ElapsedMilliseconds;
|
||||||
m_log.Info("[FileSystemDatabase] Time spent Updating entity list for " + scene.RegionInfo.RegionName + ": " + x.ElapsedMilliseconds);
|
m_log.Info("[FileSystemDatabase] Time spent Updating entity list for " + scene.RegionInfo.RegionName + ": " + x.ElapsedMilliseconds);
|
||||||
m_log.Info("[FileSystemDatabase] Time spent Updating so far: " + TimeToUpdate);
|
m_log.Info("[FileSystemDatabase] Time spent Updating so far: " + TimeToUpdate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the scene's object group list to the list of meta entities. If there is an object group that does not have a corresponding meta entity
|
/// Detects if a scene object group from the scene list has moved or changed scale. The green aura
|
||||||
/// it is a new part that must have a green aura (for diff mode).
|
/// that surrounds the object is then moved or scaled with the group.
|
||||||
/// Returns list of ContentManagementEntities
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ArrayList CheckForNewEntitiesMissingAuras(Scene scene)
|
public System.Collections.ArrayList UpdateNormalEntityEffects(SceneObjectGroup group)
|
||||||
{
|
{
|
||||||
ArrayList missingList = null;
|
System.Collections.ArrayList auraList = new System.Collections.ArrayList();
|
||||||
ArrayList newList = new ArrayList();
|
if (group == null)
|
||||||
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] Checking for new scene object parts in scene: " + scene.RegionInfo.RegionName);
|
|
||||||
|
|
||||||
//Check if the current scene has groups not included in the current list of MetaEntities
|
|
||||||
//If so, then the current scene's parts that are new should be marked green.
|
|
||||||
missingList = m_MetaEntityCollection.CheckForMissingEntities(scene.GetEntities());
|
|
||||||
|
|
||||||
foreach(Object missingPart in missingList)
|
|
||||||
{
|
|
||||||
if (m_MetaEntityCollection.Auras.ContainsKey(((SceneObjectPart)missingPart).UUID))
|
|
||||||
continue;
|
|
||||||
newList.Add(m_MetaEntityCollection.CreateAuraForNewlyCreatedEntity((SceneObjectPart)missingPart));
|
|
||||||
}
|
|
||||||
m_log.Info("Number of missing objects found: " + newList.Count);
|
|
||||||
return newList;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------- HELPERS --------------------------------------------------------------------//
|
|
||||||
|
|
||||||
public ContentManagementEntity GetMetaGroupByPrim(LLUUID uuid)
|
|
||||||
{
|
|
||||||
foreach (Object ent in m_MetaEntityCollection.Entities.Values)
|
|
||||||
{
|
|
||||||
if (((ContentManagementEntity)ent).HasChildPrim(uuid))
|
|
||||||
return (ContentManagementEntity)ent;
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
|
foreach(SceneObjectPart part in group.Children.Values)
|
||||||
|
{
|
||||||
|
if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID))
|
||||||
|
{
|
||||||
|
((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]).SetAura(new LLVector3(0,254,0), part.Scale);
|
||||||
|
((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]).RootPart.GroupPosition = part.GetWorldPosition();
|
||||||
|
auraList.Add((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return auraList;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Methods
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,39 +1,119 @@
|
||||||
|
#region Header
|
||||||
|
|
||||||
// CMView.cs created with MonoDevelop
|
// CMView.cs created with MonoDevelop
|
||||||
// User: bongiojp at 11:57 AM 7/3/2008
|
// User: bongiojp at 11:57 AM 7/3/2008
|
||||||
//
|
//
|
||||||
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
|
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#endregion Header
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
using OpenSim;
|
using OpenSim;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using log4net;
|
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
|
||||||
using Axiom.Math;
|
using Axiom.Math;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
{
|
{
|
||||||
|
|
||||||
public class CMView
|
public class CMView
|
||||||
{
|
{
|
||||||
|
#region Static Fields
|
||||||
|
|
||||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
#endregion Static Fields
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
|
||||||
CMModel m_model = null;
|
CMModel m_model = null;
|
||||||
|
|
||||||
public CMView()
|
#endregion Fields
|
||||||
{}
|
|
||||||
|
|
||||||
public void Initialise(CMModel model)
|
#region Constructors
|
||||||
|
|
||||||
|
public CMView()
|
||||||
{
|
{
|
||||||
m_model = model;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendMetaEntitiesToNewClient(IClientAPI client)
|
#endregion Constructors
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
|
// Auras To
|
||||||
|
public void DisplayAuras(CMEntityCollection auraCollection)
|
||||||
{
|
{
|
||||||
|
foreach( Object ent in auraCollection.Auras.Values)
|
||||||
|
((AuraMetaEntity)ent).SendFullUpdateToAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auras To Client
|
||||||
|
public void DisplayAuras(CMEntityCollection auraCollection, IClientAPI client)
|
||||||
|
{
|
||||||
|
foreach( Object ent in auraCollection.Auras.Values)
|
||||||
|
((AuraMetaEntity)ent).SendFullUpdate(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auras from List To ALL
|
||||||
|
public void DisplayAuras(ArrayList list)
|
||||||
|
{
|
||||||
|
foreach( Object ent in list)
|
||||||
|
{
|
||||||
|
m_log.Debug("[CONTENT MANAGEMENT] displaying new aura riiiiiiiiiiiight NOW");
|
||||||
|
((AuraMetaEntity)ent).SendFullUpdateToAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Entities to ALL
|
||||||
|
public void DisplayEntities(CMEntityCollection entityCollection)
|
||||||
|
{
|
||||||
|
foreach( Object ent in entityCollection.Entities.Values)
|
||||||
|
((ContentManagementEntity)ent).SendFullDiffUpdateToAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Entities to Client
|
||||||
|
public void DisplayEntities(CMEntityCollection entityCollection, IClientAPI client)
|
||||||
|
{
|
||||||
|
foreach( Object ent in entityCollection.Entities.Values)
|
||||||
|
((ContentManagementEntity)ent).SendFullDiffUpdate(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Entities from List to ALL
|
||||||
|
public void DisplayEntities(ArrayList list)
|
||||||
|
{
|
||||||
|
foreach( Object ent in list)
|
||||||
|
((ContentManagementEntity)ent).SendFullDiffUpdateToAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Entity to ALL
|
||||||
|
public void DisplayEntity(ContentManagementEntity ent)
|
||||||
|
{
|
||||||
|
ent.SendFullDiffUpdateToAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DisplayHelpMenu(Scene scene)
|
||||||
|
{
|
||||||
|
string menu = "Menu:\n";
|
||||||
|
menu += "commit (ci) - saves current state of the region to a database on the server\n";
|
||||||
|
menu += "diff-mode (dm) - displays those aspects of region that have not been saved but changed since the very last revision. Will dynamically update as you change environment.\n";
|
||||||
|
SendSimChatMessage(scene, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DisplayMetaEntity(LLUUID uuid)
|
||||||
|
{
|
||||||
|
ContentManagementEntity group = m_model.GetMetaGroupByPrim(uuid);
|
||||||
|
if (group != null)
|
||||||
|
group.SendFullDiffUpdateToAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -46,6 +126,28 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
DisplayAuras(m_model.MetaEntityCollection);
|
DisplayAuras(m_model.MetaEntityCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Hide(ContentManagementEntity ent)
|
||||||
|
{
|
||||||
|
ent.HideFromAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HideAllAuras()
|
||||||
|
{
|
||||||
|
foreach(Object obj in m_model.MetaEntityCollection.Auras.Values)
|
||||||
|
((MetaEntity)obj).HideFromAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HideAllMetaEntities()
|
||||||
|
{
|
||||||
|
foreach(Object obj in m_model.MetaEntityCollection.Entities.Values)
|
||||||
|
((ContentManagementEntity)obj).HideFromAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialise(CMModel model)
|
||||||
|
{
|
||||||
|
m_model = model;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Figures out if the part deleted was a new scene object part or a revisioned part that's been deleted.
|
/// Figures out if the part deleted was a new scene object part or a revisioned part that's been deleted.
|
||||||
/// If it's a new scene object, any green aura attached to it is deleted.
|
/// If it's a new scene object, any green aura attached to it is deleted.
|
||||||
|
@ -64,70 +166,8 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
((AuraMetaEntity)m_model.MetaEntityCollection.Auras[part.UUID]).HideFromAll();
|
((AuraMetaEntity)m_model.MetaEntityCollection.Auras[part.UUID]).HideFromAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auras To
|
public void SendMetaEntitiesToNewClient(IClientAPI client)
|
||||||
public void DisplayAuras(CMEntityCollection auraCollection)
|
|
||||||
{
|
{
|
||||||
foreach( Object ent in auraCollection.Auras.Values)
|
|
||||||
((AuraMetaEntity)ent).SendFullUpdateToAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Entities to ALL
|
|
||||||
public void DisplayEntities(CMEntityCollection entityCollection)
|
|
||||||
{
|
|
||||||
foreach( Object ent in entityCollection.Entities.Values)
|
|
||||||
((ContentManagementEntity)ent).SendFullDiffUpdateToAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Auras To Client
|
|
||||||
public void DisplayAuras(CMEntityCollection auraCollection, IClientAPI client)
|
|
||||||
{
|
|
||||||
foreach( Object ent in auraCollection.Auras.Values)
|
|
||||||
((AuraMetaEntity)ent).SendFullUpdate(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Entities to Client
|
|
||||||
public void DisplayEntities(CMEntityCollection entityCollection, IClientAPI client)
|
|
||||||
{
|
|
||||||
foreach( Object ent in entityCollection.Entities.Values)
|
|
||||||
((ContentManagementEntity)ent).SendFullDiffUpdate(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Entity to ALL
|
|
||||||
public void DisplayEntity(ContentManagementEntity ent)
|
|
||||||
{
|
|
||||||
ent.SendFullDiffUpdateToAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DisplayMetaEntity(LLUUID uuid)
|
|
||||||
{
|
|
||||||
ContentManagementEntity group = m_model.GetMetaGroupByPrim(uuid);
|
|
||||||
if (group != null)
|
|
||||||
group.SendFullDiffUpdateToAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Auras from List To ALL
|
|
||||||
public void DisplayAuras(ArrayList list)
|
|
||||||
{
|
|
||||||
foreach( Object ent in list)
|
|
||||||
{
|
|
||||||
m_log.Debug("[CONTENT MANAGEMENT] displaying new aura riiiiiiiiiiiight NOW");
|
|
||||||
((AuraMetaEntity)ent).SendFullUpdateToAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Entities from List to ALL
|
|
||||||
public void DisplayEntities(ArrayList list)
|
|
||||||
{
|
|
||||||
foreach( Object ent in list)
|
|
||||||
((ContentManagementEntity)ent).SendFullDiffUpdateToAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DisplayHelpMenu(Scene scene)
|
|
||||||
{
|
|
||||||
string menu = "Menu:\n";
|
|
||||||
menu += "commit (ci) - saves current state of the region to a database on the server\n";
|
|
||||||
menu += "diff-mode (dm) - displays those aspects of region that have not been saved but changed since the very last revision. Will dynamically update as you change environment.\n";
|
|
||||||
SendSimChatMessage(scene, menu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendSimChatMessage(Scene scene, string message)
|
public void SendSimChatMessage(Scene scene, string message)
|
||||||
|
@ -136,21 +176,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
ChatTypeEnum.Broadcast, 0, new LLVector3(0,0,0), "Content Manager", LLUUID.Zero, false);
|
ChatTypeEnum.Broadcast, 0, new LLVector3(0,0,0), "Content Manager", LLUUID.Zero, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Hide(ContentManagementEntity ent)
|
#endregion Public Methods
|
||||||
{
|
|
||||||
ent.HideFromAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HideAllMetaEntities()
|
|
||||||
{
|
|
||||||
foreach(Object obj in m_model.MetaEntityCollection.Entities.Values)
|
|
||||||
((ContentManagementEntity)obj).HideFromAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HideAllAuras()
|
|
||||||
{
|
|
||||||
foreach(Object obj in m_model.MetaEntityCollection.Auras.Values)
|
|
||||||
((MetaEntity)obj).HideFromAll();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,128 +1,108 @@
|
||||||
|
#region Header
|
||||||
|
|
||||||
// ContentManagementEntity.cs
|
// ContentManagementEntity.cs
|
||||||
// User: bongiojp
|
// User: bongiojp
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#endregion Header
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using log4net;
|
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
|
||||||
using Axiom.Math;
|
using Axiom.Math;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
{
|
{
|
||||||
public class ContentManagementEntity : MetaEntity
|
public class ContentManagementEntity : MetaEntity
|
||||||
{
|
{
|
||||||
|
#region Static Fields
|
||||||
|
|
||||||
static float TimeToDiff = 0;
|
static float TimeToDiff = 0;
|
||||||
static float TimeToCreateEntities = 0;
|
static float TimeToCreateEntities = 0;
|
||||||
|
|
||||||
|
#endregion Static Fields
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
protected Dictionary<LLUUID, AuraMetaEntity> m_AuraEntities = new Dictionary<LLUUID, AuraMetaEntity>();
|
||||||
|
protected Dictionary<LLUUID, BeamMetaEntity> m_BeamEntities = new Dictionary<LLUUID, BeamMetaEntity>();
|
||||||
|
|
||||||
// The LinkNum of parts in m_Entity and m_UnchangedEntity are the same though UUID and LocalId are different.
|
// The LinkNum of parts in m_Entity and m_UnchangedEntity are the same though UUID and LocalId are different.
|
||||||
// This can come in handy.
|
// This can come in handy.
|
||||||
protected SceneObjectGroup m_UnchangedEntity = null;
|
protected SceneObjectGroup m_UnchangedEntity = null;
|
||||||
protected Dictionary<LLUUID, BeamMetaEntity> m_BeamEntities = new Dictionary<LLUUID, BeamMetaEntity>();
|
|
||||||
protected Dictionary<LLUUID, AuraMetaEntity> m_AuraEntities = new Dictionary<LLUUID, AuraMetaEntity>();
|
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// Should be set to true when there is a difference between m_UnchangedEntity and the corresponding scene object group in the scene entity list.
|
/// Should be set to true when there is a difference between m_UnchangedEntity and the corresponding scene object group in the scene entity list.
|
||||||
/// </value>
|
/// </value>
|
||||||
bool DiffersFromSceneGroup = false;
|
bool DiffersFromSceneGroup = false;
|
||||||
|
|
||||||
|
#endregion Fields
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
public ContentManagementEntity(SceneObjectGroup Unchanged, bool physics)
|
||||||
|
: base(Unchanged, false)
|
||||||
|
{
|
||||||
|
m_UnchangedEntity = Unchanged.Copy(Unchanged.RootPart.OwnerID, Unchanged.RootPart.GroupID, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContentManagementEntity(string objectXML, Scene scene, bool physics)
|
||||||
|
: base(objectXML, scene, false)
|
||||||
|
{
|
||||||
|
m_UnchangedEntity = new SceneObjectGroup(objectXML);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Constructors
|
||||||
|
|
||||||
|
#region Public Properties
|
||||||
|
|
||||||
public SceneObjectGroup UnchangedEntity
|
public SceneObjectGroup UnchangedEntity
|
||||||
{
|
{
|
||||||
get { return m_UnchangedEntity; }
|
get { return m_UnchangedEntity; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContentManagementEntity(SceneObjectGroup Unchanged, bool physics) : base(Unchanged, false)
|
#endregion Public Properties
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if an entitybase list (like that returned by scene.GetEntities() ) contains a group with the rootpart uuid that matches the current uuid.
|
||||||
|
/// </summary>
|
||||||
|
private bool ContainsKey(List<EntityBase> list, LLUUID uuid)
|
||||||
{
|
{
|
||||||
m_UnchangedEntity = Unchanged.Copy(Unchanged.RootPart.OwnerID, Unchanged.RootPart.GroupID, false);
|
foreach( EntityBase part in list)
|
||||||
|
if (part.UUID == uuid)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContentManagementEntity(string objectXML, Scene scene, bool physics) : base(objectXML, scene, false)
|
private SceneObjectGroup GetGroupByUUID(System.Collections.Generic.List<EntityBase> list, LLUUID uuid)
|
||||||
{
|
{
|
||||||
m_UnchangedEntity = new SceneObjectGroup(objectXML);
|
foreach (EntityBase ent in list)
|
||||||
|
{
|
||||||
|
if (ent is SceneObjectGroup)
|
||||||
|
if (ent.UUID == uuid)
|
||||||
|
return (SceneObjectGroup)ent;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Hide(IClientAPI client)
|
#endregion Private Methods
|
||||||
{
|
|
||||||
base.Hide(client);
|
|
||||||
foreach(MetaEntity group in m_AuraEntities.Values)
|
|
||||||
group.Hide(client);
|
|
||||||
foreach(MetaEntity group in m_BeamEntities.Values)
|
|
||||||
group.Hide(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void HideFromAll()
|
#region Public Methods
|
||||||
{
|
|
||||||
base.HideFromAll();
|
|
||||||
foreach(MetaEntity group in m_AuraEntities.Values)
|
|
||||||
group.HideFromAll();
|
|
||||||
foreach(MetaEntity group in m_BeamEntities.Values)
|
|
||||||
group.HideFromAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendFullDiffUpdateToAll()
|
|
||||||
{
|
|
||||||
FindDifferences();
|
|
||||||
if (DiffersFromSceneGroup)
|
|
||||||
{
|
|
||||||
SendFullUpdateToAll();
|
|
||||||
SendFullAuraUpdateToAll();
|
|
||||||
SendFullBeamUpdateToAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendFullDiffUpdate(IClientAPI client)
|
|
||||||
{
|
|
||||||
FindDifferences();
|
|
||||||
if (DiffersFromSceneGroup)
|
|
||||||
{
|
|
||||||
SendFullUpdate(client);
|
|
||||||
SendFullAuraUpdate(client);
|
|
||||||
SendFullBeamUpdate(client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendFullBeamUpdate(IClientAPI client)
|
|
||||||
{
|
|
||||||
if (DiffersFromSceneGroup)
|
|
||||||
{
|
|
||||||
foreach(BeamMetaEntity group in m_BeamEntities.Values)
|
|
||||||
group.SendFullUpdate(client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendFullAuraUpdate(IClientAPI client)
|
|
||||||
{
|
|
||||||
if (DiffersFromSceneGroup)
|
|
||||||
{
|
|
||||||
foreach(AuraMetaEntity group in m_AuraEntities.Values)
|
|
||||||
group.SendFullUpdate(client);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendFullBeamUpdateToAll()
|
|
||||||
{
|
|
||||||
if (DiffersFromSceneGroup)
|
|
||||||
{
|
|
||||||
foreach(BeamMetaEntity group in m_BeamEntities.Values)
|
|
||||||
group.SendFullUpdateToAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendFullAuraUpdateToAll()
|
|
||||||
{
|
|
||||||
if (DiffersFromSceneGroup)
|
|
||||||
{
|
|
||||||
foreach(AuraMetaEntity group in m_AuraEntities.Values)
|
|
||||||
group.SendFullUpdateToAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Search for a corresponding group UUID in the scene. If not found, then the revisioned group this CMEntity represents has been deleted. Mark the metaentity appropriately.
|
/// Search for a corresponding group UUID in the scene. If not found, then the revisioned group this CMEntity represents has been deleted. Mark the metaentity appropriately.
|
||||||
|
@ -179,6 +159,45 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if the revisioned scene object group that this CMEntity is based off of contains a child with the given UUID.
|
||||||
|
/// </summary>
|
||||||
|
public bool HasChildPrim(LLUUID uuid)
|
||||||
|
{
|
||||||
|
if (m_UnchangedEntity.Children.ContainsKey(uuid))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if the revisioned scene object group that this CMEntity is based off of contains a child with the given LocalId.
|
||||||
|
/// </summary>
|
||||||
|
public bool HasChildPrim(uint localID)
|
||||||
|
{
|
||||||
|
foreach( SceneObjectPart part in m_UnchangedEntity.Children.Values)
|
||||||
|
if ( part.LocalId == localID )
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Hide(IClientAPI client)
|
||||||
|
{
|
||||||
|
base.Hide(client);
|
||||||
|
foreach(MetaEntity group in m_AuraEntities.Values)
|
||||||
|
group.Hide(client);
|
||||||
|
foreach(MetaEntity group in m_BeamEntities.Values)
|
||||||
|
group.Hide(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void HideFromAll()
|
||||||
|
{
|
||||||
|
base.HideFromAll();
|
||||||
|
foreach(MetaEntity group in m_AuraEntities.Values)
|
||||||
|
group.HideFromAll();
|
||||||
|
foreach(MetaEntity group in m_BeamEntities.Values)
|
||||||
|
group.HideFromAll();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if there was a change between meta entity and the entity group, false otherwise.
|
/// Returns true if there was a change between meta entity and the entity group, false otherwise.
|
||||||
/// If true is returned, it is assumed the metaentity's appearance has changed to reflect the difference (though clients haven't been updated).
|
/// If true is returned, it is assumed the metaentity's appearance has changed to reflect the difference (though clients haven't been updated).
|
||||||
|
@ -280,47 +299,64 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SceneObjectGroup GetGroupByUUID(System.Collections.Generic.List<EntityBase> list, LLUUID uuid)
|
public void SendFullAuraUpdate(IClientAPI client)
|
||||||
{
|
{
|
||||||
foreach (EntityBase ent in list)
|
if (DiffersFromSceneGroup)
|
||||||
{
|
{
|
||||||
if (ent is SceneObjectGroup)
|
foreach(AuraMetaEntity group in m_AuraEntities.Values)
|
||||||
if (ent.UUID == uuid)
|
group.SendFullUpdate(client);
|
||||||
return (SceneObjectGroup)ent;
|
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public void SendFullAuraUpdateToAll()
|
||||||
/// Check if the revisioned scene object group that this CMEntity is based off of contains a child with the given UUID.
|
|
||||||
/// </summary>
|
|
||||||
public bool HasChildPrim(LLUUID uuid)
|
|
||||||
{
|
{
|
||||||
if (m_UnchangedEntity.Children.ContainsKey(uuid))
|
if (DiffersFromSceneGroup)
|
||||||
return true;
|
{
|
||||||
return false;
|
foreach(AuraMetaEntity group in m_AuraEntities.Values)
|
||||||
|
group.SendFullUpdateToAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public void SendFullBeamUpdate(IClientAPI client)
|
||||||
/// Check if the revisioned scene object group that this CMEntity is based off of contains a child with the given LocalId.
|
|
||||||
/// </summary>
|
|
||||||
public bool HasChildPrim(uint localID)
|
|
||||||
{
|
{
|
||||||
foreach( SceneObjectPart part in m_UnchangedEntity.Children.Values)
|
if (DiffersFromSceneGroup)
|
||||||
if ( part.LocalId == localID )
|
{
|
||||||
return true;
|
foreach(BeamMetaEntity group in m_BeamEntities.Values)
|
||||||
return false;
|
group.SendFullUpdate(client);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public void SendFullBeamUpdateToAll()
|
||||||
/// Check if an entitybase list (like that returned by scene.GetEntities() ) contains a group with the rootpart uuid that matches the current uuid.
|
|
||||||
/// </summary>
|
|
||||||
private bool ContainsKey(List<EntityBase> list, LLUUID uuid)
|
|
||||||
{
|
{
|
||||||
foreach( EntityBase part in list)
|
if (DiffersFromSceneGroup)
|
||||||
if (part.UUID == uuid)
|
{
|
||||||
return true;
|
foreach(BeamMetaEntity group in m_BeamEntities.Values)
|
||||||
return false;
|
group.SendFullUpdateToAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendFullDiffUpdate(IClientAPI client)
|
||||||
|
{
|
||||||
|
FindDifferences();
|
||||||
|
if (DiffersFromSceneGroup)
|
||||||
|
{
|
||||||
|
SendFullUpdate(client);
|
||||||
|
SendFullAuraUpdate(client);
|
||||||
|
SendFullBeamUpdate(client);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendFullDiffUpdateToAll()
|
||||||
|
{
|
||||||
|
FindDifferences();
|
||||||
|
if (DiffersFromSceneGroup)
|
||||||
|
{
|
||||||
|
SendFullUpdateToAll();
|
||||||
|
SendFullAuraUpdateToAll();
|
||||||
|
SendFullBeamUpdateToAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Methods
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,30 +1,68 @@
|
||||||
|
#region Header
|
||||||
|
|
||||||
// ContentManagementModule.cs
|
// ContentManagementModule.cs
|
||||||
// User: bongiojp
|
// User: bongiojp
|
||||||
|
|
||||||
|
#endregion Header
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
using OpenSim;
|
using OpenSim;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using log4net;
|
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
|
||||||
using Axiom.Math;
|
using Axiom.Math;
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
{
|
{
|
||||||
public class ContentManagementModule : IRegionModule
|
public class ContentManagementModule : IRegionModule
|
||||||
{
|
{
|
||||||
|
#region Static Fields
|
||||||
|
|
||||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
CMController m_control = null;
|
|
||||||
CMModel m_model = null;
|
#endregion Static Fields
|
||||||
CMView m_view = null;
|
|
||||||
|
#region Fields
|
||||||
|
|
||||||
bool initialised = false;
|
bool initialised = false;
|
||||||
bool m_posted = false;
|
CMController m_control = null;
|
||||||
bool m_enabled = false;
|
bool m_enabled = false;
|
||||||
|
CMModel m_model = null;
|
||||||
|
bool m_posted = false;
|
||||||
|
CMView m_view = null;
|
||||||
|
|
||||||
|
#endregion Fields
|
||||||
|
|
||||||
|
#region Public Properties
|
||||||
|
|
||||||
|
public bool IsSharedModule
|
||||||
|
{
|
||||||
|
get { return true; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "ContentManagementModule"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Properties
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource source)
|
public void Initialise(Scene scene, IConfigSource source)
|
||||||
{
|
{
|
||||||
|
@ -95,17 +133,6 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
#endregion Public Methods
|
||||||
{}
|
|
||||||
|
|
||||||
public string Name
|
|
||||||
{
|
|
||||||
get { return "ContentManagementModule"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsSharedModule
|
|
||||||
{
|
|
||||||
get { return true; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,71 +1,62 @@
|
||||||
|
#region Header
|
||||||
|
|
||||||
// FileSystemDatabase.cs
|
// FileSystemDatabase.cs
|
||||||
// User: bongiojp
|
// User: bongiojp
|
||||||
|
|
||||||
|
#endregion Header
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Slash = System.IO.Path;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Modules.World.Serialiser;
|
using OpenSim.Region.Environment.Modules.World.Serialiser;
|
||||||
using OpenSim.Region.Environment.Modules.World.Terrain;
|
using OpenSim.Region.Environment.Modules.World.Terrain;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using log4net;
|
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
|
||||||
using Axiom.Math;
|
using Axiom.Math;
|
||||||
using Slash=System.IO.Path;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
{
|
{
|
||||||
public class FileSystemDatabase : IContentDatabase
|
public class FileSystemDatabase : IContentDatabase
|
||||||
{
|
{
|
||||||
|
#region Static Fields
|
||||||
|
|
||||||
public static float TimeToDownload = 0;
|
public static float TimeToDownload = 0;
|
||||||
public static float TimeToSave = 0;
|
public static float TimeToSave = 0;
|
||||||
|
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
#endregion Static Fields
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
|
||||||
private string m_repodir = null;
|
private string m_repodir = null;
|
||||||
private Dictionary<LLUUID, IRegionSerialiser> m_serialiser = new Dictionary<LLUUID, IRegionSerialiser>();
|
|
||||||
private Dictionary<LLUUID, Scene> m_scenes = new Dictionary<LLUUID, Scene>();
|
private Dictionary<LLUUID, Scene> m_scenes = new Dictionary<LLUUID, Scene>();
|
||||||
|
private Dictionary<LLUUID, IRegionSerialiser> m_serialiser = new Dictionary<LLUUID, IRegionSerialiser>();
|
||||||
|
|
||||||
|
#endregion Fields
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
public FileSystemDatabase()
|
public FileSystemDatabase()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(Scene scene, string dir)
|
#endregion Constructors
|
||||||
{
|
|
||||||
lock(this)
|
|
||||||
{
|
|
||||||
if (m_repodir == null)
|
|
||||||
m_repodir = dir;
|
|
||||||
}
|
|
||||||
lock(m_scenes)
|
|
||||||
m_scenes.Add(scene.RegionInfo.RegionID, scene);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
// Run once and only once.
|
|
||||||
public void PostInitialise()
|
|
||||||
{
|
|
||||||
SetupSerialiser();
|
|
||||||
|
|
||||||
m_log.Info("[FSDB]: Creating repository in " + m_repodir + ".");
|
|
||||||
CreateDirectory();
|
|
||||||
}
|
|
||||||
|
|
||||||
// called by postinitialise
|
|
||||||
private void SetupSerialiser()
|
|
||||||
{
|
|
||||||
if (m_serialiser.Count == 0)
|
|
||||||
foreach(LLUUID region in m_scenes.Keys)
|
|
||||||
m_serialiser.Add(region,
|
|
||||||
m_scenes[region].RequestModuleInterface<IRegionSerialiser>()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// called by postinitialise
|
// called by postinitialise
|
||||||
private void CreateDirectory()
|
private void CreateDirectory()
|
||||||
|
@ -82,65 +73,47 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int NumOfRegionRev(LLUUID regionid)
|
// called by postinitialise
|
||||||
|
private void SetupSerialiser()
|
||||||
{
|
{
|
||||||
string scenedir = m_repodir + Slash.DirectorySeparatorChar + regionid + Slash.DirectorySeparatorChar;
|
if (m_serialiser.Count == 0)
|
||||||
m_log.Info("[FSDB]: Reading scene dir: " + scenedir);
|
foreach(LLUUID region in m_scenes.Keys)
|
||||||
string[] directories = Directory.GetDirectories(scenedir);
|
m_serialiser.Add(region,
|
||||||
return directories.Length;
|
m_scenes[region].RequestModuleInterface<IRegionSerialiser>()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Private Methods
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
public int GetMostRecentRevision(LLUUID regionid)
|
public int GetMostRecentRevision(LLUUID regionid)
|
||||||
{
|
{
|
||||||
return NumOfRegionRev(regionid);
|
return NumOfRegionRev(regionid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveRegion(LLUUID regionid, string regionName, string logMessage)
|
public string GetRegionObjectHeightMap(LLUUID regionid)
|
||||||
{
|
{
|
||||||
m_log.Info("[FSDB]: ...............................");
|
String filename = m_repodir + Slash.DirectorySeparatorChar + regionid +
|
||||||
string scenedir = m_repodir + Slash.DirectorySeparatorChar + regionid + Slash.DirectorySeparatorChar;
|
Slash.DirectorySeparatorChar + "heightmap.r32";
|
||||||
|
FileStream fs = new FileStream( filename, FileMode.Open);
|
||||||
|
StreamReader sr = new StreamReader(fs);
|
||||||
|
String result = sr.ReadToEnd();
|
||||||
|
sr.Close();
|
||||||
|
fs.Close();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
m_log.Info("[FSDB]: checking if scene directory exists: " + scenedir);
|
public string GetRegionObjectHeightMap(LLUUID regionid, int revision)
|
||||||
if (!Directory.Exists(scenedir))
|
|
||||||
Directory.CreateDirectory(scenedir);
|
|
||||||
|
|
||||||
int newRevisionNum = GetMostRecentRevision(regionid)+1;
|
|
||||||
string revisiondir = scenedir + newRevisionNum + Slash.DirectorySeparatorChar;
|
|
||||||
|
|
||||||
m_log.Info("[FSDB]: checking if revision directory exists: " + revisiondir);
|
|
||||||
if (!Directory.Exists(revisiondir))
|
|
||||||
Directory.CreateDirectory(revisiondir);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Stopwatch x = new Stopwatch();
|
|
||||||
x.Start();
|
|
||||||
if (m_scenes.ContainsKey(regionid))
|
|
||||||
{
|
{
|
||||||
m_serialiser[regionid].SerialiseRegion(m_scenes[regionid], revisiondir);
|
String filename = m_repodir + Slash.DirectorySeparatorChar + regionid +
|
||||||
}
|
Slash.DirectorySeparatorChar + "heightmap.r32";
|
||||||
x.Stop();
|
FileStream fs = new FileStream( filename, FileMode.Open);
|
||||||
TimeToSave += x.ElapsedMilliseconds;
|
StreamReader sr = new StreamReader(fs);
|
||||||
m_log.Info("[FileSystemDatabase] Time spent serialising regions to files on disk for " + regionName + ": " + x.ElapsedMilliseconds);
|
String result = sr.ReadToEnd();
|
||||||
m_log.Info("[FileSystemDatabase] Time spent serialising regions to files on disk so far: " + TimeToSave);
|
sr.Close();
|
||||||
}
|
fs.Close();
|
||||||
catch (Exception e)
|
return result;
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[FSDB]: Serialisation of region failed: " + e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Finish by writing log message.
|
|
||||||
FileStream file = new FileStream(revisiondir + "log", FileMode.Create, FileAccess.ReadWrite);
|
|
||||||
StreamWriter sw = new StreamWriter(file);
|
|
||||||
sw.Write(logMessage);
|
|
||||||
sw.Close();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[FSDB]: Failed trying to save log file " + e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public System.Collections.ArrayList GetRegionObjectXMLList(LLUUID regionid, int revision)
|
public System.Collections.ArrayList GetRegionObjectXMLList(LLUUID regionid, int revision)
|
||||||
|
@ -204,28 +177,15 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetRegionObjectHeightMap(LLUUID regionid)
|
public void Initialise(Scene scene, string dir)
|
||||||
{
|
{
|
||||||
String filename = m_repodir + Slash.DirectorySeparatorChar + regionid +
|
lock(this)
|
||||||
Slash.DirectorySeparatorChar + "heightmap.r32";
|
{
|
||||||
FileStream fs = new FileStream( filename, FileMode.Open);
|
if (m_repodir == null)
|
||||||
StreamReader sr = new StreamReader(fs);
|
m_repodir = dir;
|
||||||
String result = sr.ReadToEnd();
|
|
||||||
sr.Close();
|
|
||||||
fs.Close();
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
lock(m_scenes)
|
||||||
public string GetRegionObjectHeightMap(LLUUID regionid, int revision)
|
m_scenes.Add(scene.RegionInfo.RegionID, scene);
|
||||||
{
|
|
||||||
String filename = m_repodir + Slash.DirectorySeparatorChar + regionid +
|
|
||||||
Slash.DirectorySeparatorChar + "heightmap.r32";
|
|
||||||
FileStream fs = new FileStream( filename, FileMode.Open);
|
|
||||||
StreamReader sr = new StreamReader(fs);
|
|
||||||
String result = sr.ReadToEnd();
|
|
||||||
sr.Close();
|
|
||||||
fs.Close();
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public System.Collections.Generic.SortedDictionary<string, string> ListOfRegionRevisions(LLUUID regionid)
|
public System.Collections.Generic.SortedDictionary<string, string> ListOfRegionRevisions(LLUUID regionid)
|
||||||
|
@ -256,5 +216,72 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
|
|
||||||
return revisionDict;
|
return revisionDict;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int NumOfRegionRev(LLUUID regionid)
|
||||||
|
{
|
||||||
|
string scenedir = m_repodir + Slash.DirectorySeparatorChar + regionid + Slash.DirectorySeparatorChar;
|
||||||
|
m_log.Info("[FSDB]: Reading scene dir: " + scenedir);
|
||||||
|
string[] directories = Directory.GetDirectories(scenedir);
|
||||||
|
return directories.Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run once and only once.
|
||||||
|
public void PostInitialise()
|
||||||
|
{
|
||||||
|
SetupSerialiser();
|
||||||
|
|
||||||
|
m_log.Info("[FSDB]: Creating repository in " + m_repodir + ".");
|
||||||
|
CreateDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveRegion(LLUUID regionid, string regionName, string logMessage)
|
||||||
|
{
|
||||||
|
m_log.Info("[FSDB]: ...............................");
|
||||||
|
string scenedir = m_repodir + Slash.DirectorySeparatorChar + regionid + Slash.DirectorySeparatorChar;
|
||||||
|
|
||||||
|
m_log.Info("[FSDB]: checking if scene directory exists: " + scenedir);
|
||||||
|
if (!Directory.Exists(scenedir))
|
||||||
|
Directory.CreateDirectory(scenedir);
|
||||||
|
|
||||||
|
int newRevisionNum = GetMostRecentRevision(regionid)+1;
|
||||||
|
string revisiondir = scenedir + newRevisionNum + Slash.DirectorySeparatorChar;
|
||||||
|
|
||||||
|
m_log.Info("[FSDB]: checking if revision directory exists: " + revisiondir);
|
||||||
|
if (!Directory.Exists(revisiondir))
|
||||||
|
Directory.CreateDirectory(revisiondir);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Stopwatch x = new Stopwatch();
|
||||||
|
x.Start();
|
||||||
|
if (m_scenes.ContainsKey(regionid))
|
||||||
|
{
|
||||||
|
m_serialiser[regionid].SerialiseRegion(m_scenes[regionid], revisiondir);
|
||||||
|
}
|
||||||
|
x.Stop();
|
||||||
|
TimeToSave += x.ElapsedMilliseconds;
|
||||||
|
m_log.Info("[FileSystemDatabase] Time spent serialising regions to files on disk for " + regionName + ": " + x.ElapsedMilliseconds);
|
||||||
|
m_log.Info("[FileSystemDatabase] Time spent serialising regions to files on disk so far: " + TimeToSave);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[FSDB]: Serialisation of region failed: " + e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Finish by writing log message.
|
||||||
|
FileStream file = new FileStream(revisiondir + "log", FileMode.Create, FileAccess.ReadWrite);
|
||||||
|
StreamWriter sw = new StreamWriter(file);
|
||||||
|
sw.Write(logMessage);
|
||||||
|
sw.Close();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[FSDB]: Failed trying to save log file " + e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Methods
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,84 +1,67 @@
|
||||||
|
#region Header
|
||||||
|
|
||||||
// GitDatabase.cs
|
// GitDatabase.cs
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#endregion Header
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Slash = System.IO.Path;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Modules.World.Serialiser;
|
using OpenSim.Region.Environment.Modules.World.Serialiser;
|
||||||
using OpenSim.Region.Environment.Modules.World.Terrain;
|
using OpenSim.Region.Environment.Modules.World.Terrain;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using log4net;
|
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
|
||||||
using Axiom.Math;
|
using Axiom.Math;
|
||||||
using Slash=System.IO.Path;
|
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Just a stub :-(
|
/// Just a stub :-(
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GitDatabase : IContentDatabase
|
public class GitDatabase : IContentDatabase
|
||||||
{
|
{
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
public GitDatabase()
|
public GitDatabase()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(Scene scene, String dir)
|
#endregion Constructors
|
||||||
{
|
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
|
public SceneObjectGroup GetMostRecentObjectRevision(LLUUID id)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public int GetMostRecentRevision(LLUUID regionid)
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public int NumOfObjectRev(LLUUID id)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int NumOfRegionRev(LLUUID regionid)
|
public SceneObjectGroup GetObjectRevision(LLUUID id, int revision)
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool InRepository(LLUUID id)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveRegion(LLUUID regionid, string regionName, string logMessage)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public System.Collections.ArrayList GetRegionObjectXMLList(LLUUID regionid)
|
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public System.Collections.ArrayList GetRegionObjectXMLList(LLUUID regionid, int revision)
|
public System.Collections.ArrayList GetObjectsFromRegion(LLUUID regionid, int revision)
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetRegionObjectXML(LLUUID regionid)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetRegionObjectXML(LLUUID regionid, int revision)
|
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +76,36 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public System.Collections.ArrayList GetObjectsFromRegion(LLUUID regionid, int revision)
|
public string GetRegionObjectXML(LLUUID regionid)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetRegionObjectXML(LLUUID regionid, int revision)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public System.Collections.ArrayList GetRegionObjectXMLList(LLUUID regionid)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public System.Collections.ArrayList GetRegionObjectXMLList(LLUUID regionid, int revision)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool InRepository(LLUUID id)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialise(Scene scene, String dir)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public System.Collections.Generic.SortedDictionary<string, string> ListOfObjectRevisions(LLUUID id)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -103,28 +115,28 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int NumOfObjectRev(LLUUID id)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int NumOfRegionRev(LLUUID regionid)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PostInitialise()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void SaveObject(SceneObjectGroup entity)
|
public void SaveObject(SceneObjectGroup entity)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public SceneObjectGroup GetMostRecentObjectRevision(LLUUID id)
|
public void SaveRegion(LLUUID regionid, string regionName, string logMessage)
|
||||||
{
|
{
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SceneObjectGroup GetObjectRevision(LLUUID id, int revision)
|
#endregion Public Methods
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public System.Collections.Generic.SortedDictionary<string, string> ListOfObjectRevisions(LLUUID id)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetMostRecentRevision(LLUUID regionid)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,18 +1,43 @@
|
||||||
|
#region Header
|
||||||
|
|
||||||
// IContentDatabase.cs
|
// IContentDatabase.cs
|
||||||
// User: bongiojp
|
// User: bongiojp
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#endregion Header
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
{
|
{
|
||||||
public interface IContentDatabase
|
public interface IContentDatabase
|
||||||
{
|
{
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the most recent revision number of a region.
|
||||||
|
/// </summary>
|
||||||
|
int GetMostRecentRevision(LLUUID regionid);
|
||||||
|
|
||||||
|
string GetRegionObjectHeightMap(LLUUID regionid);
|
||||||
|
|
||||||
|
string GetRegionObjectHeightMap(LLUUID regionid, int revision);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the xml that describes each individual object from the last revision or specific revision of the given region.
|
||||||
|
/// </summary>
|
||||||
|
System.Collections.ArrayList GetRegionObjectXMLList(LLUUID regionid);
|
||||||
|
|
||||||
|
System.Collections.ArrayList GetRegionObjectXMLList(LLUUID regionid, int revision);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Similar to the IRegionModule function. This is the function to be called before attempting to interface with the database.
|
/// Similar to the IRegionModule function. This is the function to be called before attempting to interface with the database.
|
||||||
/// Initialise should be called one for each region to be contained in the database. The directory should be the full path
|
/// Initialise should be called one for each region to be contained in the database. The directory should be the full path
|
||||||
|
@ -21,37 +46,25 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
void Initialise(Scene scene, String dir);
|
void Initialise(Scene scene, String dir);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Should be called once after Initialise has been called.
|
/// Returns a list of the revision numbers and corresponding log messages for a given region.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void PostInitialise();
|
System.Collections.Generic.SortedDictionary<string, string> ListOfRegionRevisions(LLUUID id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the total number of revisions saved for a specific region.
|
/// Returns the total number of revisions saved for a specific region.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int NumOfRegionRev(LLUUID regionid);
|
int NumOfRegionRev(LLUUID regionid);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Should be called once after Initialise has been called.
|
||||||
|
/// </summary>
|
||||||
|
void PostInitialise();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves the Region terrain map and objects within the region as xml to the database.
|
/// Saves the Region terrain map and objects within the region as xml to the database.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void SaveRegion(LLUUID regionid, string regionName, string logMessage);
|
void SaveRegion(LLUUID regionid, string regionName, string logMessage);
|
||||||
|
|
||||||
/// <summary>
|
#endregion Methods
|
||||||
/// Retrieves the xml that describes each individual object from the last revision or specific revision of the given region.
|
|
||||||
/// </summary>
|
|
||||||
System.Collections.ArrayList GetRegionObjectXMLList(LLUUID regionid);
|
|
||||||
System.Collections.ArrayList GetRegionObjectXMLList(LLUUID regionid, int revision);
|
|
||||||
|
|
||||||
string GetRegionObjectHeightMap(LLUUID regionid);
|
|
||||||
string GetRegionObjectHeightMap(LLUUID regionid, int revision);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a list of the revision numbers and corresponding log messages for a given region.
|
|
||||||
/// </summary>
|
|
||||||
System.Collections.Generic.SortedDictionary<string, string> ListOfRegionRevisions(LLUUID id);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the most recent revision number of a region.
|
|
||||||
/// </summary>
|
|
||||||
int GetMostRecentRevision(LLUUID regionid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,74 +1,58 @@
|
||||||
|
#region Header
|
||||||
|
|
||||||
// MetaEntity.cs
|
// MetaEntity.cs
|
||||||
// User: bongiojp
|
// User: bongiojp
|
||||||
//
|
//
|
||||||
// TODO:
|
// TODO:
|
||||||
// Create a physics manager to the meta object if there isn't one or the object knows of no scene but the user wants physics enabled.
|
// Create a physics manager to the meta object if there isn't one or the object knows of no scene but the user wants physics enabled.
|
||||||
|
|
||||||
|
#endregion Header
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using log4net;
|
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
|
||||||
using Axiom.Math;
|
using Axiom.Math;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
{
|
{
|
||||||
public class MetaEntity
|
public class MetaEntity
|
||||||
{
|
{
|
||||||
protected static readonly ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
#region Constants
|
||||||
|
|
||||||
protected SceneObjectGroup m_Entity = null; // The scene object group that represents this meta entity.
|
public const float INVISIBLE = .95f;
|
||||||
protected uint m_metaLocalid;
|
|
||||||
|
|
||||||
// Settings for transparency of metaentity
|
// Settings for transparency of metaentity
|
||||||
public const float NONE = 0f;
|
public const float NONE = 0f;
|
||||||
public const float TRANSLUCENT = .5f;
|
public const float TRANSLUCENT = .5f;
|
||||||
public const float INVISIBLE = .95f;
|
|
||||||
|
|
||||||
public Scene Scene
|
#endregion Constants
|
||||||
{
|
|
||||||
get { return m_Entity.Scene; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public SceneObjectPart RootPart
|
#region Static Fields
|
||||||
{
|
|
||||||
get { return m_Entity.RootPart; }
|
|
||||||
set { m_Entity.RootPart = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public LLUUID UUID
|
protected static readonly ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
{
|
|
||||||
get { return m_Entity.UUID; }
|
|
||||||
set { m_Entity.UUID = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public uint LocalId
|
#endregion Static Fields
|
||||||
{
|
|
||||||
get { return m_Entity.LocalId; }
|
|
||||||
set { m_Entity.LocalId = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public SceneObjectGroup ObjectGroup
|
#region Fields
|
||||||
{
|
|
||||||
get { return m_Entity; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dictionary<LLUUID, SceneObjectPart> Children
|
protected SceneObjectGroup m_Entity = null; // The scene object group that represents this meta entity.
|
||||||
{
|
protected uint m_metaLocalid;
|
||||||
get { return m_Entity.Children; }
|
|
||||||
set { m_Entity.Children = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int PrimCount
|
#endregion Fields
|
||||||
{
|
|
||||||
get { return m_Entity.PrimCount; }
|
#region Constructors
|
||||||
}
|
|
||||||
|
|
||||||
public MetaEntity()
|
public MetaEntity()
|
||||||
{
|
{
|
||||||
|
@ -94,6 +78,53 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
Initialize(physics);
|
Initialize(physics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Constructors
|
||||||
|
|
||||||
|
#region Public Properties
|
||||||
|
|
||||||
|
public Dictionary<LLUUID, SceneObjectPart> Children
|
||||||
|
{
|
||||||
|
get { return m_Entity.Children; }
|
||||||
|
set { m_Entity.Children = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint LocalId
|
||||||
|
{
|
||||||
|
get { return m_Entity.LocalId; }
|
||||||
|
set { m_Entity.LocalId = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public SceneObjectGroup ObjectGroup
|
||||||
|
{
|
||||||
|
get { return m_Entity; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int PrimCount
|
||||||
|
{
|
||||||
|
get { return m_Entity.PrimCount; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public SceneObjectPart RootPart
|
||||||
|
{
|
||||||
|
get { return m_Entity.RootPart; }
|
||||||
|
set { m_Entity.RootPart = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Scene Scene
|
||||||
|
{
|
||||||
|
get { return m_Entity.Scene; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public LLUUID UUID
|
||||||
|
{
|
||||||
|
get { return m_Entity.UUID; }
|
||||||
|
set { m_Entity.UUID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Public Properties
|
||||||
|
|
||||||
|
#region Protected Methods
|
||||||
|
|
||||||
// The metaentity objectgroup must have unique localids as well as unique uuids.
|
// The metaentity objectgroup must have unique localids as well as unique uuids.
|
||||||
// localids are used by the client to refer to parts.
|
// localids are used by the client to refer to parts.
|
||||||
// uuids are sent to the client and back to the server to identify parts on the server side.
|
// uuids are sent to the client and back to the server to identify parts on the server side.
|
||||||
|
@ -118,26 +149,11 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
m_Entity.UpdateParentIDs();
|
m_Entity.UpdateParentIDs();
|
||||||
m_Entity.RootPart.PhysActor = null;
|
m_Entity.RootPart.PhysActor = null;
|
||||||
m_Entity.Children = parts;
|
m_Entity.Children = parts;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendFullUpdate(IClientAPI client)
|
#endregion Protected Methods
|
||||||
{
|
|
||||||
// Not sure what clientFlags should be but 0 seems to work
|
|
||||||
SendFullUpdate(client, 0);
|
|
||||||
}
|
|
||||||
public void SendFullUpdateToAll()
|
|
||||||
{
|
|
||||||
uint clientFlags = 0;
|
|
||||||
m_Entity.Scene.ClientManager.ForEachClient(delegate(IClientAPI controller)
|
|
||||||
{ m_Entity.SendFullUpdateToClient(controller, clientFlags); }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendFullUpdate(IClientAPI client, uint clientFlags)
|
#region Public Methods
|
||||||
{
|
|
||||||
m_Entity.SendFullUpdateToClient(client, clientFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Hides the metaentity from a single client.
|
/// Hides the metaentity from a single client.
|
||||||
|
@ -162,6 +178,25 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendFullUpdate(IClientAPI client)
|
||||||
|
{
|
||||||
|
// Not sure what clientFlags should be but 0 seems to work
|
||||||
|
SendFullUpdate(client, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendFullUpdate(IClientAPI client, uint clientFlags)
|
||||||
|
{
|
||||||
|
m_Entity.SendFullUpdateToClient(client, clientFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendFullUpdateToAll()
|
||||||
|
{
|
||||||
|
uint clientFlags = 0;
|
||||||
|
m_Entity.Scene.ClientManager.ForEachClient(delegate(IClientAPI controller)
|
||||||
|
{ m_Entity.SendFullUpdateToClient(controller, clientFlags); }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Makes a single SceneObjectPart see through.
|
/// Makes a single SceneObjectPart see through.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -215,5 +250,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
//m_log.Info("[Content Management]: Exception thrown while accessing default face texture of object: " + e);
|
//m_log.Info("[Content Management]: Exception thrown while accessing default face texture of object: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Public Methods
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,40 +1,54 @@
|
||||||
|
#region Header
|
||||||
|
|
||||||
// PointMetaEntity.cs created with MonoDevelop
|
// PointMetaEntity.cs created with MonoDevelop
|
||||||
// User: bongiojp at 3:03 PM 8/6/2008
|
// User: bongiojp at 3:03 PM 8/6/2008
|
||||||
//
|
//
|
||||||
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
|
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#endregion Header
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using log4net;
|
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
|
||||||
using Axiom.Math;
|
using Axiom.Math;
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public class PointMetaEntity : MetaEntity
|
public class PointMetaEntity : MetaEntity
|
||||||
{
|
{
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
public PointMetaEntity(Scene scene, uint LocalId, LLVector3 groupPos, float transparency) : base()
|
public PointMetaEntity(Scene scene, uint LocalId, LLVector3 groupPos, float transparency)
|
||||||
|
: base()
|
||||||
{
|
{
|
||||||
CreatePointEntity(scene, LLUUID.Random(), LocalId, groupPos);
|
CreatePointEntity(scene, LLUUID.Random(), LocalId, groupPos);
|
||||||
SetPartTransparency(m_Entity.RootPart, transparency);
|
SetPartTransparency(m_Entity.RootPart, transparency);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PointMetaEntity(Scene scene, LLUUID uuid, uint LocalId, LLVector3 groupPos, float transparency) : base()
|
public PointMetaEntity(Scene scene, LLUUID uuid, uint LocalId, LLVector3 groupPos, float transparency)
|
||||||
|
: base()
|
||||||
{
|
{
|
||||||
CreatePointEntity(scene, uuid, LocalId, groupPos);
|
CreatePointEntity(scene, uuid, LocalId, groupPos);
|
||||||
SetPartTransparency(m_Entity.RootPart, transparency);
|
SetPartTransparency(m_Entity.RootPart, transparency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Constructors
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
|
||||||
private void CreatePointEntity(Scene scene, LLUUID uuid, uint LocalId, LLVector3 groupPos)
|
private void CreatePointEntity(Scene scene, LLUUID uuid, uint LocalId, LLVector3 groupPos)
|
||||||
{
|
{
|
||||||
SceneObjectGroup x = new SceneObjectGroup();
|
SceneObjectGroup x = new SceneObjectGroup();
|
||||||
|
@ -77,5 +91,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
|
|
||||||
m_Entity = x;
|
m_Entity = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Private Methods
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,21 +1,32 @@
|
||||||
|
#region Header
|
||||||
|
|
||||||
// SceneObjectGroupDiff.cs
|
// SceneObjectGroupDiff.cs
|
||||||
// User: bongiojp
|
// User: bongiojp
|
||||||
|
|
||||||
|
#endregion Header
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using log4net;
|
|
||||||
using OpenSim.Region.Physics.Manager;
|
using OpenSim.Region.Physics.Manager;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
|
|
||||||
using Axiom.Math;
|
using Axiom.Math;
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
{
|
{
|
||||||
|
#region Enumerations
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum Diff
|
public enum Diff
|
||||||
{
|
{
|
||||||
|
@ -46,18 +57,26 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
SITTARGETPOSITION = 1<<23,
|
SITTARGETPOSITION = 1<<23,
|
||||||
TEXT = 1<<24,
|
TEXT = 1<<24,
|
||||||
TOUCHNAME = 1<<25
|
TOUCHNAME = 1<<25
|
||||||
};
|
}
|
||||||
|
|
||||||
|
#endregion Enumerations
|
||||||
|
|
||||||
public static class Difference
|
public static class Difference
|
||||||
{
|
{
|
||||||
static float TimeToDiff = 0;
|
#region Static Fields
|
||||||
|
|
||||||
|
static float TimeToDiff = 0;
|
||||||
private static readonly ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private static int TruncateSignificant(float num, int digits)
|
#endregion Static Fields
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
|
||||||
|
private static bool AreQuaternionsEquivalent(LLQuaternion first, LLQuaternion second)
|
||||||
{
|
{
|
||||||
return (int) Math.Ceiling((Math.Truncate(num * 10 * digits)/10*digits));
|
LLVector3 firstVector = llRot2Euler(first);
|
||||||
// return (int) ((num * (10*digits))/10*digits);
|
LLVector3 secondVector = llRot2Euler(second);
|
||||||
|
return AreVectorsEquivalent(firstVector, secondVector);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool AreVectorsEquivalent(LLVector3 first, LLVector3 second)
|
private static bool AreVectorsEquivalent(LLVector3 first, LLVector3 second)
|
||||||
|
@ -71,11 +90,18 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool AreQuaternionsEquivalent(LLQuaternion first, LLQuaternion second)
|
// Taken from Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
|
||||||
|
private static double NormalizeAngle(double angle)
|
||||||
{
|
{
|
||||||
LLVector3 firstVector = llRot2Euler(first);
|
angle = angle % (Math.PI * 2);
|
||||||
LLVector3 secondVector = llRot2Euler(second);
|
if (angle < 0) angle = angle + Math.PI * 2;
|
||||||
return AreVectorsEquivalent(firstVector, secondVector);
|
return angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int TruncateSignificant(float num, int digits)
|
||||||
|
{
|
||||||
|
return (int) Math.Ceiling((Math.Truncate(num * 10 * digits)/10*digits));
|
||||||
|
// return (int) ((num * (10*digits))/10*digits);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Taken from Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
|
// Taken from Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
|
||||||
|
@ -97,13 +123,9 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
return new LLVector3(0.0f, (float)(-Math.PI / 2), (float)NormalizeAngle(Math.Atan2((r.Z * r.W + r.X * r.Y), 0.5 - t.X - t.Z)));
|
return new LLVector3(0.0f, (float)(-Math.PI / 2), (float)NormalizeAngle(Math.Atan2((r.Z * r.W + r.X * r.Y), 0.5 - t.X - t.Z)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Taken from Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
|
#endregion Private Methods
|
||||||
private static double NormalizeAngle(double angle)
|
|
||||||
{
|
#region Public Methods
|
||||||
angle = angle % (Math.PI * 2);
|
|
||||||
if (angle < 0) angle = angle + Math.PI * 2;
|
|
||||||
return angle;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the attributes (Vectors, Quaternions, Strings, etc.) between two scene object parts
|
/// Compares the attributes (Vectors, Quaternions, Strings, etc.) between two scene object parts
|
||||||
|
@ -165,5 +187,7 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Public Methods
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue