* Rex merge, Attachments and terrain fix.

0.6b-realxtend
mikkopa 2008-02-25 05:57:50 +00:00
parent 24e3c71111
commit 77d3e6f51e
7 changed files with 311 additions and 36 deletions

View File

@ -234,10 +234,11 @@ namespace OpenSim.Framework
uint EveryoneMask, uint GroupMask, uint NextOwnerMask, uint ItemFlags,
bool RezSelected, bool RemoveItem, LLUUID fromTaskID );
public delegate void RezSingleAttachmentFromInv(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt,
uint ItemFlags, uint NextOwnerMask);
public delegate void ObjectAttach(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, LLQuaternion rot);
//Attachments
public delegate void RezSingleAttachmentFromInv(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID,
uint itemFlags, byte attachPoint);
public delegate void ObjectAttach(IClientAPI remoteClient, uint localID, LLQuaternion rotation, byte attachPoint);
public delegate void ObjectDetach(IClientAPI remoteClient, uint localID);
public delegate void ModifyTerrain(
float height, float seconds, byte size, byte action, float north, float west, float south, float east,
@ -419,6 +420,9 @@ namespace OpenSim.Framework
public delegate void ObjectPermissions(IClientAPI controller, LLUUID agentID, LLUUID sessionID, byte field, uint localId, uint mask, byte set);
public interface IClientAPI
{
event ImprovedInstantMessage OnInstantMessage;
@ -428,8 +432,6 @@ namespace OpenSim.Framework
event ModifyTerrain OnModifyTerrain;
event SetAppearance OnSetAppearance;
event AvatarNowWearing OnAvatarNowWearing;
event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
event ObjectAttach OnObjectAttach;
event StartAnim OnStartAnim;
event StopAnim OnStopAnim;
event LinkObjects OnLinkObjects;
@ -500,6 +502,10 @@ namespace OpenSim.Framework
event UpdateTaskInventory OnUpdateTaskInventory;
event RemoveTaskInventory OnRemoveTaskItem;
event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
event ObjectAttach OnObjectAttach;
event ObjectDetach OnObjectDetach;
event UUIDNameRequest OnNameFromUUIDRequest;
event ParcelAccessListRequest OnParcelAccessListRequest;

View File

@ -516,8 +516,6 @@ namespace OpenSim.Region.ClientStack
public event GenericCall2 OnRequestWearables;
public event SetAppearance OnSetAppearance;
public event AvatarNowWearing OnAvatarNowWearing;
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
public event ObjectAttach OnObjectAttach;
public event GenericCall2 OnCompleteMovementToRegion;
public event UpdateAgent OnAgentUpdate;
public event AgentRequestSit OnAgentRequestSit;
@ -581,6 +579,10 @@ namespace OpenSim.Region.ClientStack
public event UpdateTaskInventory OnUpdateTaskInventory;
public event RemoveTaskInventory OnRemoveTaskItem;
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
public event ObjectAttach OnObjectAttach;
public event ObjectDetach OnObjectDetach;
public event UUIDNameRequest OnNameFromUUIDRequest;
public event ParcelAccessListRequest OnParcelAccessListRequest;
@ -2865,21 +2867,6 @@ namespace OpenSim.Region.ClientStack
OnAvatarNowWearing(this, wearingArgs);
}
break;
case PacketType.RezSingleAttachmentFromInv:
if (OnRezSingleAttachmentFromInv != null)
{
RezSingleAttachmentFromInvPacket rez = (RezSingleAttachmentFromInvPacket) Pack;
OnRezSingleAttachmentFromInv(this, rez.ObjectData.ItemID,
rez.ObjectData.AttachmentPt, rez.ObjectData.ItemFlags, rez.ObjectData.NextOwnerMask);
}
break;
case PacketType.ObjectAttach:
if (OnObjectAttach != null)
{
ObjectAttachPacket att = (ObjectAttachPacket) Pack;
OnObjectAttach(this, att.ObjectData[0].ObjectLocalID, att.AgentData.AttachmentPoint, att.ObjectData[0].Rotation);
}
break;
case PacketType.SetAlwaysRun:
SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack;
@ -3782,11 +3769,48 @@ namespace OpenSim.Region.ClientStack
// TODO: handle this packet
m_log.Warn("[CLIENT]: unhandled InventoryDescent packet");
break;
#endregion
#region realXtend
//Attachments
case PacketType.RezSingleAttachmentFromInv:
{
RezSingleAttachmentFromInvPacket packet = (RezSingleAttachmentFromInvPacket)Pack;
OnRezSingleAttachmentFromInv(this, packet.ObjectData.ItemID, packet.ObjectData.OwnerID,
packet.ObjectData.ItemFlags, packet.ObjectData.AttachmentPt);
break;
}
case PacketType.ObjectDetach:
{
ObjectDetachPacket packet = (ObjectDetachPacket)Pack;
foreach (ObjectDetachPacket.ObjectDataBlock block in packet.ObjectData)
{
OnObjectDetach(this, block.ObjectLocalID);
}
break;
}
case PacketType.ObjectAttach:
{
ObjectAttachPacket packet = (ObjectAttachPacket)Pack;
foreach (ObjectAttachPacket.ObjectDataBlock block in packet.ObjectData)
{
OnObjectAttach(this, block.ObjectLocalID, block.Rotation, packet.AgentData.AttachmentPoint);
}
//OutPacket(packet, ThrottleOutPacketType.Task);
break;
}
#endregion realXtend
default:
m_log.Warn("[CLIENT]: unhandled packet " + Pack.ToString());
break;
#endregion
}
}

