From 9ae24cac2fcf5ac00ec8e4ccae5e58e9ff90db74 Mon Sep 17 00:00:00 2001 From: dahlia Date: Fri, 19 Apr 2013 00:35:06 -0700 Subject: Materials-capable viewers send ImageUpdate packets when updating materials that are normally sent via RenderMaterials CAP. This can cause a race condition for updating TextureEntry fields. Therefore filter any TextureEntry updates so they only update if something actually changed. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 46 ++++++++++++++++------ 1 file changed, 35 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0e85b87..347a2b5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4549,6 +4549,14 @@ namespace OpenSim.Region.Framework.Scenes oldTex.DefaultTexture = fallbackOldFace; } + // Materials capable viewers can send a ObjectImage packet + // when nothing in TE has changed. MaterialID should be updated + // by the RenderMaterials CAP handler, so updating it here may cause a + // race condtion. Therefore, if no non-materials TE fields have changed, + // we should ignore any changes and not update Shape.TextureEntry + + bool otherFieldsChanged = false; + for (int i = 0 ; i < GetNumberOfSides(); i++) { @@ -4571,24 +4579,40 @@ namespace OpenSim.Region.Framework.Scenes if (oldFace.TextureID != newFace.TextureID) changeFlags |= Changed.TEXTURE; - if (oldFace.MaterialID != newFace.MaterialID) - changeFlags |= Changed.TEXTURE; // Max change, skip the rest of testing if (changeFlags == (Changed.TEXTURE | Changed.COLOR)) break; + + if (!otherFieldsChanged) + { + if (oldFace.Bump != newFace.Bump) otherFieldsChanged = true; + if (oldFace.Fullbright != newFace.Fullbright) otherFieldsChanged = true; + if (oldFace.Glow != newFace.Glow) otherFieldsChanged = true; + if (oldFace.MediaFlags != newFace.MediaFlags) otherFieldsChanged = true; + if (oldFace.OffsetU != newFace.OffsetU) otherFieldsChanged = true; + if (oldFace.OffsetV != newFace.OffsetV) otherFieldsChanged = true; + if (oldFace.RepeatU != newFace.RepeatU) otherFieldsChanged = true; + if (oldFace.RepeatV != newFace.RepeatV) otherFieldsChanged = true; + if (oldFace.Rotation != newFace.Rotation) otherFieldsChanged = true; + if (oldFace.Shiny != newFace.Shiny) otherFieldsChanged = true; + if (oldFace.TexMapType != newFace.TexMapType) otherFieldsChanged = true; + } } - m_shape.TextureEntry = newTex.GetBytes(); - if (changeFlags != 0) - TriggerScriptChangedEvent(changeFlags); - UpdateFlag = UpdateRequired.FULL; - ParentGroup.HasGroupChanged = true; + if (changeFlags != 0 || otherFieldsChanged) + { + m_shape.TextureEntry = newTex.GetBytes(); + if (changeFlags != 0) + TriggerScriptChangedEvent(changeFlags); + UpdateFlag = UpdateRequired.FULL; + ParentGroup.HasGroupChanged = true; - //This is madness.. - //ParentGroup.ScheduleGroupForFullUpdate(); - //This is sparta - ScheduleFullUpdate(); + //This is madness.. + //ParentGroup.ScheduleGroupForFullUpdate(); + //This is sparta + ScheduleFullUpdate(); + } } public void aggregateScriptEvents() -- cgit v1.1