From b06308e1d30022f1a240fdc7ca875cc7277b10ea Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Jul 2010 17:12:43 +0100 Subject: 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. --- .../CoreModules/World/Media/Moap/MoapModule.cs | 46 ++++++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 6755df7..4818546 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs @@ -311,19 +311,59 @@ namespace OpenSim.Region.CoreModules.Media.Moap { m_log.DebugFormat("[MOAP]: Setting all new media list for {0}", part.Name); part.Shape.Media = new List(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 - { + { // We need to go through the media textures one at a time to make sure that we have permission // 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++) - { + { if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, 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); } } + + 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); -- cgit v1.1