View File

@ -499,8 +499,8 @@ namespace OpenSim.Region.Environment
if (splitField.Length == 3)
{
Int16 corner = Convert.ToInt16(splitField[0]);
float lowValue = (float) Convert.ToDecimal(splitField[1]);
float highValue = (float) Convert.ToDecimal(splitField[2]);
float lowValue = (float)Convert.ToDouble(splitField[1].Replace('.', ','));
float highValue = (float)Convert.ToDouble(splitField[2].Replace('.', ','));
setEstateTextureRange(corner, lowValue, highValue);
}
@ -671,4 +671,4 @@ namespace OpenSim.Region.Environment
#endregion
}
}
}

View File

@ -37,6 +37,7 @@ using System.IO;
using System.Text;
using System.Xml;
using OpenSim.Region.Environment.Interfaces;
using Axiom.Math;
namespace OpenSim.Region.Environment.Scenes
@ -824,10 +825,84 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
public void RezSingleAttachment(IClientAPI remoteClient, LLUUID itemID, uint AttachmentPt,
uint ItemFlags, uint NextOwnerMask)
protected void ObjectAttach(IClientAPI remoteClient, uint localID, LLQuaternion rotation, byte attachPoint)
{
System.Console.WriteLine("RezSingleAttachment: unimplemented yet");
System.Console.WriteLine("Attaching object " + localID + " to " + attachPoint);
SceneObjectPart p = GetSceneObjectPart(localID);
ScenePresence av = null;
if (TryGetAvatar(remoteClient.AgentId, out av))
{
p.AttachToAvatar(remoteClient.AgentId, av, attachPoint, rotation, m_regInfo);
}
}
protected void ObjectDetach(IClientAPI remoteClient, uint localID)
{
ScenePresence av = null;
if (TryGetAvatar(remoteClient.AgentId, out av))
{
SceneObjectPart p = GetSceneObjectPart(localID);
//Place the object in front of the avatar
Vector3 vecDir = new Vector3(1, 0, 0);
float dist = p.Scale.X + 0.1f;
vecDir = (av.Rotation * vecDir) * dist;
p.ParentGroup.AbsolutePosition = av.AbsolutePosition + new LLVector3(vecDir.x, vecDir.y, vecDir.z);
p.RotationOffset = new LLQuaternion(av.Rotation.x, av.Rotation.y, av.Rotation.z, av.Rotation.w);
p.Detach();
}
else
{
// MainLog.Instance.Warn("SCENE", "Object detach - Unable to find avatar " + remoteClient.FirstName + " " + remoteClient.LastName);
}
}
protected void SingleAttachmentFromInv(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID,
uint itemFlags, byte attachPoint)
{
// MainLog.Instance.Verbose("SCENE", "SingleAttachmentFromInv for " + remoteClient.FirstName + " " + remoteClient.LastName + ": " +
// "itemID=" + itemID + " ownerID=" + ownerID + " itemFlags=" + itemFlags +
// "attachPoint=" + attachPoint);
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
if (userInfo.RootFolder != null)
{
InventoryItemBase item = userInfo.RootFolder.HasItem(itemID);
if (item != null)
{
AssetBase rezAsset = AssetCache.GetAsset(item.assetID, false);
if (rezAsset != null)
{
// MainLog.Instance.Verbose("SCENE", "Adding inventory item to scene");
ScenePresence presence = GetScenePresence(remoteClient.AgentId);
SceneObjectGroup group = new SceneObjectGroup(this, m_regionHandle, Helpers.FieldToUTF8String(rezAsset.Data));
group.RegenerateFullIDs();
AddEntity(group);
group.AbsolutePosition = presence.AbsolutePosition;
SceneObjectPart rootPart = group.GetChildPart(group.UUID);
rootPart.RotationOffset = new LLQuaternion(presence.Rotation.x, presence.Rotation.y, presence.Rotation.z, presence.Rotation.w);
// MainLog.Instance.Verbose("SCENE", "Attaching it to a scene presence");
rootPart.AttachToAvatar(remoteClient.AgentId, presence, attachPoint, new LLQuaternion(0, 0, 0, 1), m_regInfo);
}
}
else
{
//MainLog.Instance.Warn("SCENE", "RezAttach - Item not found from folder");
}
}
else
{
//MainLog.Instance.Warn("SCENE", "RezAttach - No root folder found");
}
}
else
{
//MainLog.Instance.Warn("SCENE", "RezAttach - Unable to get userInfo for " + remoteClient.FirstName + " " + remoteClient.LastName);
}
}

