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.

user_profiles
dahlia 2013-04-19 00:35:06 -07:00
parent 06829c4082
commit 9ae24cac2f
1 changed files with 35 additions and 11 deletions

View File

@ -4549,6 +4549,14 @@ namespace OpenSim.Region.Framework.Scenes
oldTex.DefaultTexture = fallbackOldFace; 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++) for (int i = 0 ; i < GetNumberOfSides(); i++)
{ {
@ -4571,24 +4579,40 @@ namespace OpenSim.Region.Framework.Scenes
if (oldFace.TextureID != newFace.TextureID) if (oldFace.TextureID != newFace.TextureID)
changeFlags |= Changed.TEXTURE; changeFlags |= Changed.TEXTURE;
if (oldFace.MaterialID != newFace.MaterialID)
changeFlags |= Changed.TEXTURE;
// Max change, skip the rest of testing // Max change, skip the rest of testing
if (changeFlags == (Changed.TEXTURE | Changed.COLOR)) if (changeFlags == (Changed.TEXTURE | Changed.COLOR))
break; 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 || otherFieldsChanged)
if (changeFlags != 0) {
TriggerScriptChangedEvent(changeFlags); m_shape.TextureEntry = newTex.GetBytes();
UpdateFlag = UpdateRequired.FULL; if (changeFlags != 0)
ParentGroup.HasGroupChanged = true; TriggerScriptChangedEvent(changeFlags);
UpdateFlag = UpdateRequired.FULL;
ParentGroup.HasGroupChanged = true;
//This is madness.. //This is madness..
//ParentGroup.ScheduleGroupForFullUpdate(); //ParentGroup.ScheduleGroupForFullUpdate();
//This is sparta //This is sparta
ScheduleFullUpdate(); ScheduleFullUpdate();
}
} }
public void aggregateScriptEvents() public void aggregateScriptEvents()