Updates to LibSL revision 1498. Thanks Johan!

afrisby
Adam Johnson 2007-12-07 08:54:31 +00:00
parent 57f666497b
commit 3d938f76b7
14 changed files with 63 additions and 56 deletions

View File

@ -258,7 +258,7 @@ namespace OpenSim.Region.Capabilities
/// <returns></returns>
public string NoteCardAgentInventory(string request, string path, string param)
{
Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(Helpers.StringToField(request));
libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)libsecondlife.StructuredData.LLSDParser.DeserializeBinary(Helpers.StringToField(request));
LLSDItemUpdate llsdRequest = new LLSDItemUpdate();
LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);

View File

@ -48,7 +48,7 @@ namespace OpenSim.Region.Capabilities
return sw.ToString();
}
public static void SerializeLLSDType(XmlTextWriter writer, object obj)
private static void SerializeLLSDType(XmlTextWriter writer, object obj)
{
Type myType = obj.GetType();
LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
@ -76,7 +76,8 @@ namespace OpenSim.Region.Capabilities
writer.WriteStartElement(String.Empty, "key", String.Empty);
writer.WriteString(fields[i].Name);
writer.WriteEndElement();
LLSD.LLSDWriteOne(writer, fieldValue);
libsecondlife.StructuredData.LLSDParser.SerializeXmlElement(
writer, libsecondlife.StructuredData.LLSD.FromObject(fieldValue));
}
}
writer.WriteEndElement();
@ -99,11 +100,12 @@ namespace OpenSim.Region.Capabilities
}
else
{
LLSD.LLSDWriteOne(writer, obj);
libsecondlife.StructuredData.LLSDParser.SerializeXmlElement(
writer, libsecondlife.StructuredData.LLSD.FromObject(obj));
}
}
public static object DeserialiseLLSDMap(Hashtable llsd, object obj)
public static object DeserialiseLLSDMap(libsecondlife.StructuredData.LLSDMap llsd, object obj)
{
Type myType = obj.GetType();
LLSDType[] llsdattributes = (LLSDType[]) myType.GetCustomAttributes(typeof (LLSDType), false);
@ -118,10 +120,10 @@ namespace OpenSim.Region.Capabilities
FieldInfo field = myType.GetField((string) enumerator.Key);
if (field != null)
{
if (enumerator.Value is Hashtable)
if (enumerator.Value is libsecondlife.StructuredData.LLSDMap)
{
object fieldValue = field.GetValue(obj);
DeserialiseLLSDMap((Hashtable) enumerator.Value, fieldValue);
DeserialiseLLSDMap((libsecondlife.StructuredData.LLSDMap) enumerator.Value, fieldValue);
}
else if (enumerator.Value is ArrayList)
{
@ -143,4 +145,4 @@ namespace OpenSim.Region.Capabilities
return obj;
}
}
}
}

View File

@ -31,6 +31,7 @@ using System.IO;
using System.Text;
using libsecondlife;
using OpenSim.Framework.Servers;
using System.Xml;
namespace OpenSim.Region.Capabilities
{
@ -53,7 +54,8 @@ namespace OpenSim.Region.Capabilities
//string requestBody = streamReader.ReadToEnd();
//streamReader.Close();
Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)
libsecondlife.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request));
TRequest llsdRequest = new TRequest();
LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
@ -64,4 +66,4 @@ namespace OpenSim.Region.Capabilities
return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response));
}
}
}
}

View File

