start storing a mediaurl on the scene object part

not yet persisted or sent in the update
prebuild-update
Justin Clark-Casey (justincc) 2010-07-01 19:25:46 +01:00
parent c290cdd997
commit 4a6adff4cd
2 changed files with 30 additions and 7 deletions

View File

@ -91,7 +91,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
// avatar that set the texture in the first place. // avatar that set the texture in the first place.
// Even though we're registering for POST we're going to get GETS and UPDATES too // Even though we're registering for POST we're going to get GETS and UPDATES too
caps.RegisterHandler( caps.RegisterHandler(
"ObjectMedia", new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), HandleObjectMediaRequest)); "ObjectMedia", new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), HandleObjectMediaMessage));
// We do get these posts when the url has been changed. // We do get these posts when the url has been changed.
// Even though we're registering for POST we're going to get GETS and UPDATES too // Even though we're registering for POST we're going to get GETS and UPDATES too
@ -108,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
/// <param name="httpRequest"></param> /// <param name="httpRequest"></param>
/// <param name="httpResponse"></param> /// <param name="httpResponse"></param>
/// <returns></returns> /// <returns></returns>
protected string HandleObjectMediaRequest( protected string HandleObjectMediaMessage(
string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{ {
m_log.DebugFormat("[MOAP]: Got ObjectMedia raw request [{0}]", request); m_log.DebugFormat("[MOAP]: Got ObjectMedia raw request [{0}]", request);
@ -167,10 +167,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
resp.PrimID = primId; resp.PrimID = primId;
resp.FaceMedia = part.Shape.Media.ToArray(); resp.FaceMedia = part.Shape.Media.ToArray();
resp.Version = part.MediaUrl;
// I know this has to end with the last avatar to edit and the version code shouldn't always be 16. Just trying
// to minimally satisfy for now to get something working
resp.Version = "x-mv:0000000016/" + UUID.Random();
string rawResp = OSDParser.SerializeLLSDXmlString(resp.Serialize()); string rawResp = OSDParser.SerializeLLSDXmlString(resp.Serialize());
@ -197,6 +194,27 @@ namespace OpenSim.Region.CoreModules.Media.Moap
part.Shape.Media = new List<MediaEntry>(omu.FaceMedia); part.Shape.Media = new List<MediaEntry>(omu.FaceMedia);
if (null == part.MediaUrl)
{
// TODO: We can't set the last changer until we start tracking which cap we give to which agent id
part.MediaUrl = "x-mv:0000000000/" + UUID.Zero;
}
else
{
string rawVersion = part.MediaUrl.Substring(5, 10);
int version = int.Parse(rawVersion);
part.MediaUrl = string.Format("x-mv:{0:10D}/{1}", version, UUID.Zero);
}
m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID);
// I know this has to end with the last avatar to edit and the version code shouldn't always be 16. Just trying
// to minimally satisfy for now to get something working
//resp.Version = "x-mv:0000000016/" + UUID.Random();
// TODO: schedule full object update for all other avatars. This will trigger them to send an
// ObjectMediaRequest once they see that the MediaUrl is different.
return string.Empty; return string.Empty;
} }

View File

@ -971,6 +971,11 @@ namespace OpenSim.Region.Framework.Scenes
set { m_updateFlag = value; } set { m_updateFlag = value; }
} }
/// <summary>
/// Used for media on a prim
/// </summary>
public string MediaUrl { get; set; }
[XmlIgnore] [XmlIgnore]
public bool CreateSelected public bool CreateSelected
{ {