* 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
afrisby
lbsa71 2007-12-28 13:11:49 +00:00
parent 6a02900c8a
commit 5b720b4b39
2 changed files with 10 additions and 4 deletions

View File

@ -677,26 +677,32 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public override void Update() public override void Update()
{ {
List<SceneObjectPart> parts = new List<SceneObjectPart>(m_parts.Values);
if (Util.GetDistanceTo(lastPhysGroupPos, AbsolutePosition) > 0.02) 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; if (part.UpdateFlag == 0) part.UpdateFlag = 1;
} }
lastPhysGroupPos = AbsolutePosition; lastPhysGroupPos = AbsolutePosition;
} }
if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1) if ((Math.Abs(lastPhysGroupRot.W - GroupRotation.W) > 0.1)
|| (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1) || (Math.Abs(lastPhysGroupRot.X - GroupRotation.X) > 0.1)
|| (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1) || (Math.Abs(lastPhysGroupRot.Y - GroupRotation.Y) > 0.1)
|| (Math.Abs(lastPhysGroupRot.Z - GroupRotation.Z) > 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; if (part.UpdateFlag == 0) part.UpdateFlag = 1;
} }
lastPhysGroupRot = GroupRotation; lastPhysGroupRot = GroupRotation;
} }
foreach (SceneObjectPart part in m_parts.Values)
foreach (SceneObjectPart part in parts)
{ {
part.SendScheduledUpdates(); part.SendScheduledUpdates();
} }

View File

@ -1327,7 +1327,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="textureEntry"></param> /// <param name="textureEntry"></param>
public void UpdateTextureEntry(byte[] textureEntry) public void UpdateTextureEntry(byte[] textureEntry)
{ {
m_shape.Textures = new LLObject.TextureEntry(textureEntry, 0, textureEntry.Length); m_shape.TextureEntry = textureEntry;
ScheduleFullUpdate(); ScheduleFullUpdate();
} }