@ -46,6 +46,12 @@ namespace OpenSim.Framework
private static object XferLock = new object();
private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>();
public static double GetDistanceTo(LLVector3 a, LLVector3 b) {
float dx = a.X - b.X;
float dy = a.Y - b.Y;
float dz = a.Z - b.Z;
return Math.Sqrt(dx * dx + dy * dy + dz * dz);
}
public static ulong UIntsToLong(uint X, uint Y)
{

View File

@ -722,9 +722,11 @@ namespace OpenSim.Region.ClientStack
///
/// </summary>
/// <param name="regInfo"></param>
private byte[] m_channelVersion=new byte[] { 0x00} ; // Dummy value needed by libSL
public void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look)
{
AgentMovementCompletePacket mov = new AgentMovementCompletePacket();
mov.SimData.ChannelVersion = m_channelVersion;
mov.AgentData.SessionID = m_sessionId;
mov.AgentData.AgentID = AgentId;
mov.Data.RegionHandle = regInfo.RegionHandle;
@ -1170,15 +1172,13 @@ namespace OpenSim.Region.ClientStack
inventoryReply.InventoryData[0].SaleType = 0;
inventoryReply.InventoryData[0].Type = (sbyte) item.assetType;
inventoryReply.InventoryData[0].CRC =
Helpers.InventoryCRC(inventoryReply.InventoryData[0].CreationDate, inventoryReply.InventoryData[0].SaleType,
inventoryReply.InventoryData[0].InvType,
Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType,
inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID,
inventoryReply.InventoryData[0].GroupID, inventoryReply.InventoryData[0].SalePrice,
inventoryReply.InventoryData[0].GroupID, 100,
inventoryReply.InventoryData[0].OwnerID, inventoryReply.InventoryData[0].CreatorID,
inventoryReply.InventoryData[0].ItemID, inventoryReply.InventoryData[0].FolderID,
inventoryReply.InventoryData[0].EveryoneMask, inventoryReply.InventoryData[0].Flags,
inventoryReply.InventoryData[0].NextOwnerMask, inventoryReply.InventoryData[0].GroupMask,
inventoryReply.InventoryData[0].OwnerMask);
FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS,
FULL_MASK_PERMISSIONS);
OutPacket(inventoryReply, ThrottleOutPacketType.Asset);
}
@ -1213,16 +1213,13 @@ namespace OpenSim.Region.ClientStack
InventoryReply.InventoryData[0].SaleType = 0;
InventoryReply.InventoryData[0].Type = (sbyte) Item.assetType;
InventoryReply.InventoryData[0].CRC =
Helpers.InventoryCRC(InventoryReply.InventoryData[0].CreationDate, InventoryReply.InventoryData[0].SaleType,
InventoryReply.InventoryData[0].InvType,
Helpers.InventoryCRC(1000, 0, InventoryReply.InventoryData[0].InvType,
InventoryReply.InventoryData[0].Type, InventoryReply.InventoryData[0].AssetID,
InventoryReply.InventoryData[0].GroupID, InventoryReply.InventoryData[0].SalePrice,
InventoryReply.InventoryData[0].GroupID, 100,
InventoryReply.InventoryData[0].OwnerID, InventoryReply.InventoryData[0].CreatorID,
InventoryReply.InventoryData[0].ItemID, InventoryReply.InventoryData[0].FolderID,
InventoryReply.InventoryData[0].EveryoneMask, InventoryReply.InventoryData[0].Flags,
InventoryReply.InventoryData[0].NextOwnerMask, InventoryReply.InventoryData[0].GroupMask,
InventoryReply.InventoryData[0].OwnerMask);
FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS,
FULL_MASK_PERMISSIONS);
OutPacket(InventoryReply, ThrottleOutPacketType.Asset);
}
@ -1602,7 +1599,6 @@ namespace OpenSim.Region.ClientStack
outPacket.ObjectData[0].ClickAction = clickAction;
//outPacket.ObjectData[0].Flags = 0;
outPacket.ObjectData[0].Radius = 20;
byte[] pb = pos.GetBytes();
Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
@ -2904,7 +2900,7 @@ namespace OpenSim.Region.ClientStack
{
if (OnObjectDescription != null)
{
OnObjectDescription(this,objDes.ObjectData[i].LocalID,
OnObjectDescription(this, objDes.ObjectData[i].LocalID,
enc.GetString(objDes.ObjectData[i].Description));
}
}
@ -2915,7 +2911,7 @@ namespace OpenSim.Region.ClientStack
{
if (OnObjectName != null)
{
OnObjectName(this,objName.ObjectData[i].LocalID, enc.GetString(objName.ObjectData[i].Name));
OnObjectName(this, objName.ObjectData[i].LocalID, enc.GetString(objName.ObjectData[i].Name));
}
}
break;
@ -3003,7 +2999,8 @@ namespace OpenSim.Region.ClientStack
// Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionId).ToStringHyphenated());
if (OnAssetUploadRequest != null)
{
OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(SecureSessionId),
LLUUID temp=libsecondlife.LLUUID.Combine(request.AssetBlock.TransactionID, SecureSessionId);
OnAssetUploadRequest(this, temp,
request.AssetBlock.TransactionID, request.AssetBlock.Type,
request.AssetBlock.AssetData, request.AssetBlock.StoreLocal);
}

View File

@ -192,7 +192,7 @@ namespace OpenSim.Region.Environment.Modules
scene.RegionInfo.RegionLocY * 256,
0);
dis =
Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos));
Math.Abs((int) Util.GetDistanceTo(avatarRegionPos, fromRegionPos));
switch (e.Type)
{

View File

@ -135,7 +135,7 @@ namespace OpenSim.Region.Environment.Modules
{
m_listenerManager.Remove(handle);
}
// This method scans nearby objects and determines if they are listeners,
// and if so if this message fits the filter. If it does, then
// enqueue the message for delivery to the objects listen event handler.
@ -171,9 +171,9 @@ namespace OpenSim.Region.Environment.Modules
double dis = 0;
if (source != null)
dis = sPart.AbsolutePosition.GetDistanceTo(source.AbsolutePosition);
dis = Util.GetDistanceTo(sPart.AbsolutePosition, source.AbsolutePosition);
else
dis = sPart.AbsolutePosition.GetDistanceTo(avatar.AbsolutePosition);
dis = Util.GetDistanceTo(sPart.AbsolutePosition, avatar.AbsolutePosition);
switch (type)
{
@ -490,4 +490,4 @@ namespace OpenSim.Region.Environment.Modules
return m_id;
}
}
}
}

