From 33ef93f4a6ed66dcd06733b3909e647b33faa698 Mon Sep 17 00:00:00 2001
From: lbsa71
Date: Fri, 13 Jul 2007 12:32:34 +0000
Subject: * ObjectAddPacket now confined to ClientView,´using
PrimitiveBaseShape instead - w00t!
---
OpenSim/Framework/General/Interfaces/IClientAPI.cs | 3 +-
.../Framework/General/Types/PrimitiveBaseShape.cs | 31 ++++++++++++++++++-
OpenSim/Region/ClientStack/ClientView.API.cs | 2 +-
.../ClientStack/ClientView.ProcessPackets.cs | 5 ++-
OpenSim/Region/Environment/Scenes/Primitive.cs | 36 +++++-----------------
OpenSim/Region/Environment/Scenes/Scene.cs | 21 ++-----------
OpenSim/Region/Environment/Scenes/SceneBase.cs | 2 --
OpenSim/Region/Environment/Scenes/SceneObject.cs | 11 ++++---
OpenSim/Region/Examples/SimpleApp/Program.cs | 2 +-
9 files changed, 53 insertions(+), 60 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index b6f304b..9ac7994 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -75,6 +75,7 @@ namespace OpenSim.Framework.Interfaces
public delegate void UUIDNameRequest(LLUUID id, IClientAPI remote_client);
+ public delegate void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape);
public interface IClientAPI
{
@@ -94,7 +95,7 @@ namespace OpenSim.Framework.Interfaces
event GenericCall2 OnCompleteMovementToRegion;
event UpdateAgent OnAgentUpdate;
event GenericCall OnRequestAvatarsData;
- event GenericCall4 OnAddPrim;
+ event AddNewPrim OnAddPrim;
event ObjectDuplicate OnObjectDuplicate;
event UpdateVector OnGrapObject;
event ObjectSelect OnDeGrapObject;
diff --git a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs
index a6671d1..b9a8c90 100644
--- a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs
@@ -1,4 +1,5 @@
using libsecondlife;
+using libsecondlife.Packets;
namespace OpenSim.Framework.Types
{
@@ -97,6 +98,34 @@ namespace OpenSim.Framework.Types
return primShape;
}
- }
+ public static PrimitiveBaseShape FromAddPacket(ObjectAddPacket addPacket)
+ {
+ PrimitiveBaseShape pShape = new PrimitiveBaseShape();
+
+ pShape.PCode = addPacket.ObjectData.PCode;
+ pShape.PathBegin = addPacket.ObjectData.PathBegin;
+ pShape.PathEnd = addPacket.ObjectData.PathEnd;
+ pShape.PathScaleX = addPacket.ObjectData.PathScaleX;
+ pShape.PathScaleY = addPacket.ObjectData.PathScaleY;
+ pShape.PathShearX = addPacket.ObjectData.PathShearX;
+ pShape.PathShearY = addPacket.ObjectData.PathShearY;
+ pShape.PathSkew = addPacket.ObjectData.PathSkew;
+ pShape.ProfileBegin = addPacket.ObjectData.ProfileBegin;
+ pShape.ProfileEnd = addPacket.ObjectData.ProfileEnd;
+ pShape.Scale = addPacket.ObjectData.Scale;
+ pShape.PathCurve = addPacket.ObjectData.PathCurve;
+ pShape.ProfileCurve = addPacket.ObjectData.ProfileCurve;
+ pShape.ProfileHollow = addPacket.ObjectData.ProfileHollow;
+ pShape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
+ pShape.PathRevolutions = addPacket.ObjectData.PathRevolutions;
+ pShape.PathTaperX = addPacket.ObjectData.PathTaperX;
+ pShape.PathTaperY = addPacket.ObjectData.PathTaperY;
+ pShape.PathTwist = addPacket.ObjectData.PathTwist;
+ pShape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
+ LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005"));
+ pShape.TextureEntry = ntex.ToBytes();
+ return pShape;
+ }
+ }
}
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index b47d95a..2be5b0e 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.ClientStack
public event ObjectSelect OnDeGrapObject;
public event ObjectDuplicate OnObjectDuplicate;
public event MoveObject OnGrapUpdate;
- public event GenericCall4 OnAddPrim;
+ public event AddNewPrim OnAddPrim;
public event UpdateShape OnUpdatePrimShape;
public event ObjectSelect OnObjectSelect;
public event GenericCall7 OnObjectDescription;
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index df2bf34..013b755 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -217,7 +217,10 @@ namespace OpenSim.Region.ClientStack
case PacketType.ObjectAdd:
if (OnAddPrim != null)
{
- OnAddPrim(Pack, this);
+ ObjectAddPacket packet = (ObjectAddPacket) Pack ;
+ PrimitiveBaseShape primShape = PrimitiveBaseShape.FromAddPacket( packet );
+
+ OnAddPrim(this.AgentId, packet.ObjectData.RayEnd, primShape );
}
break;
case PacketType.ObjectShape:
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index 5cb2930..4bb43d2 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -130,7 +130,7 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject)
+ public Primitive(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject, PrimitiveBaseShape shape, LLVector3 pos)
{
m_regionHandle = regionHandle;
m_world = world;
@@ -138,7 +138,8 @@ namespace OpenSim.Region.Environment.Scenes
this.m_Parent = parent;
this.m_isRootPrim = isRoot;
this.m_RootParent = rootObject;
- this.CreateFromPacket(addPacket, ownerID, localID);
+
+ this.CreateFromPacket(ownerID, localID, pos, shape);
this.Rotation = Axiom.Math.Quaternion.Identity;
}
@@ -209,43 +210,20 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
+ public void CreateFromPacket(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
{
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.Pos = pos;
this.uuid = LLUUID.Random();
this.m_localId = (uint)(localID);
- PrimitiveBaseShape pShape = new PrimitiveBaseShape();
- this.m_Shape = pShape;
-
- pShape.PCode = addPacket.ObjectData.PCode;
- pShape.PathBegin = addPacket.ObjectData.PathBegin;
- pShape.PathEnd = addPacket.ObjectData.PathEnd;
- pShape.PathScaleX = addPacket.ObjectData.PathScaleX;
- pShape.PathScaleY = addPacket.ObjectData.PathScaleY;
- pShape.PathShearX = addPacket.ObjectData.PathShearX;
- pShape.PathShearY = addPacket.ObjectData.PathShearY;
- pShape.PathSkew = addPacket.ObjectData.PathSkew;
- pShape.ProfileBegin = addPacket.ObjectData.ProfileBegin;
- pShape.ProfileEnd = addPacket.ObjectData.ProfileEnd;
- pShape.Scale = addPacket.ObjectData.Scale;
- pShape.PathCurve = addPacket.ObjectData.PathCurve;
- pShape.ProfileCurve = addPacket.ObjectData.ProfileCurve;
- pShape.ProfileHollow = addPacket.ObjectData.ProfileHollow;
- pShape.PathRadiusOffset = addPacket.ObjectData.PathRadiusOffset;
- pShape.PathRevolutions = addPacket.ObjectData.PathRevolutions;
- pShape.PathTaperX = addPacket.ObjectData.PathTaperX;
- pShape.PathTaperY = addPacket.ObjectData.PathTaperY;
- pShape.PathTwist = addPacket.ObjectData.PathTwist;
- pShape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
- LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005"));
- pShape.TextureEntry = ntex.ToBytes();
+ this.m_Shape = shape;
this.updateFlag = 1;
}
+
#endregion
#region Linking / unlinking
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 4a4b7a0..417f817 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -417,22 +417,12 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- ///
- public void AddNewPrim(Packet addPacket, IClientAPI agentClient)
- {
- AddNewPrim((ObjectAddPacket)addPacket, agentClient.AgentId);
- }
-
- ///
- ///
- ///
- ///
///
- public void AddNewPrim(ObjectAddPacket addPacket, LLUUID ownerID)
+ public void AddNewPrim(LLUUID ownerID, LLVector3 pos, PrimitiveBaseShape shape)
{
try
{
- SceneObject sceneOb = new SceneObject(m_regionHandle, this, addPacket, ownerID, this.PrimIDAllocate());
+ SceneObject sceneOb = new SceneObject(m_regionHandle, this, ownerID, this.PrimIDAllocate(), pos, shape);
this.Entities.Add(sceneOb.rootUUID, sceneOb);
// Trigger event for listeners
@@ -444,13 +434,6 @@ namespace OpenSim.Region.Environment.Scenes
}
}
- public override uint AddNewPrim(LLUUID ownerId, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID texture, int flags)
- {
- uint id = NextLocalId;
-
- throw new NotImplementedException("Not implemented yet.");
- }
-
#endregion
#region Add/Remove Avatar Methods
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index 811f54c..c852499 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -146,8 +146,6 @@ namespace OpenSim.Region.Environment.Scenes
///
public abstract void AddNewClient(IClientAPI client, bool child);
- public abstract uint AddNewPrim(LLUUID ownerId, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID texture, int flags);
-
///
///
///
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index 93b6e8d..5eed115 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -30,6 +30,7 @@ using System.Text;
using libsecondlife;
using libsecondlife.Packets;
using OpenSim.Framework.Interfaces;
+using OpenSim.Framework.Types;
using OpenSim.Physics.Manager;
namespace OpenSim.Region.Environment.Scenes
@@ -67,12 +68,12 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public SceneObject(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
+ public SceneObject(ulong regionHandle, Scene world, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape)
{
m_regionHandle = regionHandle;
m_world = world;
- this.Pos = addPacket.ObjectData.RayEnd;
- this.CreateRootFromPacket(addPacket, ownerID, localID);
+ this.Pos = pos;
+ this.CreateRootFromPacket(ownerID, localID, shape, pos );
}
///
@@ -90,9 +91,9 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public void CreateRootFromPacket(ObjectAddPacket addPacket, LLUUID agentID, uint localID)
+ public void CreateRootFromPacket(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos)
{
- this.rootPrimitive = new Primitive( this.m_regionHandle, this.m_world, addPacket, agentID, localID, true, this, this);
+ this.rootPrimitive = new Primitive( this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos);
this.children.Add(rootPrimitive);
this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive);
}
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
index 87e877c..095ba1d 100644
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -68,7 +68,7 @@ namespace SimpleApp
PrimData primData = new PrimData();
primData.Scale = new LLVector3(1, 1, 1);
- m_localId = world.AddNewPrim( LLUUID.Zero, primData, LLVector3.Zero, new LLQuaternion(0, 0, 0, 0), LLUUID.Zero, 0);
+ //m_localId = world.AddNewPrim( LLUUID.Zero, primData, LLVector3.Zero, new LLQuaternion(0, 0, 0, 0), LLUUID.Zero, 0);
}
--
cgit v1.1