Adds support for preserving animations on region crossings and TPs.
Known issue: after TP, the self client doesn't see the animations going, but others can see them. So there's a bug there (TPs only, crossings seem to be all fine). Untested: did not test animation overriders; only tested playing animations from the viewer.0.6.3-post-fixes
parent
c381bee515
commit
3f25128e77
|
@ -54,36 +54,37 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChildAgentDataUpdate(AgentData agent)
|
//public ChildAgentDataUpdate(AgentData agent)
|
||||||
{
|
//{
|
||||||
ActiveGroupID = agent.ActiveGroupID.Guid;
|
// ActiveGroupID = agent.ActiveGroupID.Guid;
|
||||||
AgentID = agent.AgentID.Guid;
|
// AgentID = agent.AgentID.Guid;
|
||||||
alwaysrun = agent.AlwaysRun;
|
// alwaysrun = agent.AlwaysRun;
|
||||||
AVHeight = agent.Size.Z;
|
// AVHeight = agent.Size.Z;
|
||||||
cameraPosition = new sLLVector3(agent.Center);
|
// cameraPosition = new sLLVector3(agent.Center);
|
||||||
drawdistance = agent.Far;
|
// drawdistance = agent.Far;
|
||||||
godlevel = (float)agent.GodLevel;
|
// godlevel = (float)agent.GodLevel;
|
||||||
if (agent.Groups.Length > 0)
|
// if (agent.Groups.Length > 0)
|
||||||
GroupAccess = (uint)agent.Groups[0].GroupPowers;
|
// GroupAccess = (uint)agent.Groups[0].GroupPowers;
|
||||||
Position = new sLLVector3(agent.Position);
|
// Position = new sLLVector3(agent.Position);
|
||||||
regionHandle = agent.RegionHandle;
|
// regionHandle = agent.RegionHandle;
|
||||||
throttles = agent.Throttles;
|
// throttles = agent.Throttles;
|
||||||
Velocity = new sLLVector3(agent.Velocity);
|
// Velocity = new sLLVector3(agent.Velocity);
|
||||||
}
|
//}
|
||||||
|
|
||||||
public ChildAgentDataUpdate(AgentPosition agent)
|
//public ChildAgentDataUpdate(AgentPosition agent)
|
||||||
{
|
//{
|
||||||
AgentID = agent.AgentID.Guid;
|
// AgentID = agent.AgentID.Guid;
|
||||||
AVHeight = agent.Size.Z;
|
// AVHeight = agent.Size.Z;
|
||||||
cameraPosition = new sLLVector3(agent.Center);
|
// cameraPosition = new sLLVector3(agent.Center);
|
||||||
drawdistance = agent.Far;
|
// drawdistance = agent.Far;
|
||||||
Position = new sLLVector3(agent.Position);
|
// Position = new sLLVector3(agent.Position);
|
||||||
regionHandle = agent.RegionHandle;
|
// regionHandle = agent.RegionHandle;
|
||||||
throttles = agent.Throttles;
|
// throttles = agent.Throttles;
|
||||||
Velocity = new sLLVector3(agent.Velocity);
|
// Velocity = new sLLVector3(agent.Velocity);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public interface IAgentData
|
public interface IAgentData
|
||||||
{
|
{
|
||||||
UUID AgentID { get; set; }
|
UUID AgentID { get; set; }
|
||||||
|
@ -581,5 +582,6 @@ namespace OpenSim.Framework
|
||||||
System.Console.WriteLine("Position: " + Position);
|
System.Console.WriteLine("Position: " + Position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Xml;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
@ -69,6 +70,8 @@ namespace OpenSim
|
||||||
|
|
||||||
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", "Set local coordinate to map HG regions to", RunCommand);
|
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [<x> <y>] <cr>", "Set local coordinate to map HG regions to", RunCommand);
|
||||||
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", "Link a hypergrid region", RunCommand);
|
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", "Link a hypergrid region", RunCommand);
|
||||||
|
MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-URI", "link-URI <URL of xml files>", "ok", RunCommand);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder)
|
protected override void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder)
|
||||||
|
@ -144,6 +147,32 @@ namespace OpenSim
|
||||||
string command = cmdparams[0];
|
string command = cmdparams[0];
|
||||||
cmdparams.RemoveAt(0);
|
cmdparams.RemoveAt(0);
|
||||||
|
|
||||||
|
|
||||||
|
if (command.Equals("link-URI"))
|
||||||
|
{
|
||||||
|
|
||||||
|
if (cmdparams.Count > 1 | cmdparams.Count < 1)
|
||||||
|
{
|
||||||
|
m_log.Info("Invalid usage");
|
||||||
|
m_log.Info("link-URI <URL of xml files>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
m_log.Info(cmdparams[0].ToString());
|
||||||
|
|
||||||
|
LoadXmlLinkFile(cmdparams[0].ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (command.Equals("link-mapping"))
|
if (command.Equals("link-mapping"))
|
||||||
{
|
{
|
||||||
if (cmdparams.Count == 2)
|
if (cmdparams.Count == 2)
|
||||||
|
@ -233,6 +262,56 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LoadXmlLinkFile(string URI)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
//use http://www.hgurl.com/hypergrid.xml for test
|
||||||
|
|
||||||
|
RegionInfo RegInfo;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
XmlReader r = XmlReader.Create(URI);
|
||||||
|
XmlConfigSource reader = new XmlConfigSource(r);
|
||||||
|
|
||||||
|
|
||||||
|
for (int t = 0; t < reader.Configs.Count; t++)
|
||||||
|
{
|
||||||
|
|
||||||
|
m_log.Info(reader.Configs[t].Name);
|
||||||
|
m_log.Info(reader.Configs[t].Get("xloc").ToString());
|
||||||
|
string region_Name = reader.Configs[t].Name;
|
||||||
|
uint xloc = (uint)reader.Configs[t].GetInt("xloc");
|
||||||
|
uint yloc = (uint)reader.Configs[t].GetInt("yloc");
|
||||||
|
uint externalPort = (uint)reader.Configs[t].GetInt("externalPort");
|
||||||
|
string externalHostName = reader.Configs[t].Get("externalHostName");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HGHyperlink.TryCreateLink(m_sceneManager.CurrentOrFirstScene, null, xloc, yloc, region_Name, externalPort, externalHostName, out RegInfo);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
r.Close();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Info(e.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
private void LoadXmlLinkFile(string[] cmdparams)
|
private void LoadXmlLinkFile(string[] cmdparams)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Interfaces
|
namespace OpenSim.Region.Framework.Interfaces
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.StructuredData;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Scenes
|
namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
|
@ -62,5 +63,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
this.sequenceNum = sequenceNum;
|
this.sequenceNum = sequenceNum;
|
||||||
this.objectID = objectID;
|
this.objectID = objectID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Animation(OSDMap args)
|
||||||
|
{
|
||||||
|
UnpackUpdateMessage(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OSDMap PackUpdateMessage()
|
||||||
|
{
|
||||||
|
OSDMap anim = new OSDMap();
|
||||||
|
anim["animation"] = OSD.FromUUID(animID);
|
||||||
|
anim["object_id"] = OSD.FromUUID(objectID);
|
||||||
|
anim["seq_num"] = OSD.FromInteger(sequenceNum);
|
||||||
|
return anim;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UnpackUpdateMessage(OSDMap args)
|
||||||
|
{
|
||||||
|
if (args["animation"] != null)
|
||||||
|
animID = args["animation"].AsUUID();
|
||||||
|
if (args["object_id"] != null)
|
||||||
|
objectID = args["object_id"].AsUUID();
|
||||||
|
if (args["seq_num"] != null)
|
||||||
|
sequenceNum = args["seq_num"].AsInteger();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,5 +153,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Animation[] ToArray()
|
||||||
|
{
|
||||||
|
Animation[] theArray = new Animation[m_animations.Count];
|
||||||
|
uint i = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (Animation anim in m_animations)
|
||||||
|
theArray[i++] = anim;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
/* S%^t happens. Ignore. */
|
||||||
|
}
|
||||||
|
return theArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void FromArray(Animation[] theArray)
|
||||||
|
{
|
||||||
|
foreach (Animation anim in theArray)
|
||||||
|
m_animations.Add(anim);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,506 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSim Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.StructuredData;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.Framework.Scenes
|
||||||
|
{
|
||||||
|
public interface IAgentData
|
||||||
|
{
|
||||||
|
UUID AgentID { get; set; }
|
||||||
|
|
||||||
|
OSDMap PackUpdateMessage();
|
||||||
|
void UnpackUpdateMessage(OSDMap map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Replacement for ChildAgentDataUpdate. Used over RESTComms and LocalComms.
|
||||||
|
/// </summary>
|
||||||
|
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 SessionID;
|
||||||
|
|
||||||
|
public float Far;
|
||||||
|
public Vector3 Position;
|
||||||
|
public Vector3 Velocity;
|
||||||
|
public Vector3 Center;
|
||||||
|
public Vector3 Size;
|
||||||
|
public Vector3 AtAxis;
|
||||||
|
public Vector3 LeftAxis;
|
||||||
|
public Vector3 UpAxis;
|
||||||
|
public bool ChangedGrid;
|
||||||
|
|
||||||
|
// This probably shouldn't be here
|
||||||
|
public byte[] Throttles;
|
||||||
|
|
||||||
|
|
||||||
|
public OSDMap PackUpdateMessage()
|
||||||
|
{
|
||||||
|
OSDMap args = new OSDMap();
|
||||||
|
args["message_type"] = OSD.FromString("AgentPosition");
|
||||||
|
|
||||||
|
args["region_handle"] = OSD.FromString(RegionHandle.ToString());
|
||||||
|
args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
|
||||||
|
args["agent_uuid"] = OSD.FromUUID(AgentID);
|
||||||
|
args["session_uuid"] = OSD.FromUUID(SessionID);
|
||||||
|
|
||||||
|
args["position"] = OSD.FromString(Position.ToString());
|
||||||
|
args["velocity"] = OSD.FromString(Velocity.ToString());
|
||||||
|
args["center"] = OSD.FromString(Center.ToString());
|
||||||
|
args["size"] = OSD.FromString(Size.ToString());
|
||||||
|
args["at_axis"] = OSD.FromString(AtAxis.ToString());
|
||||||
|
args["left_axis"] = OSD.FromString(LeftAxis.ToString());
|
||||||
|
args["up_axis"] = OSD.FromString(UpAxis.ToString());
|
||||||
|
|
||||||
|
args["far"] = OSD.FromReal(Far);
|
||||||
|
args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
|
||||||
|
|
||||||
|
if ((Throttles != null) && (Throttles.Length > 0))
|
||||||
|
args["throttles"] = OSD.FromBinary(Throttles);
|
||||||
|
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UnpackUpdateMessage(OSDMap args)
|
||||||
|
{
|
||||||
|
if (args.ContainsKey("region_handle"))
|
||||||
|
UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
|
||||||
|
|
||||||
|
if (args["circuit_code"] != null)
|
||||||
|
UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode);
|
||||||
|
|
||||||
|
if (args["agent_uuid"] != null)
|
||||||
|
AgentID = args["agent_uuid"].AsUUID();
|
||||||
|
|
||||||
|
if (args["session_uuid"] != null)
|
||||||
|
SessionID = args["session_uuid"].AsUUID();
|
||||||
|
|
||||||
|
if (args["position"] != null)
|
||||||
|
Vector3.TryParse(args["position"].AsString(), out Position);
|
||||||
|
|
||||||
|
if (args["velocity"] != null)
|
||||||
|
Vector3.TryParse(args["velocity"].AsString(), out Velocity);
|
||||||
|
|
||||||
|
if (args["center"] != null)
|
||||||
|
Vector3.TryParse(args["center"].AsString(), out Center);
|
||||||
|
|
||||||
|
if (args["size"] != null)
|
||||||
|
Vector3.TryParse(args["size"].AsString(), out Size);
|
||||||
|
|
||||||
|
if (args["at_axis"] != null)
|
||||||
|
Vector3.TryParse(args["at_axis"].AsString(), out AtAxis);
|
||||||
|
|
||||||
|
if (args["left_axis"] != null)
|
||||||
|
Vector3.TryParse(args["left_axis"].AsString(), out AtAxis);
|
||||||
|
|
||||||
|
if (args["up_axis"] != null)
|
||||||
|
Vector3.TryParse(args["up_axis"].AsString(), out AtAxis);
|
||||||
|
|
||||||
|
if (args["changed_grid"] != null)
|
||||||
|
ChangedGrid = args["changed_grid"].AsBoolean();
|
||||||
|
|
||||||
|
if (args["far"] != null)
|
||||||
|
Far = (float)(args["far"].AsReal());
|
||||||
|
|
||||||
|
if (args["throttles"] != null)
|
||||||
|
Throttles = args["throttles"].AsBinary();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Soon to be decommissioned
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cAgent"></param>
|
||||||
|
public void CopyFrom(ChildAgentDataUpdate cAgent)
|
||||||
|
{
|
||||||
|
AgentID = new UUID(cAgent.AgentID);
|
||||||
|
|
||||||
|
// next: ???
|
||||||
|
Size = new Vector3();
|
||||||
|
Size.Z = cAgent.AVHeight;
|
||||||
|
|
||||||
|
Center = new Vector3(cAgent.cameraPosition.x, cAgent.cameraPosition.y, cAgent.cameraPosition.z);
|
||||||
|
Far = cAgent.drawdistance;
|
||||||
|
Position = new Vector3(cAgent.Position.x, cAgent.Position.y, cAgent.Position.z);
|
||||||
|
RegionHandle = cAgent.regionHandle;
|
||||||
|
Throttles = cAgent.throttles;
|
||||||
|
Velocity = new Vector3(cAgent.Velocity.x, cAgent.Velocity.y, cAgent.Velocity.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AgentGroupData
|
||||||
|
{
|
||||||
|
public UUID GroupID;
|
||||||
|
public ulong GroupPowers;
|
||||||
|
public bool AcceptNotices;
|
||||||
|
|
||||||
|
public AgentGroupData(UUID id, ulong powers, bool notices)
|
||||||
|
{
|
||||||
|
GroupID = id;
|
||||||
|
GroupPowers = powers;
|
||||||
|
AcceptNotices = notices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AgentGroupData(OSDMap args)
|
||||||
|
{
|
||||||
|
UnpackUpdateMessage(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OSDMap PackUpdateMessage()
|
||||||
|
{
|
||||||
|
OSDMap groupdata = new OSDMap();
|
||||||
|
groupdata["group_id"] = OSD.FromUUID(GroupID);
|
||||||
|
groupdata["group_powers"] = OSD.FromString(GroupPowers.ToString());
|
||||||
|
groupdata["accept_notices"] = OSD.FromBoolean(AcceptNotices);
|
||||||
|
|
||||||
|
return groupdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UnpackUpdateMessage(OSDMap args)
|
||||||
|
{
|
||||||
|
if (args["group_id"] != null)
|
||||||
|
GroupID = args["group_id"].AsUUID();
|
||||||
|
if (args["group_powers"] != null)
|
||||||
|
UInt64.TryParse((string)args["group_powers"].AsString(), out GroupPowers);
|
||||||
|
if (args["accept_notices"] != null)
|
||||||
|
AcceptNotices = args["accept_notices"].AsBoolean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//public class AgentAnimationData
|
||||||
|
//{
|
||||||
|
// public UUID Animation;
|
||||||
|
// public UUID ObjectID;
|
||||||
|
|
||||||
|
// public AgentAnimationData(UUID anim, UUID obj)
|
||||||
|
// {
|
||||||
|
// Animation = anim;
|
||||||
|
// ObjectID = obj;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public AgentAnimationData(OSDMap args)
|
||||||
|
// {
|
||||||
|
// UnpackUpdateMessage(args);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public OSDMap PackUpdateMessage()
|
||||||
|
// {
|
||||||
|
// OSDMap anim = new OSDMap();
|
||||||
|
// anim["animation"] = OSD.FromUUID(Animation);
|
||||||
|
// anim["object_id"] = OSD.FromUUID(ObjectID);
|
||||||
|
// return anim;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public void UnpackUpdateMessage(OSDMap args)
|
||||||
|
// {
|
||||||
|
// if (args["animation"] != null)
|
||||||
|
// Animation = args["animation"].AsUUID();
|
||||||
|
// if (args["object_id"] != null)
|
||||||
|
// ObjectID = args["object_id"].AsUUID();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
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 SessionID;
|
||||||
|
|
||||||
|
public Vector3 Position;
|
||||||
|
public Vector3 Velocity;
|
||||||
|
public Vector3 Center;
|
||||||
|
public Vector3 Size;
|
||||||
|
public Vector3 AtAxis;
|
||||||
|
public Vector3 LeftAxis;
|
||||||
|
public Vector3 UpAxis;
|
||||||
|
public bool ChangedGrid;
|
||||||
|
|
||||||
|
public float Far;
|
||||||
|
public float Aspect;
|
||||||
|
//public int[] Throttles;
|
||||||
|
public byte[] Throttles;
|
||||||
|
|
||||||
|
public uint LocomotionState;
|
||||||
|
public Quaternion HeadRotation;
|
||||||
|
public Quaternion BodyRotation;
|
||||||
|
public uint ControlFlags;
|
||||||
|
public float EnergyLevel;
|
||||||
|
public Byte GodLevel;
|
||||||
|
public bool AlwaysRun;
|
||||||
|
public UUID PreyAgent;
|
||||||
|
public Byte AgentAccess;
|
||||||
|
public UUID[] AgentTextures;
|
||||||
|
public UUID ActiveGroupID;
|
||||||
|
|
||||||
|
public AgentGroupData[] Groups;
|
||||||
|
public Animation[] Anims;
|
||||||
|
|
||||||
|
public UUID GranterID;
|
||||||
|
public Dictionary<string, string> NVPairs;
|
||||||
|
|
||||||
|
public byte[] VisualParams;
|
||||||
|
|
||||||
|
public string CallbackURI;
|
||||||
|
|
||||||
|
public OSDMap PackUpdateMessage()
|
||||||
|
{
|
||||||
|
OSDMap args = new OSDMap();
|
||||||
|
args["message_type"] = OSD.FromString("AgentData");
|
||||||
|
|
||||||
|
args["region_handle"] = OSD.FromString(RegionHandle.ToString());
|
||||||
|
args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
|
||||||
|
args["agent_uuid"] = OSD.FromUUID(AgentID);
|
||||||
|
args["session_uuid"] = OSD.FromUUID(SessionID);
|
||||||
|
|
||||||
|
args["position"] = OSD.FromString(Position.ToString());
|
||||||
|
args["velocity"] = OSD.FromString(Velocity.ToString());
|
||||||
|
args["center"] = OSD.FromString(Center.ToString());
|
||||||
|
args["size"] = OSD.FromString(Size.ToString());
|
||||||
|
args["at_axis"] = OSD.FromString(AtAxis.ToString());
|
||||||
|
args["left_axis"] = OSD.FromString(LeftAxis.ToString());
|
||||||
|
args["up_axis"] = OSD.FromString(UpAxis.ToString());
|
||||||
|
|
||||||
|
args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
|
||||||
|
args["far"] = OSD.FromReal(Far);
|
||||||
|
args["aspect"] = OSD.FromReal(Aspect);
|
||||||
|
|
||||||
|
if ((Throttles != null) && (Throttles.Length > 0))
|
||||||
|
args["throttles"] = OSD.FromBinary(Throttles);
|
||||||
|
|
||||||
|
args["locomotion_state"] = OSD.FromString(LocomotionState.ToString());
|
||||||
|
args["head_rotation"] = OSD.FromString(HeadRotation.ToString());
|
||||||
|
args["body_rotation"] = OSD.FromString(BodyRotation.ToString());
|
||||||
|
args["control_flags"] = OSD.FromString(ControlFlags.ToString());
|
||||||
|
|
||||||
|
args["energy_level"] = OSD.FromReal(EnergyLevel);
|
||||||
|
args["god_level"] = OSD.FromString(GodLevel.ToString());
|
||||||
|
args["always_run"] = OSD.FromBoolean(AlwaysRun);
|
||||||
|
args["prey_agent"] = OSD.FromUUID(PreyAgent);
|
||||||
|
args["agent_access"] = OSD.FromString(AgentAccess.ToString());
|
||||||
|
|
||||||
|
if ((AgentTextures != null) && (AgentTextures.Length > 0))
|
||||||
|
{
|
||||||
|
OSDArray textures = new OSDArray(AgentTextures.Length);
|
||||||
|
foreach (UUID uuid in AgentTextures)
|
||||||
|
textures.Add(OSD.FromUUID(uuid));
|
||||||
|
args["agent_textures"] = textures;
|
||||||
|
}
|
||||||
|
|
||||||
|
args["active_group_id"] = OSD.FromUUID(ActiveGroupID);
|
||||||
|
|
||||||
|
if ((Groups != null) && (Groups.Length > 0))
|
||||||
|
{
|
||||||
|
OSDArray groups = new OSDArray(Groups.Length);
|
||||||
|
foreach (AgentGroupData agd in Groups)
|
||||||
|
groups.Add(agd.PackUpdateMessage());
|
||||||
|
args["groups"] = groups;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((Anims != null) && (Anims.Length > 0))
|
||||||
|
{
|
||||||
|
OSDArray anims = new OSDArray(Anims.Length);
|
||||||
|
foreach (Animation aanim in Anims)
|
||||||
|
anims.Add(aanim.PackUpdateMessage());
|
||||||
|
args["animations"] = anims;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((VisualParams != null) && (VisualParams.Length > 0))
|
||||||
|
args["visual_params"] = OSD.FromBinary(VisualParams);
|
||||||
|
|
||||||
|
// Last few fields are still missing: granter and NVPais
|
||||||
|
|
||||||
|
if ((CallbackURI != null) && (!CallbackURI.Equals("")))
|
||||||
|
args["callback_uri"] = OSD.FromString(CallbackURI);
|
||||||
|
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deserialization of agent data.
|
||||||
|
/// Avoiding reflection makes it painful to write, but that's the price!
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hash"></param>
|
||||||
|
public void UnpackUpdateMessage(OSDMap args)
|
||||||
|
{
|
||||||
|
if (args.ContainsKey("region_handle"))
|
||||||
|
UInt64.TryParse(args["region_handle"].AsString(), out RegionHandle);
|
||||||
|
|
||||||
|
if (args["circuit_code"] != null)
|
||||||
|
UInt32.TryParse((string)args["circuit_code"].AsString(), out CircuitCode);
|
||||||
|
|
||||||
|
if (args["agent_uuid"] != null)
|
||||||
|
AgentID = args["agent_uuid"].AsUUID();
|
||||||
|
|
||||||
|
if (args["session_uuid"] != null)
|
||||||
|
SessionID = args["session_uuid"].AsUUID();
|
||||||
|
|
||||||
|
if (args["position"] != null)
|
||||||
|
Vector3.TryParse(args["position"].AsString(), out Position);
|
||||||
|
|
||||||
|
if (args["velocity"] != null)
|
||||||
|
Vector3.TryParse(args["velocity"].AsString(), out Velocity);
|
||||||
|
|
||||||
|
if (args["center"] != null)
|
||||||
|
Vector3.TryParse(args["center"].AsString(), out Center);
|
||||||
|
|
||||||
|
if (args["size"] != null)
|
||||||
|
Vector3.TryParse(args["size"].AsString(), out Size);
|
||||||
|
|
||||||
|
if (args["at_axis"] != null)
|
||||||
|
Vector3.TryParse(args["at_axis"].AsString(), out AtAxis);
|
||||||
|
|
||||||
|
if (args["left_axis"] != null)
|
||||||
|
Vector3.TryParse(args["left_axis"].AsString(), out AtAxis);
|
||||||
|
|
||||||
|
if (args["up_axis"] != null)
|
||||||
|
Vector3.TryParse(args["up_axis"].AsString(), out AtAxis);
|
||||||
|
|
||||||
|
if (args["changed_grid"] != null)
|
||||||
|
ChangedGrid = args["changed_grid"].AsBoolean();
|
||||||
|
|
||||||
|
if (args["far"] != null)
|
||||||
|
Far = (float)(args["far"].AsReal());
|
||||||
|
|
||||||
|
if (args["aspect"] != null)
|
||||||
|
Aspect = (float)args["aspect"].AsReal();
|
||||||
|
|
||||||
|
if (args["throttles"] != null)
|
||||||
|
Throttles = args["throttles"].AsBinary();
|
||||||
|
|
||||||
|
if (args["locomotion_state"] != null)
|
||||||
|
UInt32.TryParse(args["locomotion_state"].AsString(), out LocomotionState);
|
||||||
|
|
||||||
|
if (args["head_rotation"] != null)
|
||||||
|
Quaternion.TryParse(args["head_rotation"].AsString(), out HeadRotation);
|
||||||
|
|
||||||
|
if (args["body_rotation"] != null)
|
||||||
|
Quaternion.TryParse(args["body_rotation"].AsString(), out BodyRotation);
|
||||||
|
|
||||||
|
if (args["control_flags"] != null)
|
||||||
|
UInt32.TryParse(args["control_flags"].AsString(), out ControlFlags);
|
||||||
|
|
||||||
|
if (args["energy_level"] != null)
|
||||||
|
EnergyLevel = (float)(args["energy_level"].AsReal());
|
||||||
|
|
||||||
|
if (args["god_level"] != null)
|
||||||
|
Byte.TryParse(args["god_level"].AsString(), out GodLevel);
|
||||||
|
|
||||||
|
if (args["always_run"] != null)
|
||||||
|
AlwaysRun = args["always_run"].AsBoolean();
|
||||||
|
|
||||||
|
if (args["prey_agent"] != null)
|
||||||
|
PreyAgent = args["prey_agent"].AsUUID();
|
||||||
|
|
||||||
|
if (args["agent_access"] != null)
|
||||||
|
Byte.TryParse(args["agent_access"].AsString(), out AgentAccess);
|
||||||
|
|
||||||
|
if ((args["agent_textures"] != null) && (args["agent_textures"]).Type == OSDType.Array)
|
||||||
|
{
|
||||||
|
OSDArray textures = (OSDArray)(args["agent_textures"]);
|
||||||
|
AgentTextures = new UUID[textures.Count];
|
||||||
|
int i = 0;
|
||||||
|
foreach (OSD o in textures)
|
||||||
|
AgentTextures[i++] = o.AsUUID();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args["active_group_id"] != null)
|
||||||
|
ActiveGroupID = args["active_group_id"].AsUUID();
|
||||||
|
|
||||||
|
if ((args["groups"] != null) && (args["groups"]).Type == OSDType.Array)
|
||||||
|
{
|
||||||
|
OSDArray groups = (OSDArray)(args["groups"]);
|
||||||
|
Groups = new AgentGroupData[groups.Count];
|
||||||
|
int i = 0;
|
||||||
|
foreach (OSD o in groups)
|
||||||
|
{
|
||||||
|
if (o.Type == OSDType.Map)
|
||||||
|
{
|
||||||
|
Groups[i++] = new AgentGroupData((OSDMap)o);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((args["animations"] != null) && (args["animations"]).Type == OSDType.Array)
|
||||||
|
{
|
||||||
|
OSDArray anims = (OSDArray)(args["animations"]);
|
||||||
|
Anims = new Animation[anims.Count];
|
||||||
|
int i = 0;
|
||||||
|
foreach (OSD o in anims)
|
||||||
|
{
|
||||||
|
if (o.Type == OSDType.Map)
|
||||||
|
{
|
||||||
|
Anims[i++] = new Animation((OSDMap)o);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args["visual_params"] != null)
|
||||||
|
VisualParams = args["visual_params"].AsBinary();
|
||||||
|
|
||||||
|
if (args["callback_uri"] != null)
|
||||||
|
CallbackURI = args["callback_uri"].AsString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AgentData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public AgentData(Hashtable hash)
|
||||||
|
{
|
||||||
|
//UnpackUpdateMessage(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dump()
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("------------ AgentData ------------");
|
||||||
|
System.Console.WriteLine("UUID: " + AgentID);
|
||||||
|
System.Console.WriteLine("Region: " + RegionHandle);
|
||||||
|
System.Console.WriteLine("Position: " + Position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -904,6 +904,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
avatar.Close();
|
avatar.Close();
|
||||||
CloseConnection(avatar.UUID);
|
CloseConnection(avatar.UUID);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
// now we have a child agent in this region.
|
||||||
|
avatar.Reset();
|
||||||
|
|
||||||
|
|
||||||
// if (teleport success) // seems to be always success here
|
// if (teleport success) // seems to be always success here
|
||||||
// the user may change their profile information in other region,
|
// the user may change their profile information in other region,
|
||||||
|
@ -1180,8 +1184,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// If the cross was successful, this agent is a child agent
|
// If the cross was successful, this agent is a child agent
|
||||||
if (agent.IsChildAgent)
|
if (agent.IsChildAgent)
|
||||||
{
|
{
|
||||||
// Put the child agent back at the center
|
agent.Reset();
|
||||||
agent.AbsolutePosition = new Vector3(128, 128, 70);
|
|
||||||
}
|
}
|
||||||
else // Not successful
|
else // Not successful
|
||||||
{
|
{
|
||||||
|
|
|
@ -1049,7 +1049,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
|
m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
|
||||||
|
|
||||||
SendInitialData();
|
SendInitialData();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1760,11 +1759,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_animations.Add(animID, m_controllingClient.NextAnimationSequenceNumber, objectID))
|
if (m_animations.Add(animID, m_controllingClient.NextAnimationSequenceNumber, objectID))
|
||||||
{
|
|
||||||
SendAnimPack();
|
SendAnimPack();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// Called from scripts
|
||||||
public void AddAnimation(string name, UUID objectID)
|
public void AddAnimation(string name, UUID objectID)
|
||||||
{
|
{
|
||||||
if (m_isChildAgent)
|
if (m_isChildAgent)
|
||||||
|
@ -1783,11 +1781,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_animations.Remove(animID))
|
if (m_animations.Remove(animID))
|
||||||
{
|
|
||||||
SendAnimPack();
|
SendAnimPack();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// Called from scripts
|
||||||
public void RemoveAnimation(string name)
|
public void RemoveAnimation(string name)
|
||||||
{
|
{
|
||||||
if (m_isChildAgent)
|
if (m_isChildAgent)
|
||||||
|
@ -2152,6 +2149,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
m_scene.AddAgentUpdates(avatars.Count);
|
m_scene.AddAgentUpdates(avatars.Count);
|
||||||
m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS);
|
m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS);
|
||||||
|
|
||||||
|
//SendAnimPack();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendFullUpdateToAllClients()
|
public void SendFullUpdateToAllClients()
|
||||||
|
@ -2256,7 +2255,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance);
|
m_scene.CommsManager.AvatarService.UpdateUserAppearance(m_controllingClient.AgentId, m_appearance);
|
||||||
|
|
||||||
SendAppearanceToAllOtherAgents();
|
SendAppearanceToAllOtherAgents();
|
||||||
//SendWearables();
|
|
||||||
if (!m_startAnimationSet)
|
if (!m_startAnimationSet)
|
||||||
{
|
{
|
||||||
UpdateMovementAnimations();
|
UpdateMovementAnimations();
|
||||||
|
@ -2312,7 +2310,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendAnimPack()
|
public void SendAnimPack()
|
||||||
{
|
{
|
||||||
//m_log.Debug("Sending animation pack");
|
//m_log.Debug("Sending animation pack to all");
|
||||||
|
|
||||||
if (m_isChildAgent)
|
if (m_isChildAgent)
|
||||||
return;
|
return;
|
||||||
|
@ -2326,6 +2324,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SendAnimPack(animIDs, sequenceNums, objectIDs);
|
SendAnimPack(animIDs, sequenceNums, objectIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Significant Movement Method
|
#region Significant Movement Method
|
||||||
|
@ -2454,6 +2453,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
AddToPhysicalScene(false); // not exactly false
|
AddToPhysicalScene(false); // not exactly false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
// Put the child agent back at the center
|
||||||
|
AbsolutePosition = new Vector3(128, 128, 70);
|
||||||
|
m_animations.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Computes which child agents to close when the scene presence moves to another region.
|
/// Computes which child agents to close when the scene presence moves to another region.
|
||||||
/// Removes those regions from m_knownRegions.
|
/// Removes those regions from m_knownRegions.
|
||||||
|
@ -2618,11 +2624,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
cAgent.AlwaysRun = m_setAlwaysRun;
|
cAgent.AlwaysRun = m_setAlwaysRun;
|
||||||
|
|
||||||
//cAgent.GroupID = ??
|
|
||||||
// Groups???
|
|
||||||
|
|
||||||
// Animations???
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -2644,10 +2645,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message);
|
m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message);
|
||||||
}
|
}
|
||||||
//cAgent.GroupID = ??
|
|
||||||
// Groups???
|
|
||||||
|
|
||||||
// Animations???
|
// Animations
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cAgent.Anims = m_animations.ToArray();
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
// cAgent.GroupID = ??
|
||||||
|
// Groups???
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2697,10 +2704,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message);
|
m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Animations
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_animations.Clear();
|
||||||
|
m_animations.FromArray(cAgent.Anims);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
//cAgent.GroupID = ??
|
//cAgent.GroupID = ??
|
||||||
//Groups???
|
//Groups???
|
||||||
|
|
||||||
// Animations???
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue