diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index b8943adbe8..898ca4a4c3 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -250,11 +250,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
UpdateMediaUrl(part, UUID.Zero);
- // Temporary code to fix llSetPrimMediaParams() bug, pending refactoring
- Primitive.TextureEntry te = part.Shape.Textures;
- Primitive.TextureEntryFace teFace = te.CreateFace((uint)face);
- teFace.MediaFlags = me != null;
- part.Shape.Textures = te;
+ SetPartMediaFlags(part, face, me != null);
part.ScheduleFullUpdate();
part.TriggerScriptChangedEvent(Changed.MEDIA);
@@ -270,6 +266,23 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
SetMediaEntry(part, face, null);
}
+ ///
+ /// Set the media flags on the texture face of the given part.
+ ///
+ ///
+ /// The fact that we need a separate function to do what should be a simple one line operation is BUTT UGLY.
+ ///
+ ///
+ ///
+ ///
+ protected void SetPartMediaFlags(SceneObjectPart part, int face, bool flag)
+ {
+ Primitive.TextureEntry te = part.Shape.Textures;
+ Primitive.TextureEntryFace teFace = te.CreateFace((uint)face);
+ teFace.MediaFlags = flag;
+ part.Shape.Textures = te;
+ }
+
///
/// Sets or gets per face media textures.
///
@@ -393,10 +406,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
// 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;
+ SetPartMediaFlags(part, i, true);
// m_log.DebugFormat(
// "[MOAP]: Media flags for face {0} is {1}",
// i, part.Shape.Textures.FaceTextures[i].MediaFlags);
@@ -428,8 +438,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
if (null == media[i])
continue;
- Primitive.TextureEntryFace face = te.CreateFace((uint)i);
- face.MediaFlags = true;
+ SetPartMediaFlags(part, i, true);
// m_log.DebugFormat(
// "[MOAP]: Media flags for face {0} is {1}",