From 3c89527b222c2ddc50553ce1c49f22e9f05db11b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 5 Mar 2011 00:06:51 +0000
Subject: Fix bug where llSetPrimMediaParams() reported success but never set
the media texture.
We weren't setting the TextureEntryFace.MediaFlags = true when a media texture was set directly via a script. This was being done when the viewer was setting them directly.
---
.../Region/CoreModules/World/Media/Moap/MoapModule.cs | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs')
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index 7c5d044..9132753 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -227,15 +227,24 @@ namespace OpenSim.Region.CoreModules.Media.Moap
public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
{
+// m_log.DebugFormat("[MOAP]: SetMediaEntry for {0}, face {1}", part.Name, face);
+
CheckFaceParam(part, face);
if (null == part.Shape.Media)
part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]);
-
+
lock (part.Shape.Media)
- part.Shape.Media[face] = me;
+ part.Shape.Media[face] = me;
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 = true;
+ part.Shape.Textures = te;
+
part.ScheduleFullUpdate();
part.TriggerScriptChangedEvent(Changed.MEDIA);
}
@@ -333,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
}
// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId);
-
+//
// for (int i = 0; i < omu.FaceMedia.Length; i++)
// {
// MediaEntry me = omu.FaceMedia[i];
@@ -380,6 +389,8 @@ namespace OpenSim.Region.CoreModules.Media.Moap
}
else
{
+// m_log.DebugFormat("[MOAP]: Setting existing media list for {0}", part.Name);
+
// We need to go through the media textures one at a time to make sure that we have permission
// to change them
--
cgit v1.1
From 72cb498fd0c167867d71c26e55afedc2e23ab9b4 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 5 Mar 2011 01:13:59 +0000
Subject: minor: Make MoapModule namespace consistent with other modules
---
OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs')
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index 9132753..b6ec6dc 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -50,7 +50,7 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
using OSDArray = OpenMetaverse.StructuredData.OSDArray;
using OSDMap = OpenMetaverse.StructuredData.OSDMap;
-namespace OpenSim.Region.CoreModules.Media.Moap
+namespace OpenSim.Region.CoreModules.World.Media.Moap
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")]
public class MoapModule : INonSharedRegionModule, IMoapModule
--
cgit v1.1
From 9f85ee29ac9f5e0aa8c1976944f9af12da3514db Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 5 Mar 2011 02:18:03 +0000
Subject: Change MoapModule.ClearMediaEntry to set TextureEntryFace.MediaFlags
back to false
Implement test for ClearMediaEntry()
---
.../CoreModules/World/Media/Moap/MoapModule.cs | 30 +++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs')
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index b6ec6dc..ffb3221 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -225,6 +225,12 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
return me;
}
+ ///
+ /// Set the media entry on the face of the given part.
+ ///
+ /// /param>
+ ///
+ ///
public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
{
// m_log.DebugFormat("[MOAP]: SetMediaEntry for {0}, face {1}", part.Name, face);
@@ -249,9 +255,31 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
part.TriggerScriptChangedEvent(Changed.MEDIA);
}
+ ///
+ /// Clear the media entry from the face of the given part.
+ ///
+ ///
+ ///
public void ClearMediaEntry(SceneObjectPart part, int face)
{
- SetMediaEntry(part, face, null);
+ CheckFaceParam(part, face);
+
+ // If no media has been set up yetthen we don't need to clear anything
+ if (null == part.Shape.Media)
+ return;
+
+ lock (part.Shape.Media)
+ part.Shape.Media[face] = null;
+
+ UpdateMediaUrl(part, UUID.Zero);
+
+ Primitive.TextureEntry te = part.Shape.Textures;
+ Primitive.TextureEntryFace teFace = te.CreateFace((uint)face);
+ teFace.MediaFlags = false;
+ part.Shape.Textures = te;
+
+ part.ScheduleFullUpdate();
+ part.TriggerScriptChangedEvent(Changed.MEDIA);
}
///
--
cgit v1.1
From 9e579a7891d6eb4c3e5a0593d67837ed423135ee Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 5 Mar 2011 02:21:53 +0000
Subject: Fold ClearMediaEntry() back into SetMediaEntry()
---
.../CoreModules/World/Media/Moap/MoapModule.cs | 30 +++++++---------------
1 file changed, 9 insertions(+), 21 deletions(-)
(limited to 'OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs')
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index ffb3221..b8943ad 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
///
/// /param>
///
- ///
+ /// If null, then the media entry is cleared.
public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
{
// m_log.DebugFormat("[MOAP]: SetMediaEntry for {0}, face {1}", part.Name, face);
@@ -238,7 +238,12 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
CheckFaceParam(part, face);
if (null == part.Shape.Media)
- part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]);
+ {
+ if (me == null)
+ return;
+ else
+ part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]);
+ }
lock (part.Shape.Media)
part.Shape.Media[face] = me;
@@ -248,7 +253,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
// Temporary code to fix llSetPrimMediaParams() bug, pending refactoring
Primitive.TextureEntry te = part.Shape.Textures;
Primitive.TextureEntryFace teFace = te.CreateFace((uint)face);
- teFace.MediaFlags = true;
+ teFace.MediaFlags = me != null;
part.Shape.Textures = te;
part.ScheduleFullUpdate();
@@ -262,24 +267,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
///
public void ClearMediaEntry(SceneObjectPart part, int face)
{
- CheckFaceParam(part, face);
-
- // If no media has been set up yetthen we don't need to clear anything
- if (null == part.Shape.Media)
- return;
-
- lock (part.Shape.Media)
- part.Shape.Media[face] = null;
-
- UpdateMediaUrl(part, UUID.Zero);
-
- Primitive.TextureEntry te = part.Shape.Textures;
- Primitive.TextureEntryFace teFace = te.CreateFace((uint)face);
- teFace.MediaFlags = false;
- part.Shape.Textures = te;
-
- part.ScheduleFullUpdate();
- part.TriggerScriptChangedEvent(Changed.MEDIA);
+ SetMediaEntry(part, face, null);
}
///
--
cgit v1.1
From 9b345ebf73663a04d8baa69f0fb48ab80b8b1a58 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 5 Mar 2011 02:42:47 +0000
Subject: factor out SetPartMediaFlags() function in MoapModule.
---
.../CoreModules/World/Media/Moap/MoapModule.cs | 31 ++++++++++++++--------
1 file changed, 20 insertions(+), 11 deletions(-)
(limited to 'OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs')
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index b8943ad..898ca4a 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);
@@ -271,6 +267,23 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap
}
///
+ /// 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}",
--
cgit v1.1