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
parent
8e67f6dc44
commit
6ef2a72c70
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue