mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 01:35:46 +08:00
More EntityTransferContext plumbing
This commit is contained in:
@@ -184,7 +184,7 @@ namespace OpenSim.Framework
|
||||
/// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json
|
||||
/// </summary>
|
||||
/// <returns>map of the agent circuit data</returns>
|
||||
public OSDMap PackAgentCircuitData(int wearablesCount)
|
||||
public OSDMap PackAgentCircuitData(EntityTransferContext ctx)
|
||||
{
|
||||
OSDMap args = new OSDMap();
|
||||
args["agent_id"] = OSD.FromUUID(AgentID);
|
||||
@@ -224,7 +224,7 @@ namespace OpenSim.Framework
|
||||
{
|
||||
args["appearance_serial"] = OSD.FromInteger(Appearance.Serial);
|
||||
|
||||
OSDMap appmap = Appearance.Pack(wearablesCount);
|
||||
OSDMap appmap = Appearance.Pack(ctx);
|
||||
args["packed_appearance"] = appmap;
|
||||
}
|
||||
|
||||
|
||||
@@ -717,7 +717,7 @@ namespace OpenSim.Framework
|
||||
/// <summary>
|
||||
/// Create an OSDMap from the appearance data
|
||||
/// </summary>
|
||||
public OSDMap Pack(int wearablesCount)
|
||||
public OSDMap Pack(EntityTransferContext ctx)
|
||||
{
|
||||
OSDMap data = new OSDMap();
|
||||
|
||||
@@ -728,8 +728,8 @@ namespace OpenSim.Framework
|
||||
//
|
||||
// This will send as many or as few wearables as we have, unless a count
|
||||
// is given. Used for legacy (pre 0.4) versions.
|
||||
int count = wearablesCount;
|
||||
if (wearablesCount == -1)
|
||||
int count = ctx.WearablesCount;
|
||||
if (ctx.WearablesCount == -1)
|
||||
count = m_wearables.Length;
|
||||
OSDArray wears = new OSDArray(count);
|
||||
for (int i = 0; i < count; i++)
|
||||
|
||||
@@ -61,8 +61,8 @@ namespace OpenSim.Framework
|
||||
{
|
||||
UUID AgentID { get; set; }
|
||||
|
||||
OSDMap Pack(Object parms = null);
|
||||
void Unpack(OSDMap map, IScene scene);
|
||||
OSDMap Pack(EntityTransferContext ctx);
|
||||
void Unpack(OSDMap map, IScene scene, EntityTransferContext ctx);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -96,7 +96,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public Dictionary<ulong, string> ChildrenCapSeeds = null;
|
||||
|
||||
public OSDMap Pack(Object parms = null)
|
||||
public OSDMap Pack(EntityTransferContext ctx)
|
||||
{
|
||||
OSDMap args = new OSDMap();
|
||||
args["message_type"] = OSD.FromString("AgentPosition");
|
||||
@@ -136,7 +136,7 @@ namespace OpenSim.Framework
|
||||
return args;
|
||||
}
|
||||
|
||||
public void Unpack(OSDMap args, IScene scene)
|
||||
public void Unpack(OSDMap args, IScene scene, EntityTransferContext ctx)
|
||||
{
|
||||
if (args.ContainsKey("region_handle"))
|
||||
UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
|
||||
@@ -391,18 +391,10 @@ namespace OpenSim.Framework
|
||||
|
||||
public Dictionary<string, UUID> MovementAnimationOverRides = new Dictionary<string, UUID>();
|
||||
|
||||
public virtual OSDMap Pack(Object parms = null)
|
||||
public virtual OSDMap Pack(EntityTransferContext ctx)
|
||||
{
|
||||
int wearablesCount = -1;
|
||||
|
||||
if (parms != null)
|
||||
{
|
||||
Hashtable p = (Hashtable)parms;
|
||||
|
||||
if (p.ContainsKey("wearablesCount"))
|
||||
wearablesCount = (int)p["wearablesCount"];
|
||||
}
|
||||
|
||||
// m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data");
|
||||
|
||||
OSDMap args = new OSDMap();
|
||||
@@ -503,7 +495,7 @@ namespace OpenSim.Framework
|
||||
}
|
||||
|
||||
if (Appearance != null)
|
||||
args["packed_appearance"] = Appearance.Pack(wearablesCount);
|
||||
args["packed_appearance"] = Appearance.Pack(ctx);
|
||||
|
||||
//if ((AgentTextures != null) && (AgentTextures.Length > 0))
|
||||
//{
|
||||
@@ -594,7 +586,7 @@ namespace OpenSim.Framework
|
||||
/// Avoiding reflection makes it painful to write, but that's the price!
|
||||
/// </summary>
|
||||
/// <param name="hash"></param>
|
||||
public virtual void Unpack(OSDMap args, IScene scene)
|
||||
public virtual void Unpack(OSDMap args, IScene scene, EntityTransferContext ctx)
|
||||
{
|
||||
//m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data");
|
||||
|
||||
@@ -903,14 +895,14 @@ namespace OpenSim.Framework
|
||||
|
||||
public class CompleteAgentData : AgentData
|
||||
{
|
||||
public override OSDMap Pack(object parms = null)
|
||||
public override OSDMap Pack(EntityTransferContext ctx)
|
||||
{
|
||||
return base.Pack(parms);
|
||||
return base.Pack(ctx);
|
||||
}
|
||||
|
||||
public override void Unpack(OSDMap map, IScene scene)
|
||||
public override void Unpack(OSDMap map, IScene scene, EntityTransferContext ctx)
|
||||
{
|
||||
base.Unpack(map, scene);
|
||||
base.Unpack(map, scene, ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,8 +311,9 @@ namespace OpenSim.Framework.Tests
|
||||
Agent1Data.SessionID = SessionId;
|
||||
Agent1Data.startpos = StartPos;
|
||||
|
||||
EntityTransferContext ctx = new EntityTransferContext();
|
||||
OSDMap map2;
|
||||
OSDMap map = Agent1Data.PackAgentCircuitData(-1);
|
||||
OSDMap map = Agent1Data.PackAgentCircuitData(ctx);
|
||||
try
|
||||
{
|
||||
string str = OSDParser.SerializeJsonString(map);
|
||||
|
||||
@@ -116,7 +116,8 @@ namespace OpenSim.Framework.Tests
|
||||
position2 = new AgentPosition();
|
||||
|
||||
Assert.IsFalse(position2.AgentID == position1.AgentID, "Test Error, position2 should be a blank uninitialized AgentPosition");
|
||||
position2.Unpack(position1.Pack(), null);
|
||||
EntityTransferContext ctx = new EntityTransferContext();
|
||||
position2.Unpack(position1.Pack(ctx), null, ctx);
|
||||
|
||||
Assert.IsTrue(position2.AgentID == position1.AgentID, "Agent ID didn't unpack the same way it packed");
|
||||
Assert.IsTrue(position2.Position == position1.Position, "Position didn't unpack the same way it packed");
|
||||
@@ -305,4 +306,4 @@ namespace OpenSim.Framework.Tests
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user