View File

@ -144,7 +144,7 @@ namespace OpenSim.Region.Environment.Scenes
if (transactions != null)
{
LLUUID assetID = transactionID.Combine(remoteClient.SecureSessionId);
LLUUID assetID = libsecondlife.LLUUID.Combine(transactionID, remoteClient.SecureSessionId);
AssetBase asset = AssetCache.GetAsset(assetID);
if (asset == null)
@ -432,7 +432,7 @@ namespace OpenSim.Region.Environment.Scenes
((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId),
((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId),
(sbyte) InventoryType.Object,
(sbyte) AssetType.Object, // TODO: after libSL r1357, this becomes AssetType.Primitive
(sbyte) AssetType.Primitive,
Helpers.StringToField(sceneObjectXml));
AssetCache.AddAsset(asset);

View File

@ -675,7 +675,7 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
public override void Update()
{
if (lastPhysGroupPos.GetDistanceTo(AbsolutePosition) > 0.02)
if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02)
{
foreach (SceneObjectPart part in m_parts.Values)
{

View File

@ -749,7 +749,7 @@ namespace OpenSim.Region.Environment.Scenes
LLVector3 distanceConvert1 = new LLVector3(iray.Origin.x, iray.Origin.y, iray.Origin.z);
LLVector3 distanceConvert2 = new LLVector3(ipoint.x, ipoint.y, ipoint.z);
float distance = (float)distanceConvert1.GetDistanceTo(distanceConvert2);
float distance = (float)Util.GetDistanceTo(distanceConvert1, distanceConvert2);
returnresult.distance = distance;

View File

@ -93,12 +93,12 @@ namespace OpenSim.Region.Environment.Scenes
private enum Dir_ControlFlags
{
DIR_CONTROL_FLAG_FOWARD = MainAvatar.ControlFlags.AGENT_CONTROL_AT_POS,
DIR_CONTROL_FLAG_BACK = MainAvatar.ControlFlags.AGENT_CONTROL_AT_NEG,
DIR_CONTROL_FLAG_LEFT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_POS,
DIR_CONTROL_FLAG_RIGHT = MainAvatar.ControlFlags.AGENT_CONTROL_LEFT_NEG,
DIR_CONTROL_FLAG_UP = MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS,
DIR_CONTROL_FLAG_DOWN = MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG
DIR_CONTROL_FLAG_FOWARD = AgentManager.ControlFlags.AGENT_CONTROL_AT_POS,
DIR_CONTROL_FLAG_BACK = AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG,
DIR_CONTROL_FLAG_LEFT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS,
DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG,
DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS,
DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG
}
/// <summary>
@ -609,7 +609,7 @@ namespace OpenSim.Region.Environment.Scenes
//MainLog.Instance.Verbose("CAMERA", "AtAxis:" + m_CameraAtAxis.ToString() + " Center:" + m_CameraCenter.ToString() + " LeftAxis:" + m_CameraLeftAxis.ToString() + " UpAxis:" + m_CameraUpAxis.ToString() + " Far:" + m_CameraFar);
if ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
{
StandUp();
}
@ -630,7 +630,7 @@ namespace OpenSim.Region.Environment.Scenes
Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
bool oldflying = PhysicsActor.Flying;
PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
PhysicsActor.Flying = ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
if (PhysicsActor.Flying != oldflying)
{
update_movementflag = true;
@ -796,7 +796,7 @@ namespace OpenSim.Region.Environment.Scenes
}
else
{
if (((m_movementflag & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
PhysicsActor.IsColliding)
{
SendAnimPack(Animations.AnimsLLUUID["CROUCHWALK"], 1);
@ -807,7 +807,7 @@ namespace OpenSim.Region.Environment.Scenes
{
SendAnimPack(Animations.AnimsLLUUID["FALLDOWN"], 1);
}
else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && (m_movementflag & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
{
SendAnimPack(Animations.AnimsLLUUID["JUMP"], 1);
}
@ -839,7 +839,7 @@ namespace OpenSim.Region.Environment.Scenes
}
else
{
if (((m_movementflag & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) &&
PhysicsActor.IsColliding)
{
SendAnimPack(Animations.AnimsLLUUID["CROUCH"], 1);
@ -854,7 +854,7 @@ namespace OpenSim.Region.Environment.Scenes
{
SendAnimPack(Animations.AnimsLLUUID["FALLDOWN"], 1);
}
else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying && (m_movementflag & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying && (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0)
{
SendAnimPack(Animations.AnimsLLUUID["JUMP"], 1);
}
@ -955,7 +955,7 @@ namespace OpenSim.Region.Environment.Scenes
m_updateCount = 0;
}
}
else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02) // physics-related movement
else if (Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) // physics-related movement
{
SendTerseUpdateToAllClients();
m_updateCount = 0;
@ -1123,7 +1123,7 @@ namespace OpenSim.Region.Environment.Scenes
protected void CheckForSignificantMovement()
{
if (AbsolutePosition.GetDistanceTo(posLastSignificantMove) > 0.02)
if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > 0.02)
{
posLastSignificantMove = AbsolutePosition;
if (OnSignificantClientMovement != null)

View File

@ -384,19 +384,19 @@ namespace SimpleApp
}
if (flyState == 0)
{
movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY |
(uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG;
movementFlag = (uint) AgentManager.ControlFlags.AGENT_CONTROL_FLY |
(uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG;
flyState = 1;
}
else if (flyState == 1)
{
movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY |
(uint) MainAvatar.ControlFlags.AGENT_CONTROL_UP_POS;
movementFlag = (uint) AgentManager.ControlFlags.AGENT_CONTROL_FLY |
(uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS;
flyState = 2;
}
else
{
movementFlag = (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY;
movementFlag = (uint) AgentManager.ControlFlags.AGENT_CONTROL_FLY;
flyState = 0;
}

Binary file not shown.

Binary file not shown.