diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index c7e1901f8c..858126b81f 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs @@ -53,6 +53,7 @@ namespace OpenSim.Framework.Interfaces public delegate void GenericCall7(uint localID, string message); public delegate void UpdateShape(uint localID, ObjectShapePacket.ObjectDataBlock shapeBlock); + public delegate void ObjectExtraParams(uint localID, ushort type, bool inUse, byte[] data); public delegate void ObjectSelect(uint localID, IClientAPI remoteClient); public delegate void ObjectDeselect(uint localID, IClientAPI remoteClient); public delegate void UpdatePrimFlags(uint localID, Packet packet, IClientAPI remoteClient); @@ -106,6 +107,7 @@ namespace OpenSim.Framework.Interfaces event MoveObject OnGrapUpdate; event UpdateShape OnUpdatePrimShape; + event ObjectExtraParams OnUpdateExtraParams; event ObjectSelect OnObjectSelect; event ObjectDeselect OnObjectDeselect; event GenericCall7 OnObjectDescription; diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs index 44bc588b49..a5539efd0e 100644 --- a/OpenSim/Framework/General/NullClientAPI.cs +++ b/OpenSim/Framework/General/NullClientAPI.cs @@ -35,6 +35,7 @@ namespace OpenSim.Framework public event MoveObject OnGrapUpdate; public event UpdateShape OnUpdatePrimShape; + public event ObjectExtraParams OnUpdateExtraParams; public event ObjectSelect OnObjectSelect; public event GenericCall7 OnObjectDescription; public event GenericCall7 OnObjectName; diff --git a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs index a5822090b3..d08c9037af 100644 --- a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs @@ -42,6 +42,7 @@ namespace OpenSim.Framework.Types public sbyte PathTwist; public sbyte PathTwistBegin; public byte[] TextureEntry; // a LL textureEntry in byte[] format + public byte[] ExtraParams; public ShapeType PrimType { @@ -61,7 +62,7 @@ namespace OpenSim.Framework.Types public PrimitiveBaseShape() { - + ExtraParams = new byte[1]; } //void returns need to change of course @@ -81,6 +82,7 @@ namespace OpenSim.Framework.Types public BoxShape() { type = ShapeType.Box; + ExtraParams = new byte[1]; } public static BoxShape Default @@ -111,6 +113,7 @@ namespace OpenSim.Framework.Types primShape.PathTwistBegin = 0; LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")); primShape.TextureEntry = ntex.ToBytes(); + primShape.ExtraParams = new byte[1]; return primShape; } @@ -122,6 +125,7 @@ namespace OpenSim.Framework.Types public SphereShape() { type = ShapeType.Sphere; + ExtraParams = new byte[1]; } } } diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 54ddd97d4f..440f583855 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -59,6 +59,7 @@ namespace OpenSim.Region.ClientStack public event ObjectDuplicate OnObjectDuplicate; public event MoveObject OnGrapUpdate; public event AddNewPrim OnAddPrim; + public event ObjectExtraParams OnUpdateExtraParams; public event UpdateShape OnUpdatePrimShape; public event ObjectSelect OnObjectSelect; public event ObjectDeselect OnObjectDeselect; @@ -968,6 +969,7 @@ namespace OpenSim.Region.ClientStack objectData.PathTaperY = primData.PathTaperY; objectData.PathTwist = primData.PathTwist; objectData.PathTwistBegin = primData.PathTwistBegin; + objectData.ExtraParams = primData.ExtraParams; } /// diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 338471e256..c248b2922d 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -218,8 +218,6 @@ namespace OpenSim.Region.ClientStack if (OnAddPrim != null) { ObjectAddPacket addPacket = (ObjectAddPacket) Pack ; - Console.WriteLine(addPacket.ToString()); - PrimitiveBaseShape shape = new PrimitiveBaseShape(); shape.PCode = addPacket.ObjectData.PCode; @@ -258,6 +256,13 @@ namespace OpenSim.Region.ClientStack } } break; + case PacketType.ObjectExtraParams: + ObjectExtraParamsPacket extraPar = (ObjectExtraParamsPacket)Pack; + if (OnUpdateExtraParams != null) + { + OnUpdateExtraParams(extraPar.ObjectData[0].ObjectLocalID, extraPar.ObjectData[0].ParamType, extraPar.ObjectData[0].ParamInUse, extraPar.ObjectData[0].ParamData); + } + break; case PacketType.ObjectDuplicate: ObjectDuplicatePacket dupe = (ObjectDuplicatePacket)Pack; for (int i = 0; i < dupe.ObjectData.Length; i++) diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 4818348f73..bca8e0c7fd 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -588,6 +588,24 @@ namespace OpenSim.Region.Environment.Scenes #endregion + public void UpdateExtraParam(ushort type, bool inUse, byte[] data) + { + this.m_Shape.ExtraParams = new byte[data.Length + 7]; + int i =0; + uint length = (uint) data.Length; + this.m_Shape.ExtraParams[i++] = 1; + this.m_Shape.ExtraParams[i++] = (byte)(type % 256); + this.m_Shape.ExtraParams[i++] = (byte)((type >> 8) % 256); + + this.m_Shape.ExtraParams[i++] = (byte)(length % 256); + this.m_Shape.ExtraParams[i++] = (byte)((length >> 8) % 256); + this.m_Shape.ExtraParams[i++] = (byte)((length >> 16) % 256); + this.m_Shape.ExtraParams[i++] = (byte)((length >> 24) % 256); + Array.Copy(data, 0, this.m_Shape.ExtraParams, i, data.Length); + + this.ScheduleFullUpdate(); + } + #region Texture /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index f39d56ad66..5bfdccb373 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -327,6 +327,22 @@ namespace OpenSim.Region.Environment.Scenes } } + public void UpdateExtraParam(uint primLocalID, ushort type, bool inUse, byte[] data) + { + Primitive prim = null; + foreach (EntityBase ent in Entities.Values) + { + if (ent is SceneObject) + { + prim = ((SceneObject)ent).HasChildPrim(primLocalID); + if (prim != null) + { + prim.UpdateExtraParam(type, inUse, data); + break; + } + } + } + } /// /// /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 70d2c6afc9..1ba23b48a3 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -548,6 +548,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnUpdatePrimGroupMouseRotation += UpdatePrimRotation; client.OnUpdatePrimSingleRotation += UpdatePrimSingleRotation; client.OnUpdatePrimScale += UpdatePrimScale; + client.OnUpdateExtraParams += UpdateExtraParam; client.OnUpdatePrimShape += UpdatePrimShape; client.OnRequestMapBlocks += RequestMapBlocks; client.OnUpdatePrimTexture += UpdatePrimTexture; diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index f7bf5d69bf..308dea73ae 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs @@ -47,7 +47,9 @@ namespace SimpleApp public event ObjectSelect OnDeGrapObject; public event MoveObject OnGrapUpdate; + public event UpdateShape OnUpdatePrimShape; + public event ObjectExtraParams OnUpdateExtraParams; public event ObjectSelect OnObjectSelect; public event GenericCall7 OnObjectDescription; public event GenericCall7 OnObjectName;