View File

@ -1358,8 +1358,6 @@ namespace OpenSim.Region.Environment.Scenes
client.OnGrabUpdate += m_innerScene.MoveObject;
client.OnDeRezObject += DeRezObject;
client.OnRezObject += RezObject;
client.OnRezSingleAttachmentFromInv += RezSingleAttachment;
client.OnObjectAttach += m_innerScene.AttachObject;
client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest;
client.OnObjectDescription += m_innerScene.PrimDescription;
client.OnObjectName += m_innerScene.PrimName;
@ -1412,6 +1410,11 @@ namespace OpenSim.Region.Environment.Scenes
client.OnAvatarPickerRequest += ProcessAvatarPickerRequest;
client.OnPacketStats += AddPacketStats;
client.OnRezSingleAttachmentFromInv += SingleAttachmentFromInv;
client.OnObjectAttach += ObjectAttach;
client.OnObjectDetach += ObjectDetach;
EventManager.TriggerOnNewClient(client);
}

View File

@ -133,8 +133,18 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
private byte m_updateFlag;
#region realXtend
// Attachment parameters
private ScenePresence m_attachPresence = null;
private byte m_attachPt;
private LLQuaternion m_attachRot;
private RegionInfo m_attachRegInfo;
private LLUUID m_attachAgentId;
#endregion realXtend
#region Properties
public LLUUID CreatorID;
public LLUUID ObjectCreator
@ -1470,6 +1480,25 @@ namespace OpenSim.Region.Environment.Scenes
#region Position
public void AttachToAvatar(LLUUID agentId, ScenePresence presence, byte attachPt, LLQuaternion rotation, RegionInfo regionInfo)
{
m_attachAgentId = agentId;
m_attachPresence = presence;
m_attachPt = attachPt;
m_attachRot = rotation;
m_attachRegInfo = regionInfo;
RotationOffset = new LLQuaternion(0, 0, 0, 1);
ScheduleFullUpdate();
}
public void Detach()
{
m_attachPresence = null;
ScheduleFullUpdate();
}
/// <summary>
///
/// </summary>
@ -1708,9 +1737,145 @@ namespace OpenSim.Region.Environment.Scenes
lPos = OffsetPosition;
SendFullUpdateToClient(remoteClient, lPos, clientflags);
}
public void SendAttachedUpdateToClient(IClientAPI remoteClient, LLVector3 lPos, uint clientFlags)
{
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
objupdate.RegionData.RegionHandle = m_attachRegInfo.RegionHandle;
objupdate.RegionData.TimeDilation = 64096;
objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[2];
// avatar stuff - horrible group copypaste
objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
objupdate.ObjectData[0].PSBlock = new byte[0];
objupdate.ObjectData[0].ExtraParams = new byte[1];
objupdate.ObjectData[0].MediaURL = new byte[0];
objupdate.ObjectData[0].NameValue = new byte[0];
objupdate.ObjectData[0].Text = new byte[0];
objupdate.ObjectData[0].TextColor = new byte[4];
objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0, 0, 0);
objupdate.ObjectData[0].JointPivot = new LLVector3(0, 0, 0);
objupdate.ObjectData[0].Material = 4;
objupdate.ObjectData[0].TextureAnim = new byte[0];
objupdate.ObjectData[0].Sound = LLUUID.Zero;
objupdate.ObjectData[0].State = 0;
objupdate.ObjectData[0].Data = new byte[0];
objupdate.ObjectData[0].ObjectData = new byte[76];
objupdate.ObjectData[0].ObjectData[15] = 128;
objupdate.ObjectData[0].ObjectData[16] = 63;
objupdate.ObjectData[0].ObjectData[56] = 128;
objupdate.ObjectData[0].ObjectData[61] = 102;
objupdate.ObjectData[0].ObjectData[62] = 40;
objupdate.ObjectData[0].ObjectData[63] = 61;
objupdate.ObjectData[0].ObjectData[64] = 189;
objupdate.ObjectData[0].UpdateFlags = 61 + (9 << 8) + (130 << 16) + (16 << 24);
objupdate.ObjectData[0].PathCurve = 16;
objupdate.ObjectData[0].ProfileCurve = 1;
objupdate.ObjectData[0].PathScaleX = 100;
objupdate.ObjectData[0].PathScaleY = 100;
objupdate.ObjectData[0].ParentID = 0;
objupdate.ObjectData[0].OwnerID = LLUUID.Zero;
objupdate.ObjectData[0].Scale = new LLVector3(1, 1, 1);
objupdate.ObjectData[0].PCode = 47;
objupdate.ObjectData[0].TextureEntry = ScenePresence.DefaultTexture;
objupdate.ObjectData[0].ID = m_attachPresence.LocalId;
objupdate.ObjectData[0].FullID = m_attachAgentId;
objupdate.ObjectData[0].ParentID = 0;
objupdate.ObjectData[0].NameValue =
Helpers.StringToField("FirstName STRING RW SV " + m_attachPresence.Firstname + "\nLastName STRING RW SV " + m_attachPresence.Lastname);
LLVector3 pos2 = m_attachPresence.AbsolutePosition;
// new LLVector3((float) Pos.X, (float) Pos.Y, (float) Pos.Z);
byte[] pb = pos2.GetBytes();
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
// primitive part
objupdate.ObjectData[1] = new ObjectUpdatePacket.ObjectDataBlock();
// SetDefaultPrimPacketValues
objupdate.ObjectData[1].PSBlock = new byte[0];
objupdate.ObjectData[1].ExtraParams = new byte[1];
objupdate.ObjectData[1].MediaURL = new byte[0];
objupdate.ObjectData[1].NameValue = new byte[0];
objupdate.ObjectData[1].Text = new byte[0];
objupdate.ObjectData[1].TextColor = new byte[4];
objupdate.ObjectData[1].JointAxisOrAnchor = new LLVector3(0, 0, 0);
objupdate.ObjectData[1].JointPivot = new LLVector3(0, 0, 0);
objupdate.ObjectData[1].Material = 3;
objupdate.ObjectData[1].TextureAnim = new byte[0];
objupdate.ObjectData[1].Sound = LLUUID.Zero;
objupdate.ObjectData[1].State = 0;
objupdate.ObjectData[1].Data = new byte[0];
objupdate.ObjectData[1].ObjectData = new byte[60];
objupdate.ObjectData[1].ObjectData[46] = 128;
objupdate.ObjectData[1].ObjectData[47] = 63;
// SetPrimPacketShapeData
PrimitiveBaseShape primData = Shape;
objupdate.ObjectData[1].TextureEntry = primData.TextureEntry;
objupdate.ObjectData[1].PCode = primData.PCode;
objupdate.ObjectData[1].State = (byte)(((byte)m_attachPt) << 4);
objupdate.ObjectData[1].PathBegin = primData.PathBegin;
objupdate.ObjectData[1].PathEnd = primData.PathEnd;
objupdate.ObjectData[1].PathScaleX = primData.PathScaleX;
objupdate.ObjectData[1].PathScaleY = primData.PathScaleY;
objupdate.ObjectData[1].PathShearX = primData.PathShearX;
objupdate.ObjectData[1].PathShearY = primData.PathShearY;
objupdate.ObjectData[1].PathSkew = primData.PathSkew;
objupdate.ObjectData[1].ProfileBegin = primData.ProfileBegin;
objupdate.ObjectData[1].ProfileEnd = primData.ProfileEnd;
objupdate.ObjectData[1].Scale = primData.Scale;
objupdate.ObjectData[1].PathCurve = primData.PathCurve;
objupdate.ObjectData[1].ProfileCurve = primData.ProfileCurve;
objupdate.ObjectData[1].ProfileHollow = primData.ProfileHollow;
objupdate.ObjectData[1].PathRadiusOffset = primData.PathRadiusOffset;
objupdate.ObjectData[1].PathRevolutions = primData.PathRevolutions;
objupdate.ObjectData[1].PathTaperX = primData.PathTaperX;
objupdate.ObjectData[1].PathTaperY = primData.PathTaperY;
objupdate.ObjectData[1].PathTwist = primData.PathTwist;
objupdate.ObjectData[1].PathTwistBegin = primData.PathTwistBegin;
objupdate.ObjectData[1].ExtraParams = primData.ExtraParams;
objupdate.ObjectData[1].UpdateFlags = 276957500; // flags; // ??
objupdate.ObjectData[1].ID = LocalID;
objupdate.ObjectData[1].FullID = UUID;
objupdate.ObjectData[1].OwnerID = OwnerID;
objupdate.ObjectData[1].Text = Helpers.StringToField(Text);
objupdate.ObjectData[1].TextColor[0] = 255;
objupdate.ObjectData[1].TextColor[1] = 255;
objupdate.ObjectData[1].TextColor[2] = 255;
objupdate.ObjectData[1].TextColor[3] = 128;
objupdate.ObjectData[1].ParentID = objupdate.ObjectData[0].ID;
//objupdate.ObjectData[1].PSBlock = particleSystem;
//objupdate.ObjectData[1].ClickAction = clickAction;
objupdate.ObjectData[1].Radius = 20;
objupdate.ObjectData[1].NameValue =
Helpers.StringToField("AttachItemID STRING RW SV " + UUID);
LLVector3 pos = new LLVector3((float)0.0, (float)0.0, (float)0.0);
pb = pos.GetBytes();
Array.Copy(pb, 0, objupdate.ObjectData[1].ObjectData, 0, pb.Length);
byte[] brot = m_attachRot.GetBytes();
Array.Copy(brot, 0, objupdate.ObjectData[1].ObjectData, 36, brot.Length);
remoteClient.OutPacket(objupdate, ThrottleOutPacketType.Task);
}
public void SendFullUpdateToClient(IClientAPI remoteClient, LLVector3 lPos, uint clientFlags)
{
if (m_attachPresence != null)
{
SendAttachedUpdateToClient(remoteClient, lPos, clientFlags);
return;
}
LLQuaternion lRot;
lRot = RotationOffset;
clientFlags &= ~(uint) LLObject.ObjectFlags.CreateSelected;

View File

@ -58,8 +58,6 @@ namespace SimpleApp
public event ModifyTerrain OnModifyTerrain;
public event SetAppearance OnSetAppearance;
public event AvatarNowWearing OnAvatarNowWearing;
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
public event ObjectAttach OnObjectAttach;
public event StartAnim OnStartAnim;
public event StopAnim OnStopAnim;
public event LinkObjects OnLinkObjects;
@ -129,6 +127,10 @@ namespace SimpleApp
public event UpdateTaskInventory OnUpdateTaskInventory;
public event RemoveTaskInventory OnRemoveTaskItem;
public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv;
public event ObjectAttach OnObjectAttach;
public event ObjectDetach OnObjectDetach;
public event UUIDNameRequest OnNameFromUUIDRequest;
public event ParcelPropertiesRequest OnParcelPropertiesRequest;