* exprimental: Export and reimport all items within a prim except Objects

* Not yet ready for public use
0.6.0-stable
Justin Clarke Casey 2008-06-05 00:29:02 +00:00
parent 7352bd7b99
commit 73c1157027
4 changed files with 34 additions and 13 deletions

View File

@ -35,7 +35,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
/// <summary>
/// Path for the assets held in an archive
/// </summary>
public static readonly string ASSETS_PATH = "textures/";
public static readonly string ASSETS_PATH = "assets/";
/// <summary>
/// Extension used for texture assets in archive

View File

@ -92,9 +92,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
foreach (TaskInventoryItem tit in part.TaskInventory.Values)
{
if (tit.Type == (int)InventoryType.Texture)
if (tit.Type != (int)InventoryType.Object)
{
m_log.DebugFormat("[ARCHIVER]: Recording texture {0} in object {1}", tit.AssetID, part.UUID);
m_log.DebugFormat("[ARCHIVER]: Recording asset {0} in object {1}", tit.AssetID, part.UUID);
textureUuids[tit.AssetID] = 1;
}
}

View File

@ -78,13 +78,21 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
foreach (LLUUID uuid in m_assets.Keys)
{
if (m_assets[uuid] != null)
AssetBase asset = m_assets[uuid];
if (asset != null)
{
xtw.WriteStartElement("asset");
AssetBase asset = m_assets[uuid];
string extension = string.Empty;
if ((sbyte)AssetType.Texture == asset.Type)
{
extension = ArchiveConstants.TEXTURE_EXTENSION;
}
xtw.WriteElementString("filename", uuid.ToString() + extension);
xtw.WriteElementString("filename", uuid.ToString() + ArchiveConstants.TEXTURE_EXTENSION);
xtw.WriteElementString("name", asset.Name);
xtw.WriteElementString("description", asset.Description);
xtw.WriteElementString("asset-type", asset.Type.ToString());
@ -113,11 +121,20 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
foreach (LLUUID uuid in m_assets.Keys)
{
if (m_assets[uuid] != null)
AssetBase asset = m_assets[uuid];
if (asset != null)
{
string extension = string.Empty;
if ((sbyte)AssetType.Texture == asset.Type)
{
extension = ArchiveConstants.TEXTURE_EXTENSION;
}
archive.AddFile(
ArchiveConstants.ASSETS_PATH + uuid.ToString() + ArchiveConstants.TEXTURE_EXTENSION,
m_assets[uuid].Data);
ArchiveConstants.ASSETS_PATH + uuid.ToString() + extension,
asset.Data);
}
else
{

View File

@ -97,7 +97,6 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
reader.ReadStartElement("assets");
reader.Read();
m_log.DebugFormat("next node {0}", reader.Name);
while (reader.Name.Equals("asset"))
{
reader.Read();
@ -150,11 +149,16 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
{
AssetMetadata metadata = m_metadata[filename];
string rawId = filename.Remove(filename.Length - ArchiveConstants.TEXTURE_EXTENSION.Length);
string extension = String.Empty;
if ((sbyte)AssetType.Texture == metadata.AssetType)
{
filename = filename.Remove(filename.Length - ArchiveConstants.TEXTURE_EXTENSION.Length);
}
m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", rawId);
m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename);
AssetBase asset = new AssetBase(new LLUUID(rawId), metadata.Name);
AssetBase asset = new AssetBase(new LLUUID(filename), metadata.Name);
asset.Description = metadata.Description;
asset.Type = metadata.AssetType;
asset.InvType = metadata.InventoryType;