Removed reference to Scene EventManager from primitive. In its place, primitive now has its own event (OnPrimCountTainted) that ParcelManager subscribes to.

Removed some unused code from SimpleApp.
afrisby
MW 2007-07-15 17:40:21 +00:00
parent aebd58d75e
commit a87ebda895
7 changed files with 52 additions and 79 deletions

View File

@ -215,8 +215,6 @@ namespace OpenSim
LocalWorld = new Scene(udpServer.PacketServer.ClientManager, regionDat, authenBase, commsManager, this.AssetCache, tmpStoreManager, httpServer);
this.m_localWorld.Add(LocalWorld);
//LocalWorld.InventoryCache = InventoryCache;
//LocalWorld.AssetCache = AssetCache;
udpServer.LocalWorld = LocalWorld;

View File

@ -206,7 +206,7 @@ namespace OpenSim.Region.Environment
}
else
{
Console.WriteLine("Point (" + x + ", " + y + ") determined from point (" + x_float + ", " + y_float + ")");
// Console.WriteLine("Point (" + x + ", " + y + ") determined from point (" + x_float + ", " + y_float + ")");
return parcelList[parcelIDList[x, y]];
}
}

View File

@ -9,6 +9,8 @@ using OpenSim.Framework.Types;
namespace OpenSim.Region.Environment.Scenes
{
public delegate void PrimCountTaintedDelegate();
public class Primitive : EntityBase
{
private const uint FULL_MASK_PERMISSIONS = 2147483647;
@ -47,6 +49,8 @@ namespace OpenSim.Region.Environment.Scenes
private EventManager m_eventManager;
public event PrimCountTaintedDelegate OnPrimCountTainted;
#region Properties
/// <summary>
/// If rootprim, will return world position
@ -132,22 +136,21 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="isRoot"></param>
/// <param name="parent"></param>
/// <param name="rootObject"></param>
public Primitive(ulong regionHandle, Scene world, EventManager eventManager, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos)
public Primitive(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos)
{
m_regionHandle = regionHandle;
m_world = world;
m_eventManager = eventManager;
inventoryItems = new Dictionary<LLUUID, InventoryItem>();
this.m_Parent = parent;
this.m_isRootPrim = isRoot;
this.m_RootParent = rootObject;
this.CreateFromShape(ownerID, localID, pos, shape);
this.Rotation = Axiom.Math.Quaternion.Identity;
m_eventManager.TriggerParcelPrimCountTainted();
m_world.AcknowledgeNewPrim(this);
this.OnPrimCountTainted();
}
/// <summary>
@ -156,7 +159,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <remarks>Empty constructor for duplication</remarks>
public Primitive()
{
m_eventManager.TriggerParcelPrimCountTainted();
}
#endregion
@ -165,7 +168,7 @@ namespace OpenSim.Region.Environment.Scenes
~Primitive()
{
m_eventManager.TriggerParcelPrimCountTainted();
this.OnPrimCountTainted();
}
#endregion
@ -174,17 +177,20 @@ namespace OpenSim.Region.Environment.Scenes
public Primitive Copy(EntityBase parent, SceneObject rootParent)
{
Primitive dupe = (Primitive)this.MemberwiseClone();
// TODO: Copy this properly.
dupe.inventoryItems = this.inventoryItems;
dupe.m_Parent = parent;
dupe.m_RootParent = rootParent;
dupe.m_Shape = this.m_Shape.Copy();
// TODO: Copy this properly.
dupe.inventoryItems = this.inventoryItems;
dupe.children = new List<EntityBase>();
dupe.m_Shape = this.m_Shape.Copy();
dupe.m_regionHandle = this.m_regionHandle;
dupe.m_world = this.m_world;
uint newLocalID = this.m_world.PrimIDAllocate();
dupe.uuid = LLUUID.Random();
dupe.LocalId = newLocalID;
dupe.m_regionHandle = this.m_regionHandle;
if (parent is SceneObject)
{
@ -200,7 +206,10 @@ namespace OpenSim.Region.Environment.Scenes
dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z);
dupe.Rotation = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z);
dupe.m_pos = new LLVector3(this.m_pos.X, this.m_pos.Y, this.m_pos.Z);
rootParent.AddChildToList(dupe);
this.m_world.AcknowledgeNewPrim(dupe);
dupe.TriggerOnPrimCountTainted();
foreach (Primitive prim in this.children)
{
@ -213,7 +222,6 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region Override from EntityBase
/// <summary>
///
@ -276,7 +284,7 @@ namespace OpenSim.Region.Environment.Scenes
this.m_world.DeleteEntity(linkObject.rootUUID);
linkObject.DeleteAllChildren();
m_eventManager.TriggerParcelPrimCountTainted();
this.OnPrimCountTainted();
}
/// <summary>
@ -352,7 +360,7 @@ namespace OpenSim.Region.Environment.Scenes
prim.m_pos += offset;
prim.updateFlag = 2;
}
m_eventManager.TriggerParcelPrimCountTainted();
this.OnPrimCountTainted();
}
/// <summary>
@ -404,7 +412,7 @@ namespace OpenSim.Region.Environment.Scenes
this.Pos = newPos;
this.updateFlag = 2;
m_eventManager.TriggerParcelPrimCountTainted();
this.OnPrimCountTainted();
}
/// <summary>
@ -533,6 +541,7 @@ namespace OpenSim.Region.Environment.Scenes
this.updateFlag = 1;
}
#endregion
#region Client Update Methods
/// <summary>
@ -622,5 +631,10 @@ namespace OpenSim.Region.Environment.Scenes
}
#endregion
public void TriggerOnPrimCountTainted()
{
this.OnPrimCountTainted();
}
}
}

