From d2b459b8e592b48edbdd03a154dcaa7336d5ce8d Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 18 Jul 2007 20:29:06 +0000 Subject: Sculpted Prims should now work. --- OpenSim/Region/ClientStack/ClientView.API.cs | 2 ++ .../Region/ClientStack/ClientView.ProcessPackets.cs | 9 +++++++-- OpenSim/Region/Environment/Scenes/Primitive.cs | 18 ++++++++++++++++++ .../Region/Environment/Scenes/Scene.PacketHandlers.cs | 16 ++++++++++++++++ OpenSim/Region/Environment/Scenes/Scene.cs | 1 + OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 2 ++ 6 files changed, 46 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 54ddd97..440f583 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 338471e..c248b29 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 4818348..bca8e0c 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 f39d56a..5bfdccb 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 70d2c6a..1ba23b4 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 f7bf5d6..308dea7 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; -- cgit v1.1