private void HandleObjectMediaUpdate(HttpRequest httpreq, Map reqmap) { UUID objectID = reqmap["object_id"].AsUUID; ObjectPart part; try { part = m_Scene.Primitives[objectID]; } catch { using (var resp = httpreq.BeginResponse(HttpStatusCode.OK, "OK")) { resp.ContentType = "text/plain"; } return; } var media = new PrimitiveMedia(); foreach (var v in (AnArray)reqmap["object_media_data"]) { var vm = v as Map; if (vm != null) { media.Add((PrimitiveMedia.Entry)vm); } else { media.Add(null); } } if (part.CheckPermissions(m_Agent.Owner, part.ObjectGroup.Group, Types.Inventory.InventoryPermissionsMask.Modify)) { part.UpdateMedia(media, m_Agent.ID); } using (var resp = httpreq.BeginResponse(HttpStatusCode.OK, "OK")) { resp.ContentType = "text/plain"; } }
public void UpdateMediaFace(int face, PrimitiveMedia.Entry entry, UUID updaterID) { if (face >= 32) { return; } lock (m_DataLock) { string mediaURL; if (string.IsNullOrEmpty(m_MediaURL)) { mediaURL = "x-mv:00000000/" + updaterID.ToString(); } else { string rawVersion = m_MediaURL.Substring(5, 10); int version = int.Parse(rawVersion); mediaURL = string.Format("x-mv:{0:D10}/{1}", ++version, updaterID); } if (m_Media == null) { m_Media = new PrimitiveMedia(); } while (m_Media.Count <= face) { m_Media.Add(null); } m_Media[face] = entry; m_MediaURL = mediaURL; } UpdateData(UpdateDataFlags.AllObjectUpdate); if (m_ParentInfo == null) { foreach (ObjectPartLocalizedInfo localization in m_Part.NamedLocalizations) { if (!localization.HasMedia) { localization.UpdateData(UpdateDataFlags.AllObjectUpdate); } } } m_Part.TriggerOnUpdate(UpdateChangedFlags.Media); }