View File

@ -139,7 +139,6 @@ namespace OpenSim.Region.Environment.Scenes
m_scriptManager = new ScriptManager(this);
m_eventManager = new EventManager();
m_eventManager.OnParcelPrimCountTainted += new EventManager.OnParcelPrimCountTaintedDelegate(m_parcelManager.setPrimsTainted);
m_eventManager.OnParcelPrimCountAdd += new EventManager.OnParcelPrimCountAddDelegate(m_parcelManager.addPrimToParcelCounts);
MainLog.Instance.Verbose("World.cs - creating new entitities instance");
@ -221,14 +220,14 @@ namespace OpenSim.Region.Environment.Scenes
}
this.parcelPrimCheckCount++;
if (this.parcelPrimCheckCount > 50) //check every 5 seconds for tainted prims
if (this.parcelPrimCheckCount > 100) //check every 10 seconds for tainted prims
{
if (m_parcelManager.parcelPrimCountTainted)
{
//Perform parcel update of prim count
performParcelPrimCountUpdate();
this.parcelPrimCheckCount = 0;
}
}
}
}
@ -434,7 +433,6 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="prim">The object to load</param>
public void PrimFromStorage(PrimData prim)
{
}
/// <summary>
@ -460,7 +458,8 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="ownerID"></param>
public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape)
{
SceneObject sceneOb = new SceneObject(this, m_eventManager, ownerID, this.PrimIDAllocate(), pos, shape);
SceneObject sceneOb = new SceneObject(this, m_eventManager, ownerID, this.PrimIDAllocate(), pos, shape);
AddNewEntity(sceneOb);
}
@ -469,6 +468,14 @@ namespace OpenSim.Region.Environment.Scenes
this.Entities.Add(sceneObject.rootUUID, sceneObject);
}
/// <summary>
/// Called by a prim when it has been created/cloned, so that its events can be subscribed to
/// </summary>
/// <param name="prim"></param>
public void AcknowledgeNewPrim(Primitive prim)
{
prim.OnPrimCountTainted += m_parcelManager.setPrimsTainted;
}
#endregion
#region Add/Remove Avatar Methods

View File

@ -19,9 +19,6 @@ namespace OpenSim.Region.Environment.Scenes
public delegate void OnRemovePresenceDelegate(LLUUID uuid);
public event OnRemovePresenceDelegate OnRemovePresence;
public delegate void OnParcelPrimCountTaintedDelegate();
public event OnParcelPrimCountTaintedDelegate OnParcelPrimCountTainted;
public delegate void OnParcelPrimCountUpdateDelegate();
public event OnParcelPrimCountUpdateDelegate OnParcelPrimCountUpdate;
@ -58,13 +55,6 @@ namespace OpenSim.Region.Environment.Scenes
}
}
public void TriggerParcelPrimCountTainted()
{
if (OnParcelPrimCountTainted != null)
{
OnParcelPrimCountTainted();
}
}
public void TriggerParcelPrimCountUpdate()
{
if (OnParcelPrimCountUpdate != null)

View File

@ -88,7 +88,7 @@ namespace OpenSim.Region.Environment.Scenes
this.CreateRootFromShape(ownerID, localID, shape, pos);
registerEvents();
}
/// <summary>
@ -97,7 +97,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <remarks>Need a null constructor for duplication</remarks>
public SceneObject()
{
}
public void registerEvents()
@ -121,18 +121,15 @@ namespace OpenSim.Region.Environment.Scenes
datastore.StoreObject(this);
}
/// <summary>
/// Sends my primitive info to the parcel manager for it to keep tally of all of the prims!
/// </summary>
private void ProcessParcelPrimCountUpdate()
{
m_eventManager.TriggerParcelPrimCountAdd(this);
}
/// <summary>
///
/// </summary>
@ -141,7 +138,9 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="localID"></param>
public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos)
{
this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world,this.m_eventManager, agentID, localID, true, this, this, shape, pos);
this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos);
this.children.Add(rootPrimitive);
this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
}
@ -156,7 +155,7 @@ namespace OpenSim.Region.Environment.Scenes
}
/// <summary>
/// Copies a prim or group of prims (SceneObject) -- TODO: cleanup code
/// Makes a copy of this SceneObject (and child primitives)
/// </summary>
/// <returns>A complete copy of the object</returns>
public new SceneObject Copy()
@ -171,8 +170,8 @@ namespace OpenSim.Region.Environment.Scenes
dupe.children.Add(dupe.rootPrimitive);
dupe.rootPrimitive.Pos = this.Pos;
dupe.Rotation = this.Rotation;
LLUUID rootu= dupe.rootUUID;
uint rooti = dupe.rootLocalID;
LLUUID rootu = dupe.rootUUID;
uint rooti = dupe.rootLocalID;
dupe.registerEvents();
return dupe;

View File

@ -18,7 +18,7 @@ using OpenSim.Region.Environment.Scenes;
namespace SimpleApp
{
class Program : IAssetReceiver, conscmd_callback
class Program : conscmd_callback
{
private LogBase m_log;
AuthenticateSessionsBase m_circuitManager;
@ -42,7 +42,6 @@ namespace SimpleApp
LocalAssetServer assetServer = new LocalAssetServer();
assetServer.SetServerInfo("http://127.0.0.1:8003/", "");
assetServer.SetReceiver(this);
AssetCache assetCache = new AssetCache(assetServer);
@ -83,40 +82,6 @@ namespace SimpleApp
m_log.WriteLine(LogPriority.NORMAL, "Press enter to quit.");
m_log.ReadLine();
}
private bool AddNewSessionHandler(ulong regionHandle, Login loginData)
{
m_log.WriteLine(LogPriority.NORMAL, "Region [{0}] recieved Login from [{1}] [{2}]", regionHandle, loginData.First, loginData.Last);
AgentCircuitData agent = new AgentCircuitData();
agent.AgentID = loginData.Agent;
agent.firstname = loginData.First;
agent.lastname = loginData.Last;
agent.SessionID = loginData.Session;
agent.SecureSessionID = loginData.SecureSession;
agent.circuitcode = loginData.CircuitCode;
agent.BaseFolder = loginData.BaseFolder;
agent.InventoryFolder = loginData.InventoryFolder;
agent.startpos = new LLVector3(128, 128, 70);
m_circuitManager.AddNewCircuit(agent.circuitcode, agent);
return true;
}
#region IAssetReceiver Members
public void AssetReceived(AssetBase asset, bool IsTexture)
{
throw new Exception("The method or operation is not implemented.");
}
public void AssetNotFound(AssetBase asset)
{
throw new Exception("The method or operation is not implemented.");
}
#endregion
#region conscmd_callback Members