factor out common code for updating the media url
parent
9231fc0f31
commit
7691a638e3
|
@ -124,19 +124,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
|
||||||
part.Shape.Media = new List<MediaEntry>(part.GetNumberOfSides());
|
part.Shape.Media = new List<MediaEntry>(part.GetNumberOfSides());
|
||||||
|
|
||||||
part.Shape.Media[face] = me;
|
part.Shape.Media[face] = me;
|
||||||
|
UpdateMediaUrl(part);
|
||||||
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:D10}/{1}", ++version, UUID.Zero);
|
|
||||||
}
|
|
||||||
|
|
||||||
part.ScheduleFullUpdate();
|
part.ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,19 +215,7 @@ 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)
|
UpdateMediaUrl(part);
|
||||||
{
|
|
||||||
// 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:D10}/{1}", ++version, UUID.Zero);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID);
|
|
||||||
|
|
||||||
// Arguably, we could avoid sending a full update to the avatar that just changed the texture.
|
// Arguably, we could avoid sending a full update to the avatar that just changed the texture.
|
||||||
part.ScheduleFullUpdate();
|
part.ScheduleFullUpdate();
|
||||||
|
@ -284,21 +260,10 @@ namespace OpenSim.Region.CoreModules.Media.Moap
|
||||||
MediaEntry me = part.Shape.Media[omn.Face];
|
MediaEntry me = part.Shape.Media[omn.Face];
|
||||||
me.CurrentURL = omn.URL;
|
me.CurrentURL = omn.URL;
|
||||||
|
|
||||||
string oldMediaUrl = part.MediaUrl;
|
UpdateMediaUrl(part);
|
||||||
|
|
||||||
// TODO: refactor into common method
|
|
||||||
string rawVersion = oldMediaUrl.Substring(5, 10);
|
|
||||||
int version = int.Parse(rawVersion);
|
|
||||||
part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, UUID.Zero);
|
|
||||||
|
|
||||||
m_log.DebugFormat(
|
|
||||||
"[MOAP]: Updating media url in prim {0} {1} from [{2}] to [{3}]",
|
|
||||||
part.Name, part.UUID, oldMediaUrl, part.MediaUrl);
|
|
||||||
|
|
||||||
part.ScheduleFullUpdate();
|
part.ScheduleFullUpdate();
|
||||||
|
|
||||||
// TODO: Persist in database
|
|
||||||
|
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,5 +282,26 @@ namespace OpenSim.Region.CoreModules.Media.Moap
|
||||||
throw new ArgumentException(
|
throw new ArgumentException(
|
||||||
string.Format("Face argument was {0} but max is {1}", face, maxFaces));
|
string.Format("Face argument was {0} but max is {1}", face, maxFaces));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the media url of the given part
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="part"></param>
|
||||||
|
protected void UpdateMediaUrl(SceneObjectPart part)
|
||||||
|
{
|
||||||
|
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:D10}/{1}", ++version, UUID.Zero);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue