From 54ef77f0fda5fabc6f4677e145fafb74d225a77e Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 1 Jul 2007 18:33:44 +0000 Subject: Can change the name and description of a prim. --- OpenSim/Region/Environment/Scenes/Entity.cs | 2 +- OpenSim/Region/Environment/Scenes/EntityBase.cs | 1 + OpenSim/Region/Environment/Scenes/Primitive.cs | 13 +++++++ .../Environment/Scenes/Scene.PacketHandlers.cs | 45 +++++++++++++++++++++- OpenSim/Region/Environment/Scenes/Scene.cs | 6 ++- OpenSim/Region/Environment/Scenes/SceneObject.cs | 20 ++++++++-- 6 files changed, 80 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Scenes/Entity.cs b/OpenSim/Region/Environment/Scenes/Entity.cs index 9603f7f..6db57a4 100644 --- a/OpenSim/Region/Environment/Scenes/Entity.cs +++ b/OpenSim/Region/Environment/Scenes/Entity.cs @@ -34,7 +34,7 @@ using libsecondlife; namespace OpenSim.Region.Environment.Scenes { - public abstract class Entity :EntityBase //will be phased out + public abstract class Entity :EntityBase //this class (Entity) will be phased out { protected PhysicsActor _physActor; diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs index edd72c5..63f3f5d 100644 --- a/OpenSim/Region/Environment/Scenes/EntityBase.cs +++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs @@ -21,6 +21,7 @@ namespace OpenSim.Region.Environment.Scenes public virtual string Name { get { return m_name; } + set { m_name = value; } } protected LLVector3 m_pos; diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 497196d..97e7974 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -21,6 +21,7 @@ namespace OpenSim.Region.Environment.Scenes private Dictionary inventoryItems; + private string description = ""; public LLUUID OwnerID; public Int32 CreationDate; public uint OwnerMask = FULL_MASK_PERMISSIONS; @@ -55,6 +56,18 @@ namespace OpenSim.Region.Environment.Scenes } + public string Description + { + get + { + return this.description; + } + set + { + this.description = value; + } + } + public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent , SceneObject rootObject) { m_regionHandle = regionHandle; diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index f3d461a..f55c118 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -214,7 +214,6 @@ namespace OpenSim.Region.Environment.Scenes /// public void SelectPrim(uint primLocalID, IClientAPI remoteClient) { - Console.WriteLine("prim selected :" + primLocalID); foreach (EntityBase ent in Entities.Values) { if (ent is SceneObject) @@ -228,6 +227,50 @@ namespace OpenSim.Region.Environment.Scenes } } + /// + /// + /// + /// + /// + public void PrimDescription(uint primLocalID, string description) + { + Primitive prim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + prim = ((SceneObject)ent).HasChildPrim(primLocalID); + if (prim != null) + { + prim.Description = description; + break; + } + } + } + } + + /// + /// + /// + /// + /// + public void PrimName(uint primLocalID, string name) + { + Primitive prim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + prim = ((SceneObject)ent).HasChildPrim(primLocalID); + if (prim != null) + { + prim.Name = name; + break; + } + } + } + } + public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) { if (this.Entities.ContainsKey(objectID)) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 2ff3976..08adc84 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -56,7 +56,7 @@ namespace OpenSim.Region.Environment.Scenes { protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); protected Dictionary Avatars; - protected Dictionary Prims; + protected Dictionary Prims; private PhysicsScene phyScene; private float timeStep = 0.1f; private Random Rand = new Random(); @@ -124,7 +124,7 @@ namespace OpenSim.Region.Environment.Scenes OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating new entitities instance"); Entities = new Dictionary(); Avatars = new Dictionary(); - Prims = new Dictionary(); + Prims = new Dictionary(); OpenSim.Framework.Console.MainLog.Instance.Verbose("World.cs - creating LandMap"); Terrain = new TerrainEngine(); @@ -463,6 +463,8 @@ namespace OpenSim.Region.Environment.Scenes client.OnObjectSelect += this.SelectPrim; // client.OnGrapUpdate += this.MoveObject; client.OnNameFromUUIDRequest += this.commsManager.HandleUUIDNameRequest; + client.OnObjectDescription += this.PrimDescription; + client.OnObjectName += this.PrimName; /* remoteClient.OnParcelPropertiesRequest += new ParcelPropertiesRequest(parcelManager.handleParcelPropertiesRequest); remoteClient.OnParcelDivideRequest += new ParcelDivideRequest(parcelManager.handleParcelDivideRequest); diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index a228638..00df447 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -39,7 +39,7 @@ namespace OpenSim.Region.Environment.Scenes { public class SceneObject : EntityBase { - + private System.Text.Encoding enc = System.Text.Encoding.ASCII; private Dictionary ChildPrimitives = new Dictionary(); //list of all primitive id's that are part of this group protected Primitive rootPrimitive; private Scene m_world; @@ -114,6 +114,19 @@ namespace OpenSim.Region.Environment.Scenes return null; } + public Primitive HasChildPrim(uint localID) + { + Primitive returnPrim = null; + foreach (Primitive prim in this.children) + { + if (prim.LocalId == localID) + { + returnPrim = prim; + break; + } + } + return returnPrim; + } /// /// @@ -141,6 +154,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void GetProperites(IClientAPI client) { + //needs changing ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; @@ -158,8 +172,8 @@ namespace OpenSim.Region.Environment.Scenes proper.ObjectData[0].TouchName = new byte[0]; proper.ObjectData[0].TextureID = new byte[0]; proper.ObjectData[0].SitName = new byte[0]; - proper.ObjectData[0].Name = new byte[0]; - proper.ObjectData[0].Description = new byte[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; proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.NextOwnerMask; proper.ObjectData[0].GroupMask = this.rootPrimitive.GroupMask; -- cgit v1.1