Can change the name and description of a prim.

Sugilite
MW 2007-07-01 18:33:44 +00:00
parent 9800c05c1b
commit 54ef77f0fd
10 changed files with 112 additions and 10 deletions

View File

@ -51,6 +51,7 @@ namespace OpenSim.Framework.Interfaces
public delegate void GenericCall4(Packet packet, IClientAPI remoteClient);
public delegate void GenericCall5(IClientAPI remoteClient, bool status);
public delegate void GenericCall6(LLUUID uid);
public delegate void GenericCall7(uint localID, string message);
public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock);
public delegate void ObjectSelect(uint localID, IClientAPI remoteClient);
@ -96,6 +97,8 @@ namespace OpenSim.Framework.Interfaces
event UpdateShape OnUpdatePrimShape;
event ObjectSelect OnObjectSelect;
event GenericCall7 OnObjectDescription;
event GenericCall7 OnObjectName;
event UpdatePrimFlags OnUpdatePrimFlags;
event UpdatePrimTexture OnUpdatePrimTexture;
event UpdateVector OnUpdatePrimPosition;

View File

@ -58,6 +58,8 @@ namespace OpenSim.Region.ClientStack
public event GenericCall4 OnAddPrim;
public event UpdateShape OnUpdatePrimShape;
public event ObjectSelect OnObjectSelect;
public event GenericCall7 OnObjectDescription;
public event GenericCall7 OnObjectName;
public event UpdatePrimFlags OnUpdatePrimFlags;
public event UpdatePrimTexture OnUpdatePrimTexture;
public event UpdateVector OnUpdatePrimPosition;

View File

@ -167,8 +167,8 @@ namespace OpenSim.Region.ClientStack
case PacketType.AgentUpdate:
if (OnAgentUpdate != null)
{
AgentUpdatePacket agenUpdate = (AgentUpdatePacket) Pack;
OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation );
AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack;
OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation);
}
break;
case PacketType.AgentAnimation:
@ -274,6 +274,29 @@ namespace OpenSim.Region.ClientStack
OnDeGrapObject(deGrap.ObjectData.LocalID, this);
}
break;
case PacketType.ObjectDescription:
ObjectDescriptionPacket objDes = (ObjectDescriptionPacket)Pack;
for (int i = 0; i < objDes.ObjectData.Length; i++)
{
if (OnObjectDescription != null)
{
OnObjectDescription(objDes.ObjectData[i].LocalID, enc.GetString(objDes.ObjectData[i].Description));
}
}
break;
case PacketType.ObjectName:
ObjectNamePacket objName = (ObjectNamePacket)Pack;
for (int i = 0; i < objName.ObjectData.Length; i++)
{
if (OnObjectName != null)
{
OnObjectName(objName.ObjectData[i].LocalID, enc.GetString(objName.ObjectData[i].Name));
}
}
break;
case PacketType.ObjectPermissions:
//Console.WriteLine("permissions set " + Pack.ToString());
break;
#endregion
#region Inventory/Asset/Other related packets

View File

@ -79,6 +79,7 @@ namespace OpenSim.Region.ClientStack
private int cachedtextureserial = 0;
private RegionInfo m_regionData;
protected AuthenticateSessionsBase m_authenticateSessionsHandler;
private System.Text.Encoding enc = System.Text.Encoding.ASCII;
public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IWorld world, AssetCache assetCache, PacketServer packServer, InventoryCache inventoryCache, AuthenticateSessionsBase authenSessions )
{

View File

@ -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;

View File

@ -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;

View File

@ -21,6 +21,7 @@ namespace OpenSim.Region.Environment.Scenes
private Dictionary<LLUUID, InventoryItem> 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;

View File

@ -214,7 +214,6 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="remoteClient"></param>
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
}
}
/// <summary>
///
/// </summary>
/// <param name="primLocalID"></param>
/// <param name="description"></param>
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;
}
}
}
}
/// <summary>
///
/// </summary>
/// <param name="primLocalID"></param>
/// <param name="description"></param>
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))

View File

@ -56,7 +56,7 @@ namespace OpenSim.Region.Environment.Scenes
{
protected System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer();
protected Dictionary<libsecondlife.LLUUID, ScenePresence> Avatars;
protected Dictionary<libsecondlife.LLUUID, Primitive> Prims;
protected Dictionary<libsecondlife.LLUUID, SceneObject> 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<libsecondlife.LLUUID, EntityBase>();
Avatars = new Dictionary<LLUUID, ScenePresence>();
Prims = new Dictionary<LLUUID, Primitive>();
Prims = new Dictionary<LLUUID, SceneObject>();
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);

View File

@ -39,7 +39,7 @@ namespace OpenSim.Region.Environment.Scenes
{
public class SceneObject : EntityBase
{
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;
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;
}
/// <summary>
///
@ -141,6 +154,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="client"></param>
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;