aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs60
1 files changed, 48 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index 7c5d044..898ca4a 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;
50using OSDArray = OpenMetaverse.StructuredData.OSDArray; 50using OSDArray = OpenMetaverse.StructuredData.OSDArray;
51using OSDMap = OpenMetaverse.StructuredData.OSDMap; 51using OSDMap = OpenMetaverse.StructuredData.OSDMap;
52 52
53namespace OpenSim.Region.CoreModules.Media.Moap 53namespace OpenSim.Region.CoreModules.World.Media.Moap
54{ 54{
55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")] 55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")]
56 public class MoapModule : INonSharedRegionModule, IMoapModule 56 public class MoapModule : INonSharedRegionModule, IMoapModule
@@ -225,24 +225,62 @@ namespace OpenSim.Region.CoreModules.Media.Moap
225 return me; 225 return me;
226 } 226 }
227 227
228 /// <summary>
229 /// Set the media entry on the face of the given part.
230 /// </summary>
231 /// <param name="part">/param>
232 /// <param name="face"></param>
233 /// <param name="me">If null, then the media entry is cleared.</param>
228 public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me) 234 public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
229 { 235 {
236// m_log.DebugFormat("[MOAP]: SetMediaEntry for {0}, face {1}", part.Name, face);
237
230 CheckFaceParam(part, face); 238 CheckFaceParam(part, face);
231 239
232 if (null == part.Shape.Media) 240 if (null == part.Shape.Media)
233 part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]); 241 {
234 242 if (me == null)
243 return;
244 else
245 part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]);
246 }
247
235 lock (part.Shape.Media) 248 lock (part.Shape.Media)
236 part.Shape.Media[face] = me; 249 part.Shape.Media[face] = me;
237 250
238 UpdateMediaUrl(part, UUID.Zero); 251 UpdateMediaUrl(part, UUID.Zero);
252
253 SetPartMediaFlags(part, face, me != null);
254
239 part.ScheduleFullUpdate(); 255 part.ScheduleFullUpdate();
240 part.TriggerScriptChangedEvent(Changed.MEDIA); 256 part.TriggerScriptChangedEvent(Changed.MEDIA);
241 } 257 }
242 258
259 /// <summary>
260 /// Clear the media entry from the face of the given part.
261 /// </summary>
262 /// <param name="part"></param>
263 /// <param name="face"></param>
243 public void ClearMediaEntry(SceneObjectPart part, int face) 264 public void ClearMediaEntry(SceneObjectPart part, int face)
244 { 265 {
245 SetMediaEntry(part, face, null); 266 SetMediaEntry(part, face, null);
267 }
268
269 /// <summary>
270 /// Set the media flags on the texture face of the given part.
271 /// </summary>
272 /// <remarks>
273 /// The fact that we need a separate function to do what should be a simple one line operation is BUTT UGLY.
274 /// </remarks>
275 /// <param name="part"></param>
276 /// <param name="face"></param>
277 /// <param name="flag"></param>
278 protected void SetPartMediaFlags(SceneObjectPart part, int face, bool flag)
279 {
280 Primitive.TextureEntry te = part.Shape.Textures;
281 Primitive.TextureEntryFace teFace = te.CreateFace((uint)face);
282 teFace.MediaFlags = flag;
283 part.Shape.Textures = te;
246 } 284 }
247 285
248 /// <summary> 286 /// <summary>
@@ -333,7 +371,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
333 } 371 }
334 372
335// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); 373// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId);
336 374//
337// for (int i = 0; i < omu.FaceMedia.Length; i++) 375// for (int i = 0; i < omu.FaceMedia.Length; i++)
338// { 376// {
339// MediaEntry me = omu.FaceMedia[i]; 377// MediaEntry me = omu.FaceMedia[i];
@@ -368,10 +406,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
368 // FIXME: Race condition here since some other texture entry manipulator may overwrite/get 406 // FIXME: Race condition here since some other texture entry manipulator may overwrite/get
369 // overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry 407 // overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry
370 // directly. 408 // directly.
371 Primitive.TextureEntry te = part.Shape.Textures; 409 SetPartMediaFlags(part, i, true);
372 Primitive.TextureEntryFace face = te.CreateFace((uint)i);
373 face.MediaFlags = true;
374 part.Shape.Textures = te;
375// m_log.DebugFormat( 410// m_log.DebugFormat(
376// "[MOAP]: Media flags for face {0} is {1}", 411// "[MOAP]: Media flags for face {0} is {1}",
377// i, part.Shape.Textures.FaceTextures[i].MediaFlags); 412// i, part.Shape.Textures.FaceTextures[i].MediaFlags);
@@ -380,6 +415,8 @@ namespace OpenSim.Region.CoreModules.Media.Moap
380 } 415 }
381 else 416 else
382 { 417 {
418// m_log.DebugFormat("[MOAP]: Setting existing media list for {0}", part.Name);
419
383 // We need to go through the media textures one at a time to make sure that we have permission 420 // We need to go through the media textures one at a time to make sure that we have permission
384 // to change them 421 // to change them
385 422
@@ -401,8 +438,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
401 if (null == media[i]) 438 if (null == media[i])
402 continue; 439 continue;
403 440
404 Primitive.TextureEntryFace face = te.CreateFace((uint)i); 441 SetPartMediaFlags(part, i, true);
405 face.MediaFlags = true;
406 442
407 // m_log.DebugFormat( 443 // m_log.DebugFormat(
408 // "[MOAP]: Media flags for face {0} is {1}", 444 // "[MOAP]: Media flags for face {0} is {1}",