* if the user uuid is present, preserve ownership information when loading an archive
* if the uuid isn't present, ownership is given to the region's master avatar0.6.0-stable
parent
d0480a87c3
commit
03f9a3e1d6
|
@ -48,10 +48,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding();
|
private static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding();
|
||||||
|
|
||||||
protected Scene m_scene;
|
private Scene m_scene;
|
||||||
protected string m_loadPath;
|
private string m_loadPath;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to cache lookups for valid uuids.
|
||||||
|
/// </summary>
|
||||||
|
private IDictionary<LLUUID, bool> m_validUserUuids = new Dictionary<LLUUID, bool>();
|
||||||
|
|
||||||
public ArchiveReadRequest(Scene scene, string loadPath)
|
public ArchiveReadRequest(Scene scene, string loadPath)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +66,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
DearchiveRegion();
|
DearchiveRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void DearchiveRegion()
|
private void DearchiveRegion()
|
||||||
{
|
{
|
||||||
TarArchiveReader archive
|
TarArchiveReader archive
|
||||||
= new TarArchiveReader(
|
= new TarArchiveReader(
|
||||||
|
@ -129,13 +134,20 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
// to the same scene (when this is possible).
|
// to the same scene (when this is possible).
|
||||||
sceneObject.ResetIDs();
|
sceneObject.ResetIDs();
|
||||||
|
|
||||||
// Make the master the owner/creator of everything imported for now
|
// Try to retain the original creator/owner/lastowner if their uuid is present on this grid
|
||||||
|
// otherwise, use the master avatar uuid instead
|
||||||
LLUUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID;
|
LLUUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID;
|
||||||
foreach (SceneObjectPart part in sceneObject.Children.Values)
|
foreach (SceneObjectPart part in sceneObject.Children.Values)
|
||||||
{
|
{
|
||||||
|
if (!resolveUserUuid(part.CreatorID))
|
||||||
part.CreatorID = masterAvatarId;
|
part.CreatorID = masterAvatarId;
|
||||||
|
|
||||||
|
if (!resolveUserUuid(part.OwnerID))
|
||||||
part.OwnerID = masterAvatarId;
|
part.OwnerID = masterAvatarId;
|
||||||
|
|
||||||
|
if (!resolveUserUuid(part.LastOwnerID))
|
||||||
part.LastOwnerID = masterAvatarId;
|
part.LastOwnerID = masterAvatarId;
|
||||||
|
|
||||||
// And zap any troublesome sit target information
|
// And zap any troublesome sit target information
|
||||||
part.SitTargetOrientation = new Quaternion(0,0,0,1);
|
part.SitTargetOrientation = new Quaternion(0,0,0,1);
|
||||||
part.SitTargetPosition = new Vector3(0,0,0);
|
part.SitTargetPosition = new Vector3(0,0,0);
|
||||||
|
@ -164,13 +176,34 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Look up the given user id to check whether it's one that is valid for this grid.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uuid"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private bool resolveUserUuid(LLUUID uuid)
|
||||||
|
{
|
||||||
|
if (!m_validUserUuids.ContainsKey(uuid))
|
||||||
|
{
|
||||||
|
if (m_scene.CommsManager.UserService.GetUserProfile(uuid) != null)
|
||||||
|
m_validUserUuids.Add(uuid, true);
|
||||||
|
else
|
||||||
|
m_validUserUuids.Add(uuid, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_validUserUuids[uuid])
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load an asset
|
/// Load an asset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="assetFilename"></param>
|
/// <param name="assetFilename"></param>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
/// <returns>true if asset was successfully loaded, false otherwise</returns>
|
/// <returns>true if asset was successfully loaded, false otherwise</returns>
|
||||||
protected bool LoadAsset(string assetPath, byte[] data)
|
private bool LoadAsset(string assetPath, byte[] data)
|
||||||
{
|
{
|
||||||
// Right now we're nastily obtaining the lluuid from the filename
|
// Right now we're nastily obtaining the lluuid from the filename
|
||||||
string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length);
|
string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length);
|
||||||
|
@ -209,7 +242,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// true if terrain was resolved successfully, false otherwise.
|
/// true if terrain was resolved successfully, false otherwise.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
protected bool LoadTerrain(string terrainPath, byte[] data)
|
private bool LoadTerrain(string terrainPath, byte[] data)
|
||||||
{
|
{
|
||||||
ITerrainModule terrainModule = m_scene.RequestModuleInterface<ITerrainModule>();
|
ITerrainModule terrainModule = m_scene.RequestModuleInterface<ITerrainModule>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue