From d44b50ee462978b4899c0b142f6ecbfb553f06b6 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 15 Oct 2009 15:25:02 -0700
Subject: * Removed some of the redundant broadcast functions in Scene and
SceneGraph so it is clear who/what the broadcast is going to each time *
Removed two redundant parameters from SceneObjectPart * Changed some code in
terse update sending that was meant to work with references to work with
value types (since Vector3 and Quaternion are structs) * Committing a preview
of a new method for sending object updates efficiently (all commented out for
now)
---
OpenSim/Region/Framework/Scenes/Scene.cs | 31 +++++++---------------
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 17 ------------
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 12 +--------
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 11 ++++----
4 files changed, 15 insertions(+), 56 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d3d397d..d13d4fb 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1194,15 +1194,6 @@ namespace OpenSim.Region.Framework.Scenes
}
///
- /// Perform delegate action on all clients subscribing to updates from this region.
- ///
- ///
- public void Broadcast(Action whatToDo)
- {
- ForEachScenePresence(delegate(ScenePresence presence) { whatToDo(presence.ControllingClient); });
- }
-
- ///
/// Backup the scene. This acts as the main method of the backup thread.
///
///
@@ -3048,17 +3039,13 @@ namespace OpenSim.Region.Framework.Scenes
}
m_eventManager.TriggerOnRemovePresence(agentID);
- Broadcast(delegate(IClientAPI client)
- {
- try
- {
- client.SendKillObject(avatar.RegionHandle, avatar.LocalId);
- }
- catch (NullReferenceException)
- {
- //We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway.
- }
- });
+ ForEachClient(
+ delegate(IClientAPI client)
+ {
+ //We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway
+ try { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); }
+ catch (NullReferenceException) { }
+ });
ForEachScenePresence(
delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
@@ -3143,7 +3130,7 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
}
- Broadcast(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); });
+ ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); });
}
#endregion
@@ -4211,7 +4198,7 @@ namespace OpenSim.Region.Framework.Scenes
public void ForEachClient(Action action)
{
- m_sceneGraph.ForEachClient(action);
+ ClientManager.ForEach(action);
}
public void ForEachSOG(Action action)
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 9cd2247..04397ad 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1107,23 +1107,6 @@ namespace OpenSim.Region.Framework.Scenes
return UUID.Zero;
}
- protected internal void ForEachClient(Action action)
- {
- List splist = GetScenePresences();
- foreach (ScenePresence presence in splist)
- {
- try
- {
- action(presence.ControllingClient);
- }
- catch (Exception e)
- {
- // Catch it and move on. This includes situations where splist has inconsistent info
- m_log.WarnFormat("[SCENE]: Problem processing action in ForEachClient: ", e.Message);
- }
- }
- }
-
protected internal void ForEachSOG(Action action)
{
List objlist = new List(SceneObjectGroupsByFullID.Values);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 801a7db..377cb6e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -853,16 +853,6 @@ if (m_shape != null) {
return m_offsetPosition + m_groupPosition; }
}
- public UUID ObjectCreator
- {
- get { return _creatorID; }
- }
-
- public UUID ObjectOwner
- {
- get { return _ownerID; }
- }
-
public SceneObjectGroup ParentGroup
{
get { return m_parentGroup; }
@@ -1440,7 +1430,7 @@ if (m_shape != null) {
// Move afterwards ResetIDs as it clears the localID
dupe.LocalId = localID;
// This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated.
- dupe._lastOwnerID = ObjectOwner;
+ dupe._lastOwnerID = OwnerID;
byte[] extraP = new byte[Shape.ExtraParams.Length];
Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 2a06f9e..387db44 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2455,11 +2455,10 @@ namespace OpenSim.Region.Framework.Scenes
m_perfMonMS = Environment.TickCount;
Vector3 pos = m_pos;
- Vector3 vel = Velocity;
- Quaternion rot = m_bodyRot;
pos.Z -= m_appearance.HipOffset;
- remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, new Vector3(pos.X, pos.Y, pos.Z),
- new Vector3(vel.X, vel.Y, vel.Z), rot, m_uuid);
+
+ remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue),
+ LocalId, pos, Velocity, m_bodyRot, m_uuid);
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.StatsReporter.AddAgentUpdates(1);
@@ -2473,7 +2472,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_perfMonMS = Environment.TickCount;
- m_scene.Broadcast(SendTerseUpdateToClient);
+ m_scene.ForEachClient(SendTerseUpdateToClient);
m_lastVelocity = m_velocity;
lastPhysPos = AbsolutePosition;
@@ -2774,7 +2773,7 @@ namespace OpenSim.Region.Framework.Scenes
if (m_isChildAgent)
return;
- m_scene.Broadcast(
+ m_scene.ForEachClient(
delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId, objectIDs); });
}
--
cgit v1.1