Properly set TextureEntry.MediaFlags when a media texture is set

Media flags is cleared via a direct TextureEntry update from the client.  If the clearing leaves no media textures on the prim, then a CAP ObjectMediaUpdate is not received.  If there are still media textures present then one is received.
This change fixes drag-and-drop on Windows (and Mac?) clients.  It may also fix problems with clearing and then subsequently setting new media textures.
prebuild-update
Justin Clark-Casey (justincc) 2010-07-21 17:12:43 +01:00
parent 60c52ac0c4
commit b06308e1d3
1 changed files with 43 additions and 3 deletions

View File

@ -311,19 +311,59 @@ namespace OpenSim.Region.CoreModules.Media.Moap
{ {
m_log.DebugFormat("[MOAP]: Setting all new media list for {0}", part.Name); m_log.DebugFormat("[MOAP]: Setting all new media list for {0}", part.Name);
part.Shape.Media = new List<MediaEntry>(omu.FaceMedia); part.Shape.Media = new List<MediaEntry>(omu.FaceMedia);
for (int i = 0; i < omu.FaceMedia.Length; i++)
{
if (omu.FaceMedia[i] != null)
{
// FIXME: Race condition here since some other texture entry manipulator may overwrite/get
// overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry
// directly.
Primitive.TextureEntry te = part.Shape.Textures;
Primitive.TextureEntryFace face = te.CreateFace((uint)i);
face.MediaFlags = true;
part.Shape.Textures = te;
m_log.DebugFormat(
"[MOAP]: Media flags for face {0} is {1}",
i, part.Shape.Textures.FaceTextures[i].MediaFlags);
}
}
} }
else else
{ {
// We need to go through the media textures one at a time to make sure that we have permission // We need to go through the media textures one at a time to make sure that we have permission
// to change them // to change them
// FIXME: Race condition here since some other texture entry manipulator may overwrite/get
// overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry
// directly.
Primitive.TextureEntry te = part.Shape.Textures;
for (int i = 0; i < media.Count; i++) for (int i = 0; i < media.Count; i++)
{ {
if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i)) if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i))
{ {
media[i] = omu.FaceMedia[i]; media[i] = omu.FaceMedia[i];
// When a face is cleared this is done by setting the MediaFlags in the TextureEntry via a normal
// texture update, so we don't need to worry about clearing MediaFlags here.
if (null == media[i])
continue;
Primitive.TextureEntryFace face = te.CreateFace((uint)i);
face.MediaFlags = true;
m_log.DebugFormat(
"[MOAP]: Media flags for face {0} is {1}",
i, face.MediaFlags);
// m_log.DebugFormat("[MOAP]: Set media entry for face {0} on {1}", i, part.Name); // m_log.DebugFormat("[MOAP]: Set media entry for face {0} on {1}", i, part.Name);
} }
} }
part.Shape.Textures = te;
// for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++)
// m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]);
} }
UpdateMediaUrl(part, agentId); UpdateMediaUrl(part, agentId);