diff options
-rw-r--r-- | OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index f5aa40a..66a7df1 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | |||
@@ -219,9 +219,13 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap | |||
219 | lock (media) | 219 | lock (media) |
220 | me = media[face]; | 220 | me = media[face]; |
221 | 221 | ||
222 | // TODO: Really need a proper copy constructor down in libopenmetaverse | ||
223 | if (me != null) | 222 | if (me != null) |
224 | me = MediaEntry.FromOSD(me.GetOSD()); | 223 | { |
224 | Primitive.TextureEntry te = part.Shape.Textures; | ||
225 | Primitive.TextureEntryFace teFace = te.GetFace((uint)face); | ||
226 | if (teFace != null && teFace.MediaFlags) | ||
227 | me = MediaEntry.FromOSD(me.GetOSD()); | ||
228 | } | ||
225 | } | 229 | } |
226 | 230 | ||
227 | // m_log.DebugFormat("[MOAP]: GetMediaEntry for {0} face {1} found {2}", part.Name, face, me); | 231 | // m_log.DebugFormat("[MOAP]: GetMediaEntry for {0} face {1} found {2}", part.Name, face, me); |
@@ -336,15 +340,40 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap | |||
336 | return string.Empty; | 340 | return string.Empty; |
337 | } | 341 | } |
338 | 342 | ||
339 | if (null == part.Shape.Media) | 343 | if (part.Shape.Media == null) |
340 | return string.Empty; | 344 | return string.Empty; |
341 | 345 | ||
342 | ObjectMediaResponse resp = new ObjectMediaResponse(); | 346 | MediaEntry[] currentML = part.Shape.Media.ToArray(); |
347 | |||
348 | int nentries = currentML.Length; | ||
349 | int nsides = part.GetNumberOfSides(); | ||
350 | if(nentries > nsides) | ||
351 | nentries = nsides; | ||
343 | 352 | ||
353 | Primitive.TextureEntry te = part.Shape.Textures; | ||
354 | bool isnull = true; | ||
355 | |||
356 | for(int face = 0; face < nentries; ++face) | ||
357 | { | ||
358 | Primitive.TextureEntryFace teFace = te.GetFace((uint)face); | ||
359 | if(!teFace.MediaFlags) | ||
360 | currentML[face] = null; | ||
361 | else | ||
362 | isnull = false; | ||
363 | } | ||
364 | |||
365 | if(isnull) | ||
366 | { | ||
367 | //remove the damm thing | ||
368 | part.Shape.Media = null; | ||
369 | part.MediaUrl = null; | ||
370 | return string.Empty; | ||
371 | } | ||
372 | |||
373 | ObjectMediaResponse resp = new ObjectMediaResponse(); | ||
344 | resp.PrimID = primId; | 374 | resp.PrimID = primId; |
345 | 375 | ||
346 | lock (part.Shape.Media) | 376 | resp.FaceMedia = currentML; |
347 | resp.FaceMedia = part.Shape.Media.ToArray(); | ||
348 | 377 | ||
349 | resp.Version = part.MediaUrl; | 378 | resp.Version = part.MediaUrl; |
350 | 379 | ||