From 5b720b4b3952e182203490961d99e46b8744775e Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Fri, 28 Dec 2007 13:11:49 +0000 Subject: * Made a copy of parts before updating to avoid dictionary updated exceptions on big updates * The part now uses the byte[] TextureEntry instead of the object --- OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 12 +++++++++--- OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 94b6797..d3f5454 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -677,26 +677,32 @@ namespace OpenSim.Region.Environment.Scenes /// public override void Update() { + List parts = new List(m_parts.Values); + if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02) { - foreach (SceneObjectPart part in m_parts.Values) + foreach (SceneObjectPart part in parts) { if (part.UpdateFlag == 0) part.UpdateFlag = 1; } + lastPhysGroupPos = AbsolutePosition; } + if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1) || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1) || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1) || (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 0.1)) { - foreach (SceneObjectPart part in m_parts.Values) + foreach (SceneObjectPart part in parts) { if (part.UpdateFlag == 0) part.UpdateFlag = 1; } + lastPhysGroupRot = GroupRotation; } - foreach (SceneObjectPart part in m_parts.Values) + + foreach (SceneObjectPart part in parts) { part.SendScheduledUpdates(); } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index dad8812..d35cb76 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -1327,7 +1327,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void UpdateTextureEntry(byte[] textureEntry) { - m_shape.Textures = new LLObject.TextureEntry(textureEntry, 0, textureEntry.Length); + m_shape.TextureEntry = textureEntry; ScheduleFullUpdate(); } -- cgit v1.1