More work on SceneObject/Primitive and building (Linking is a work in progress as is all). Committing now as I've finished for the night and will be continued tomorrow.
parent
97d441fca4
commit
2852cda727
|
@ -163,8 +163,8 @@ namespace OpenSim.Framework.Interfaces
|
|||
void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint);
|
||||
void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID , uint flags);
|
||||
void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags);
|
||||
void SendPrimitiveToClient2(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID);
|
||||
void SendPrimitiveToClient2(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID);
|
||||
void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID);
|
||||
void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID);
|
||||
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ namespace OpenSim.Framework.Types
|
|||
public LLVector3 Scale;
|
||||
public byte PathCurve;
|
||||
public byte ProfileCurve;
|
||||
public uint ParentID = 0;
|
||||
public ushort ProfileHollow;
|
||||
public sbyte PathRadiusOffset;
|
||||
public byte PathRevolutions;
|
||||
|
@ -73,13 +72,13 @@ namespace OpenSim.Framework.Types
|
|||
|
||||
}
|
||||
|
||||
public static PrimitiveBaseShape DefaultCube()
|
||||
public static PrimitiveBaseShape DefaultBox()
|
||||
{
|
||||
PrimitiveBaseShape primShape = new PrimitiveBaseShape();
|
||||
|
||||
primShape.type = ShapeType.Box;
|
||||
primShape.Scale = new LLVector3(0.5f, 0.5f, 0.5f);
|
||||
primShape.PCode = 9;
|
||||
primShape.ParentID = 0;
|
||||
primShape.PathBegin = 0;
|
||||
primShape.PathEnd = 0;
|
||||
primShape.PathScaleX = 0;
|
||||
|
|
|
@ -629,7 +629,7 @@ namespace OpenSim.Region.ClientStack
|
|||
}
|
||||
|
||||
|
||||
public void SendPrimitiveToClient2(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID)
|
||||
public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID)
|
||||
{
|
||||
ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
|
||||
outPacket.RegionData.RegionHandle = regionHandle;
|
||||
|
@ -639,6 +639,8 @@ namespace OpenSim.Region.ClientStack
|
|||
outPacket.ObjectData[0].ID = localID;
|
||||
outPacket.ObjectData[0].FullID = objectID;
|
||||
outPacket.ObjectData[0].OwnerID = ownerID;
|
||||
outPacket.ObjectData[0].Text = enc.GetBytes(text);
|
||||
outPacket.ObjectData[0].ParentID = parentID;
|
||||
byte[] pb = pos.GetBytes();
|
||||
Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
|
||||
byte[] rot = rotation.GetBytes();
|
||||
|
@ -646,7 +648,7 @@ namespace OpenSim.Region.ClientStack
|
|||
OutPacket(outPacket);
|
||||
}
|
||||
|
||||
public void SendPrimitiveToClient2(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID)
|
||||
public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID)
|
||||
{
|
||||
ObjectUpdatePacket outPacket = new ObjectUpdatePacket();
|
||||
outPacket.RegionData.RegionHandle = regionHandle;
|
||||
|
@ -656,6 +658,8 @@ namespace OpenSim.Region.ClientStack
|
|||
outPacket.ObjectData[0].ID = localID;
|
||||
outPacket.ObjectData[0].FullID = objectID;
|
||||
outPacket.ObjectData[0].OwnerID = ownerID;
|
||||
outPacket.ObjectData[0].Text = enc.GetBytes(text);
|
||||
outPacket.ObjectData[0].ParentID = parentID;
|
||||
byte[] pb = pos.GetBytes();
|
||||
Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
|
||||
|
||||
|
@ -876,6 +880,7 @@ namespace OpenSim.Region.ClientStack
|
|||
LLObject.TextureEntry ntex = new LLObject.TextureEntry(textureID);
|
||||
objectData.TextureEntry = ntex.ToBytes();
|
||||
objectData.OwnerID = primData.OwnerID;
|
||||
objectData.ParentID = primData.ParentID;
|
||||
objectData.PCode = primData.PCode;
|
||||
objectData.PathBegin = primData.PathBegin;
|
||||
objectData.PathEnd = primData.PathEnd;
|
||||
|
@ -889,7 +894,6 @@ namespace OpenSim.Region.ClientStack
|
|||
objectData.Scale = primData.Scale;
|
||||
objectData.PathCurve = primData.PathCurve;
|
||||
objectData.ProfileCurve = primData.ProfileCurve;
|
||||
objectData.ParentID = primData.ParentID;
|
||||
objectData.ProfileHollow = primData.ProfileHollow;
|
||||
objectData.PathRadiusOffset = primData.PathRadiusOffset;
|
||||
objectData.PathRevolutions = primData.PathRevolutions;
|
||||
|
@ -916,7 +920,6 @@ namespace OpenSim.Region.ClientStack
|
|||
objectData.Scale = primData.Scale;
|
||||
objectData.PathCurve = primData.PathCurve;
|
||||
objectData.ProfileCurve = primData.ProfileCurve;
|
||||
objectData.ParentID = primData.ParentID;
|
||||
objectData.ProfileHollow = primData.ProfileHollow;
|
||||
objectData.PathRadiusOffset = primData.PathRadiusOffset;
|
||||
objectData.PathRevolutions = primData.PathRevolutions;
|
||||
|
|
|
@ -22,8 +22,18 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
private Dictionary<LLUUID, InventoryItem> inventoryItems;
|
||||
|
||||
private string description = "";
|
||||
|
||||
public string SitName = "";
|
||||
public string TouchName = "";
|
||||
public string Text = "";
|
||||
|
||||
public LLUUID CreatorID;
|
||||
public LLUUID OwnerID;
|
||||
public LLUUID LastOwnerID;
|
||||
public Int32 CreationDate;
|
||||
|
||||
public uint ParentID = 0;
|
||||
|
||||
public uint OwnerMask = FULL_MASK_PERMISSIONS;
|
||||
public uint NextOwnerMask = FULL_MASK_PERMISSIONS;
|
||||
public uint GroupMask = FULL_MASK_PERMISSIONS;
|
||||
|
@ -32,9 +42,9 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
private PrimitiveBaseShape m_Shape;
|
||||
|
||||
private SceneObject m_RootParent;
|
||||
private bool isRootPrim;
|
||||
private EntityBase m_Parent;
|
||||
public SceneObject m_RootParent;
|
||||
public bool isRootPrim;
|
||||
public EntityBase m_Parent;
|
||||
|
||||
public override LLVector3 Pos
|
||||
{
|
||||
|
@ -51,7 +61,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
set
|
||||
{
|
||||
this.m_pos = value - m_Parent.Pos; //should we being subtracting the parent position
|
||||
this.m_pos = m_Parent.Pos - value; //should we being subtracting the parent position
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -108,6 +118,8 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
this.OwnerID = ownerID;
|
||||
this.CreatorID = this.OwnerID;
|
||||
this.LastOwnerID = LLUUID.Zero;
|
||||
this.Pos = addPacket.ObjectData.RayEnd;
|
||||
this.uuid = LLUUID.Random();
|
||||
this.m_localId = (uint)(localID);
|
||||
|
@ -128,7 +140,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
pShape.Scale = addPacket.ObjectData.Scale;
|
||||
pShape.PathCurve = addPacket.ObjectData.PathCurve;
|
||||
pShape.ProfileCurve = addPacket.ObjectData.ProfileCurve;
|
||||
pShape.ParentID = 0;
|
||||
pShape.ProfileHollow = addPacket.ObjectData.ProfileHollow;
|
||||
pShape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
|
||||
pShape.PathRevolutions = addPacket.ObjectData.PathRevolutions;
|
||||
|
@ -142,7 +153,37 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
public void AddToChildren(SceneObject linkObject)
|
||||
{
|
||||
// Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")");
|
||||
//TODO check permissions
|
||||
this.children.Add(linkObject.rootPrimitive);
|
||||
linkObject.rootPrimitive.SetNewParent(this, this.m_RootParent);
|
||||
|
||||
this.m_world.DeleteEntity(linkObject.rootUUID);
|
||||
linkObject.rootPrimitive = null;
|
||||
}
|
||||
|
||||
public void SetNewParent(Primitive newParent, SceneObject rootParent)
|
||||
{
|
||||
LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z);
|
||||
//Console.WriteLine("have a new parent and my old position is " + this.Pos.X + " , " + this.Pos.Y + " , " + this.Pos.Z);
|
||||
this.isRootPrim = false;
|
||||
this.m_Parent = newParent;
|
||||
this.ParentID = newParent.LocalId;
|
||||
this.SetRootParent(rootParent);
|
||||
// Console.WriteLine("have a new parent and its position is " + this.m_Parent.Pos.X + " , " + this.m_Parent.Pos.Y + " , " + this.m_Parent.Pos.Z);
|
||||
this.Pos = oldPos;
|
||||
// Console.WriteLine("have a new parent so my new offset position is " + this.Pos.X + " , " + this.Pos.Y + " , " + this.Pos.Z);
|
||||
this.updateFlag = 1;
|
||||
|
||||
}
|
||||
|
||||
public void SetRootParent(SceneObject newRoot)
|
||||
{
|
||||
this.m_RootParent = newRoot;
|
||||
foreach (Primitive child in children)
|
||||
{
|
||||
child.SetRootParent(newRoot);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -187,7 +228,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
LLVector3 lPos;
|
||||
lPos = this.Pos;
|
||||
|
||||
remoteClient.SendPrimitiveToClient2(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID);
|
||||
remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID, this.Text, this.ParentID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -193,8 +193,41 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <param name="childPrims"></param>
|
||||
public void LinkObjects(uint parentPrim, List<uint> childPrims)
|
||||
{
|
||||
|
||||
SceneObject parenPrim = null;
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObject)
|
||||
{
|
||||
if (((SceneObject)ent).rootLocalID == parentPrim)
|
||||
{
|
||||
parenPrim = (SceneObject)ent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<SceneObject> children = new List<SceneObject>();
|
||||
if (parenPrim != null)
|
||||
{
|
||||
for (int i = 0; i < childPrims.Count; i++)
|
||||
{
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
{
|
||||
if (ent is SceneObject)
|
||||
{
|
||||
if (((SceneObject)ent).rootLocalID == childPrims[i])
|
||||
{
|
||||
children.Add((SceneObject)ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (SceneObject sceneObj in children)
|
||||
{
|
||||
parenPrim.AddNewChildPrims(sceneObj);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -275,7 +308,10 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
if (this.Entities.ContainsKey(objectID))
|
||||
{
|
||||
((PrimitiveOld)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient);
|
||||
if (this.Entities[objectID] is SceneObject)
|
||||
{
|
||||
((SceneObject)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -461,10 +461,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
client.OnRequestMapBlocks += this.RequestMapBlocks;
|
||||
client.OnTeleportLocationRequest += this.RequestTeleportLocation;
|
||||
client.OnObjectSelect += this.SelectPrim;
|
||||
// client.OnGrapUpdate += this.MoveObject;
|
||||
client.OnGrapUpdate += this.MoveObject;
|
||||
client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest;
|
||||
client.OnObjectDescription += this.PrimDescription;
|
||||
client.OnObjectName += this.PrimName;
|
||||
client.OnLinkObjects += this.LinkObjects;
|
||||
|
||||
/* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest);
|
||||
remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest);
|
||||
|
@ -585,6 +586,21 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="entID"></param>
|
||||
/// <returns></returns>
|
||||
public bool DeleteEntity(LLUUID entID)
|
||||
{
|
||||
if (this.Entities.ContainsKey(entID))
|
||||
{
|
||||
this.Entities.Remove(entID);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#region RegionCommsHost
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
private System.Text.Encoding enc = System.Text.Encoding.ASCII;
|
||||
private Dictionary<LLUUID, Primitive> ChildPrimitives = new Dictionary<LLUUID, Primitive>(); //list of all primitive id's that are part of this group
|
||||
protected Primitive rootPrimitive;
|
||||
public Primitive rootPrimitive;
|
||||
private Scene m_world;
|
||||
protected ulong m_regionHandle;
|
||||
|
||||
|
@ -99,6 +99,16 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="primObject"></param>
|
||||
public void AddNewChildPrims(SceneObject primObject)
|
||||
{
|
||||
this.rootPrimitive.AddToChildren(primObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
@ -145,6 +155,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
|
||||
{
|
||||
this.Pos = pos;
|
||||
this.rootPrimitive.Pos = pos;
|
||||
this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient);
|
||||
}
|
||||
|
||||
|
@ -161,17 +172,17 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock();
|
||||
proper.ObjectData[0].ItemID = LLUUID.Zero;
|
||||
proper.ObjectData[0].CreationDate = (ulong)this.rootPrimitive.CreationDate;
|
||||
proper.ObjectData[0].CreatorID = this.rootPrimitive.OwnerID;
|
||||
proper.ObjectData[0].CreatorID = this.rootPrimitive.CreatorID;
|
||||
proper.ObjectData[0].FolderID = LLUUID.Zero;
|
||||
proper.ObjectData[0].FromTaskID = LLUUID.Zero;
|
||||
proper.ObjectData[0].GroupID = LLUUID.Zero;
|
||||
proper.ObjectData[0].InventorySerial = 0;
|
||||
proper.ObjectData[0].LastOwnerID = LLUUID.Zero;
|
||||
proper.ObjectData[0].LastOwnerID = this.rootPrimitive.LastOwnerID;
|
||||
proper.ObjectData[0].ObjectID = this.rootUUID;
|
||||
proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID;
|
||||
proper.ObjectData[0].TouchName = new byte[0];
|
||||
proper.ObjectData[0].TouchName = enc.GetBytes(this.rootPrimitive.TouchName + "\0");
|
||||
proper.ObjectData[0].TextureID = new byte[0];
|
||||
proper.ObjectData[0].SitName = new byte[0];
|
||||
proper.ObjectData[0].SitName = enc.GetBytes(this.rootPrimitive.SitName +"\0") ;
|
||||
proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name +"\0");
|
||||
proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description +"\0");
|
||||
proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask;
|
||||
|
|
Loading…
Reference in New Issue