diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | 58 |
1 files changed, 3 insertions, 55 deletions
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 339a979..52acf81 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | |||
@@ -203,67 +203,15 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
203 | if (null == part.Shape.MediaRaw) | 203 | if (null == part.Shape.MediaRaw) |
204 | return; | 204 | return; |
205 | 205 | ||
206 | using (StringReader sr = new StringReader(part.Shape.MediaRaw)) | 206 | part.Shape.Media = PrimitiveBaseShape.MediaList.FromXml(part.Shape.MediaRaw); |
207 | { | ||
208 | using (XmlTextReader xtr = new XmlTextReader(sr)) | ||
209 | { | ||
210 | xtr.MoveToContent(); | ||
211 | |||
212 | string type = xtr.GetAttribute("type"); | ||
213 | //m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type); | ||
214 | |||
215 | if (type != MEDIA_TEXTURE_TYPE) | ||
216 | return; | ||
217 | |||
218 | xtr.ReadStartElement("osmedia"); | ||
219 | |||
220 | OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml()); | ||
221 | |||
222 | PrimitiveBaseShape.MediaList mediaEntries = new PrimitiveBaseShape.MediaList(); | ||
223 | foreach (OSD osdMe in osdMeArray) | ||
224 | { | ||
225 | MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry()); | ||
226 | mediaEntries.Add(me); | ||
227 | } | ||
228 | |||
229 | xtr.ReadEndElement(); | ||
230 | |||
231 | part.Shape.Media = mediaEntries; | ||
232 | } | ||
233 | } | ||
234 | } | 207 | } |
235 | 208 | ||
236 | protected void OnSceneObjectPartPreSave(SceneObjectPart part) | 209 | protected void OnSceneObjectPartPreSave(SceneObjectPart part) |
237 | { | 210 | { |
238 | if (null == part.Shape.Media) | 211 | if (null == part.Shape.Media) |
239 | return; | 212 | return; |
240 | 213 | ||
241 | using (StringWriter sw = new StringWriter()) | 214 | part.Shape.MediaRaw = part.Shape.Media.ToXml(); |
242 | { | ||
243 | using (XmlTextWriter xtw = new XmlTextWriter(sw)) | ||
244 | { | ||
245 | xtw.WriteStartElement("osmedia"); | ||
246 | xtw.WriteAttributeString("type", MEDIA_TEXTURE_TYPE); | ||
247 | xtw.WriteAttributeString("major_version", "0"); | ||
248 | xtw.WriteAttributeString("minor_version", "1"); | ||
249 | |||
250 | OSDArray meArray = new OSDArray(); | ||
251 | foreach (MediaEntry me in part.Shape.Media) | ||
252 | { | ||
253 | OSD osd = (null == me ? new OSD() : me.GetOSD()); | ||
254 | meArray.Add(osd); | ||
255 | } | ||
256 | |||
257 | xtw.WriteStartElement("osdata"); | ||
258 | xtw.WriteRaw(OSDParser.SerializeLLSDXmlString(meArray)); | ||
259 | xtw.WriteEndElement(); | ||
260 | |||
261 | xtw.WriteEndElement(); | ||
262 | |||
263 | xtw.Flush(); | ||
264 | part.Shape.MediaRaw = sw.ToString(); | ||
265 | } | ||
266 | } | ||
267 | } | 215 | } |
268 | 216 | ||
269 | protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed) | 217 | protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed) |