diff options
author | Justin Clark-Casey (justincc) | 2010-08-03 17:09:20 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-08-03 17:09:20 +0100 |
commit | 99c0f4c9c7820f6340155f7af30ab91745774c93 (patch) | |
tree | d59a9f8986b41bb7d60928b9675a6e3b14cb07b9 /OpenSim/Region/CoreModules | |
parent | get rid of PrimitiveBaseShape.MediaRaw staging post (diff) | |
download | opensim-SC-99c0f4c9c7820f6340155f7af30ab91745774c93.zip opensim-SC-99c0f4c9c7820f6340155f7af30ab91745774c93.tar.gz opensim-SC-99c0f4c9c7820f6340155f7af30ab91745774c93.tar.bz2 opensim-SC-99c0f4c9c7820f6340155f7af30ab91745774c93.tar.xz |
Simplify serialized version string. Change element capitalization for consistency
THIS CHANGE ALTERS THE SERIALIZATION FORMAT, HOPEFULLY FOR THE LAST TIME. If you're testing, please start with a new database.
This commit also improves locking for manipulation of media entries.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | 76 |
1 files changed, 45 insertions, 31 deletions
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index d7ce184..8549b36 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | |||
@@ -185,13 +185,15 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
185 | if (original.Shape.Media != null) | 185 | if (original.Shape.Media != null) |
186 | { | 186 | { |
187 | PrimitiveBaseShape.MediaList dupeMedia = new PrimitiveBaseShape.MediaList(); | 187 | PrimitiveBaseShape.MediaList dupeMedia = new PrimitiveBaseShape.MediaList(); |
188 | 188 | lock (original.Shape.Media) | |
189 | foreach (MediaEntry me in original.Shape.Media) | ||
190 | { | 189 | { |
191 | if (me != null) | 190 | foreach (MediaEntry me in original.Shape.Media) |
192 | dupeMedia.Add(MediaEntry.FromOSD(me.GetOSD())); | 191 | { |
193 | else | 192 | if (me != null) |
194 | dupeMedia.Add(null); | 193 | dupeMedia.Add(MediaEntry.FromOSD(me.GetOSD())); |
194 | else | ||
195 | dupeMedia.Add(null); | ||
196 | } | ||
195 | } | 197 | } |
196 | 198 | ||
197 | copy.Shape.Media = dupeMedia; | 199 | copy.Shape.Media = dupeMedia; |
@@ -211,8 +213,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
211 | me = null; | 213 | me = null; |
212 | } | 214 | } |
213 | else | 215 | else |
214 | { | 216 | { |
215 | me = media[face]; | 217 | lock (media) |
218 | me = media[face]; | ||
216 | 219 | ||
217 | // TODO: Really need a proper copy constructor down in libopenmetaverse | 220 | // TODO: Really need a proper copy constructor down in libopenmetaverse |
218 | if (me != null) | 221 | if (me != null) |
@@ -230,11 +233,13 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
230 | 233 | ||
231 | if (null == part.Shape.Media) | 234 | if (null == part.Shape.Media) |
232 | part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]); | 235 | part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]); |
233 | 236 | ||
234 | part.Shape.Media[face] = me; | 237 | lock (part.Shape.Media) |
238 | part.Shape.Media[face] = me; | ||
239 | |||
235 | UpdateMediaUrl(part, UUID.Zero); | 240 | UpdateMediaUrl(part, UUID.Zero); |
236 | part.ScheduleFullUpdate(); | 241 | part.ScheduleFullUpdate(); |
237 | part.TriggerScriptChangedEvent(Changed.MEDIA); | 242 | part.TriggerScriptChangedEvent(Changed.MEDIA); |
238 | } | 243 | } |
239 | 244 | ||
240 | public void ClearMediaEntry(SceneObjectPart part, int face) | 245 | public void ClearMediaEntry(SceneObjectPart part, int face) |
@@ -296,7 +301,10 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
296 | ObjectMediaResponse resp = new ObjectMediaResponse(); | 301 | ObjectMediaResponse resp = new ObjectMediaResponse(); |
297 | 302 | ||
298 | resp.PrimID = primId; | 303 | resp.PrimID = primId; |
299 | resp.FaceMedia = part.Shape.Media.ToArray(); | 304 | |
305 | lock (part.Shape.Media) | ||
306 | resp.FaceMedia = part.Shape.Media.ToArray(); | ||
307 | |||
300 | resp.Version = part.MediaUrl; | 308 | resp.Version = part.MediaUrl; |
301 | 309 | ||
302 | string rawResp = OSDParser.SerializeLLSDXmlString(resp.Serialize()); | 310 | string rawResp = OSDParser.SerializeLLSDXmlString(resp.Serialize()); |
@@ -382,24 +390,27 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
382 | // directly. | 390 | // directly. |
383 | Primitive.TextureEntry te = part.Shape.Textures; | 391 | Primitive.TextureEntry te = part.Shape.Textures; |
384 | 392 | ||
385 | for (int i = 0; i < media.Count; i++) | 393 | lock (media) |
386 | { | 394 | { |
387 | if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i)) | 395 | for (int i = 0; i < media.Count; i++) |
388 | { | 396 | { |
389 | media[i] = omu.FaceMedia[i]; | 397 | if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i)) |
390 | 398 | { | |
391 | // When a face is cleared this is done by setting the MediaFlags in the TextureEntry via a normal | 399 | media[i] = omu.FaceMedia[i]; |
392 | // texture update, so we don't need to worry about clearing MediaFlags here. | 400 | |
393 | if (null == media[i]) | 401 | // When a face is cleared this is done by setting the MediaFlags in the TextureEntry via a normal |
394 | continue; | 402 | // texture update, so we don't need to worry about clearing MediaFlags here. |
395 | 403 | if (null == media[i]) | |
396 | Primitive.TextureEntryFace face = te.CreateFace((uint)i); | 404 | continue; |
397 | face.MediaFlags = true; | 405 | |
398 | 406 | Primitive.TextureEntryFace face = te.CreateFace((uint)i); | |
399 | // m_log.DebugFormat( | 407 | face.MediaFlags = true; |
400 | // "[MOAP]: Media flags for face {0} is {1}", | 408 | |
401 | // i, face.MediaFlags); | 409 | // m_log.DebugFormat( |
402 | // m_log.DebugFormat("[MOAP]: Set media entry for face {0} on {1}", i, part.Name); | 410 | // "[MOAP]: Media flags for face {0} is {1}", |
411 | // i, face.MediaFlags); | ||
412 | // m_log.DebugFormat("[MOAP]: Set media entry for face {0} on {1}", i, part.Name); | ||
413 | } | ||
403 | } | 414 | } |
404 | } | 415 | } |
405 | 416 | ||
@@ -465,7 +476,10 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
465 | if (null == part.Shape.Media) | 476 | if (null == part.Shape.Media) |
466 | return string.Empty; | 477 | return string.Empty; |
467 | 478 | ||
468 | MediaEntry me = part.Shape.Media[omn.Face]; | 479 | MediaEntry me = null; |
480 | |||
481 | lock (part.Shape.Media) | ||
482 | me = part.Shape.Media[omn.Face]; | ||
469 | 483 | ||
470 | // Do the same if media has not been set up for a specific face | 484 | // Do the same if media has not been set up for a specific face |
471 | if (null == me) | 485 | if (null == me) |