diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs
index dd505ad1be..34f28661fc 100644
--- a/OpenSim/Framework/ChildAgentDataUpdate.cs
+++ b/OpenSim/Framework/ChildAgentDataUpdate.cs
@@ -88,14 +88,28 @@ namespace OpenSim.Framework
}
}
+ public interface IAgentData
+ {
+ UUID AgentID { get; set; }
+
+ OSDMap PackUpdateMessage();
+ void UnpackUpdateMessage(OSDMap map);
+ }
+
///
/// Replacement for ChildAgentDataUpdate. Used over RESTComms and LocalComms.
///
- public class AgentPosition
+ public class AgentPosition : IAgentData
{
+ private UUID m_id;
+ public UUID AgentID
+ {
+ get { return m_id; }
+ set { m_id = value; }
+ }
+
public ulong RegionHandle;
public uint CircuitCode;
- public UUID AgentID;
public UUID SessionID;
public float Far;
@@ -272,12 +286,16 @@ namespace OpenSim.Framework
}
}
- public class AgentData
+ public class AgentData : IAgentData
{
+ private UUID m_id;
+ public UUID AgentID
+ {
+ get { return m_id; }
+ set { m_id = value; }
+ }
public ulong RegionHandle;
public uint CircuitCode;
-
- public UUID AgentID;
public UUID SessionID;
public Vector3 Position;
diff --git a/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs b/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs
index e1976229ba..aa618a7733 100644
--- a/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs
+++ b/OpenSim/Region/Environment/Interfaces/IInterregionComms.cs
@@ -35,8 +35,38 @@ namespace OpenSim.Region.Environment.Interfaces
public interface IInterregionCommsOut
{
+ ///
+ /// Full child agent update.
+ ///
+ ///
+ ///
+ ///
bool SendChildAgentUpdate(ulong regionHandle, AgentData data);
+
+ ///
+ /// Short child agent update, mostly for position.
+ ///
+ ///
+ ///
+ ///
+ bool SendChildAgentUpdate(ulong regionHandle, AgentPosition data);
+
+ ///
+ /// Message from receiving region to departing region, telling it got contacted by the client.
+ /// When sent over REST, it invokes the opaque uri.
+ ///
+ ///
+ ///
+ ///
+ ///
bool SendReleaseAgent(ulong regionHandle, UUID id, string uri);
+
+ ///
+ /// Close agent.
+ ///
+ ///
+ ///
+ ///
bool SendCloseAgent(ulong regionHandle, UUID id);
}
diff --git a/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs b/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs
index 9f547a24ab..135a05ecfd 100644
--- a/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs
+++ b/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs
@@ -133,6 +133,21 @@ namespace OpenSim.Region.Environment.Modules.Communications.Local
return false;
}
+ public bool SendChildAgentUpdate(ulong regionHandle, AgentPosition cAgentData)
+ {
+ foreach (Scene s in m_sceneList)
+ {
+ if (s.RegionInfo.RegionHandle == regionHandle)
+ {
+ //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
+ s.IncomingChildAgentDataUpdate(cAgentData);
+ return true;
+ }
+ }
+ //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
+ return false;
+ }
+
public bool SendReleaseAgent(ulong regionHandle, UUID id, string uri)
{
//uint x, y;
diff --git a/OpenSim/Region/Environment/Modules/Communications/REST/RESTInterregionComms.cs b/OpenSim/Region/Environment/Modules/Communications/REST/RESTInterregionComms.cs
index f48e474c38..bff8316841 100644
--- a/OpenSim/Region/Environment/Modules/Communications/REST/RESTInterregionComms.cs
+++ b/OpenSim/Region/Environment/Modules/Communications/REST/RESTInterregionComms.cs
@@ -146,6 +146,23 @@ namespace OpenSim.Region.Environment.Modules.Communications.REST
}
+ public bool SendChildAgentUpdate(ulong regionHandle, AgentPosition cAgentData)
+ {
+ // Try local first
+ if (m_localBackend.SendChildAgentUpdate(regionHandle, cAgentData))
+ return true;
+
+ // else do the remote thing
+ RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
+ if (regInfo != null)
+ {
+ return DoChildAgentUpdateCall(regInfo, cAgentData);
+ }
+ //else
+ // m_log.Warn("[REST COMMS]: Region not found " + regionHandle);
+ return false;
+
+ }
public bool SendReleaseAgent(ulong regionHandle, UUID id, string uri)
{
// Try local first
@@ -180,7 +197,7 @@ namespace OpenSim.Region.Environment.Modules.Communications.REST
// Internal functions for the above public interface
//-------------------------------------------------------------------
- protected bool DoChildAgentUpdateCall(RegionInfo region, AgentData cAgentData)
+ protected bool DoChildAgentUpdateCall(RegionInfo region, IAgentData cAgentData)
{
// Eventually, we want to use a caps url instead of the agentID
string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + cAgentData.AgentID + "/";
@@ -436,20 +453,51 @@ namespace OpenSim.Region.Environment.Modules.Communications.REST
if (args["destination_handle"] != null)
UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle);
- AgentData agent = new AgentData();
- try
+ string messageType;
+ if (args["message_type"] != null)
+ messageType = args["message_type"].AsString();
+ else
{
- agent.UnpackUpdateMessage(args);
+ m_log.Warn("[REST COMMS]: Agent Put Message Type not found. ");
+ messageType = "AgentData";
+ }
+
+ bool result = true;
+ if ("AgentData".Equals(messageType))
+ {
+ AgentData agent = new AgentData();
+ try
+ {
+ agent.UnpackUpdateMessage(args);
+ }
+ catch (Exception ex)
+ {
+ m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message);
+ return;
+ }
+ //agent.Dump();
+ // This is one of the meanings of PUT agent
+ result = m_localBackend.SendChildAgentUpdate(regionhandle, agent);
+
+ }
+ else if ("AgentPosition".Equals(messageType))
+ {
+ AgentPosition agent = new AgentPosition();
+ try
+ {
+ agent.UnpackUpdateMessage(args);
+ }
+ catch (Exception ex)
+ {
+ m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message);
+ return;
+ }
+ //agent.Dump();
+ // This is one of the meanings of PUT agent
+ result = m_localBackend.SendChildAgentUpdate(regionhandle, agent);
+
}
- catch (Exception ex)
- {
- m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message);
- return;
- }
- //agent.Dump();
- // This is the meaning of PUT agent
- bool result = m_localBackend.SendChildAgentUpdate(regionhandle, agent);
responsedata["int_response_code"] = 200;
diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
index abf4065b93..5e1621bf4c 100644
--- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs
@@ -260,7 +260,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
// Let's send a full update of the agent. This is a synchronous call.
AgentData agent = new AgentData();
avatar.CopyTo(agent);
- agent.Position = new Vector3(-1, -1, -1); // this means ignore position info; UGH!!!!
+ agent.Position = position;
agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort +
"/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionHandle.ToString() + "/release/";
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index f652e2112e..408f100bf1 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2970,7 +2970,19 @@ namespace OpenSim.Region.Environment.Scenes
public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData)
{
- //Console.WriteLine(" XXX Scene IncomingChildAgentDataUpdate in " + RegionInfo.RegionName);
+ //Console.WriteLine(" XXX Scene IncomingChildAgentDataUpdate FULL in " + RegionInfo.RegionName);
+ ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
+ if (childAgentUpdate != null)
+ {
+ childAgentUpdate.ChildAgentDataUpdate(cAgentData);
+ return true;
+ }
+ return false;
+ }
+
+ public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData)
+ {
+ //Console.WriteLine(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName);
ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
if (childAgentUpdate != null)
{
@@ -3174,7 +3186,7 @@ namespace OpenSim.Region.Environment.Scenes
return m_sceneGridService.CrossToNeighbouringRegion(regionHandle, agentID, position, isFlying);
}
- public void SendOutChildAgentUpdates(AgentData cadu, ScenePresence presence)
+ public void SendOutChildAgentUpdates(AgentPosition cadu, ScenePresence presence)
{
m_sceneGridService.SendChildAgentDataUpdate(cadu, presence);
}
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index da3a9d3f09..8b3ac4fa3e 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -538,7 +538,7 @@ namespace OpenSim.Region.Environment.Scenes
//bool val = m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region));
}
- public delegate void SendChildAgentDataUpdateDelegate(AgentData cAgentData, ulong regionHandle);
+ public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, ulong regionHandle);
///
/// This informs all neighboring regions about the settings of it's child agent.
@@ -547,7 +547,7 @@ namespace OpenSim.Region.Environment.Scenes
/// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc.
///
///
- private void SendChildAgentDataUpdateAsync(AgentData cAgentData, ulong regionHandle)
+ private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, ulong regionHandle)
{
//m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName);
try
@@ -577,7 +577,7 @@ namespace OpenSim.Region.Environment.Scenes
icon.EndInvoke(iar);
}
- public void SendChildAgentDataUpdate(AgentData cAgentData, ScenePresence presence)
+ public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence)
{
// This assumes that we know what our neighbors are.
try
@@ -847,7 +847,7 @@ namespace OpenSim.Region.Environment.Scenes
// Let's send a full update of the agent. This is a synchronous call.
AgentData agent = new AgentData();
avatar.CopyTo(agent);
- agent.Position = new Vector3(-1, -1, -1); // this means ignore position info; UGH!!!!
+ agent.Position = position;
agent.CallbackURI = "http://" + m_regionInfo.ExternalHostName + ":" + m_regionInfo.HttpPort +
"/agent/" + avatar.UUID.ToString() + "/" + avatar.Scene.RegionInfo.RegionHandle.ToString() + "/release/";
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 205d5cc9ff..073457b23e 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -2338,10 +2338,10 @@ namespace OpenSim.Region.Environment.Scenes
cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
cadu.Velocity = new sLLVector3(Velocity);
- AgentData agent = new AgentData();
- agent.CopyFrom(cadu);
+ AgentPosition agentpos = new AgentPosition();
+ agentpos.CopyFrom(cadu);
- m_scene.SendOutChildAgentUpdates(agent, this);
+ m_scene.SendOutChildAgentUpdates(agentpos, this);
m_LastChildAgentUpdatePosition.X = AbsolutePosition.X;
m_LastChildAgentUpdatePosition.Y = AbsolutePosition.Y;
@@ -2583,17 +2583,27 @@ namespace OpenSim.Region.Environment.Scenes
}
#region Child Agent Updates
+
+ public void ChildAgentDataUpdate(AgentData cAgentData)
+ {
+ //Console.WriteLine(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName);
+ if (!IsChildAgent)
+ return;
+
+ CopyFrom(cAgentData);
+ }
+
///
/// This updates important decision making data about a child agent
/// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region
///
- public void ChildAgentDataUpdate(AgentData cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
+ public void ChildAgentDataUpdate(AgentPosition cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
{
//
if (!IsChildAgent)
return;
- //Console.WriteLine(" >>> ChildAgentDataUpdate <<< " + rRegionX + "-" + rRegionY);
+ //Console.WriteLine(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY);
int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;
@@ -2602,33 +2612,19 @@ namespace OpenSim.Region.Environment.Scenes
m_pos = new Vector3(cAgentData.Position.X + shiftx, cAgentData.Position.Y + shifty, cAgentData.Position.Z);
// It's hard to say here.. We can't really tell where the camera position is unless it's in world cordinates from the sending region
- if (cAgentData.Center!= new Vector3(-1, -1, -1)) // UGH!
- m_CameraCenter = cAgentData.Center;
- // new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z);
+ m_CameraCenter = cAgentData.Center;
-
- m_godlevel = cAgentData.GodLevel;
- if (cAgentData.Center != new Vector3(-1, -1, -1))
- m_avHeight = cAgentData.Size.Z;
+ m_avHeight = cAgentData.Size.Z;
//SetHeight(cAgentData.AVHeight);
if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
- // ugh!!!
- m_AgentControlFlags = cAgentData.ControlFlags;
- if (m_physicsActor != null)
- {
- m_physicsActor.Flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
- }
// Sends out the objects in the user's draw distance if m_sendTasksToChild is true.
if (m_scene.m_seeIntoRegionFromNeighbor)
m_pendingObjects = null;
- m_callbackURI = cAgentData.CallbackURI;
- m_rootRegionHandle = Util.UIntsToLong(rRegionX * Constants.RegionSize, rRegionY * Constants.RegionSize);
-
//cAgentData.AVHeight;
//cAgentData.regionHandle;
//m_velocity = cAgentData.Velocity;
@@ -2638,13 +2634,17 @@ namespace OpenSim.Region.Environment.Scenes
{
cAgent.AgentID = UUID;
cAgent.RegionHandle = m_scene.RegionInfo.RegionHandle;
- cAgent.AlwaysRun = m_setAlwaysRun;
- cAgent.Size = new Vector3(0, 0, m_avHeight);
+
+ cAgent.Position = m_pos;
+ cAgent.Velocity = m_velocity;
cAgent.Center = m_CameraCenter;
+ cAgent.Size = new Vector3(0, 0, m_avHeight);
+ cAgent.AtAxis = m_CameraAtAxis;
+ cAgent.LeftAxis = m_CameraLeftAxis;
+ cAgent.UpAxis = m_CameraUpAxis;
+
cAgent.Far = m_DrawDistance;
- cAgent.GodLevel = (byte)m_godlevel;
- cAgent.Position = AbsolutePosition;
- cAgent.Velocity = Velocity;
+
// Throttles
float multiplier = 1;
int innacurateNeighbors = m_scene.GetInaccurateNeighborCount();
@@ -2659,15 +2659,64 @@ namespace OpenSim.Region.Environment.Scenes
//m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
cAgent.Throttles = ControllingClient.GetThrottlesPacked(multiplier);
+ cAgent.HeadRotation = m_headrotation;
+ cAgent.BodyRotation = m_bodyRot;
+ cAgent.ControlFlags = m_AgentControlFlags;
if ((m_physicsActor != null) && (m_physicsActor.Flying))
{
- m_AgentControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
+ cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
}
- cAgent.ControlFlags = m_AgentControlFlags;
+
+ cAgent.GodLevel = (byte)m_godlevel;
+ cAgent.AlwaysRun = m_setAlwaysRun;
+
+ //cAgent.AgentTextures = ???
+ //cAgent.GroupID = ??
// Groups???
- // Visual Params???
+
// Animations???
+
+ cAgent.VisualParams = m_appearance.VisualParams;
+ }
+
+ public void CopyFrom(AgentData cAgent)
+ {
+ m_rootRegionHandle= cAgent.RegionHandle;
+ m_callbackURI = cAgent.CallbackURI;
+
+ m_pos = cAgent.Position;
+ m_velocity = cAgent.Velocity;
+ m_CameraCenter = cAgent.Center;
+ m_avHeight = cAgent.Size.Z;
+ m_CameraAtAxis = cAgent.AtAxis;
+ m_CameraLeftAxis = cAgent.LeftAxis;
+ m_CameraUpAxis = cAgent.UpAxis;
+
+ m_DrawDistance = cAgent.Far;
+
+ if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0)
+ ControllingClient.SetChildAgentThrottle(cAgent.Throttles);
+
+ m_headrotation = cAgent.HeadRotation;
+ m_bodyRot = cAgent.BodyRotation;
+ m_AgentControlFlags = cAgent.ControlFlags; // We need more flags!
+ if (m_physicsActor != null)
+ {
+ m_physicsActor.Flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
+ }
+
+ m_godlevel = cAgent.GodLevel;
+ m_setAlwaysRun = cAgent.AlwaysRun;
+
+ //cAgent.AgentTextures = ???
+
+ //cAgent.GroupID = ??
+ //Groups???
+
+ // Animations???
+
+ m_appearance.VisualParams = cAgent.VisualParams;
}
#endregion Child Agent Updates