From 33f5d0d1e90c3e63e06a200043a01c32768335c1 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Mon, 15 Mar 2010 14:17:17 -0700 Subject: * UuidGatherer now tracks asset types for assets it discovers. The asset types are inferred from context * OAR saving will attempt to correct unknown asset types before writing broken assets to the OAR file --- .../Framework/Scenes/Tests/UuidGathererTests.cs | 4 +-- OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 29 +++++++++++----------- 2 files changed, 17 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index 6686264..8b80ebe 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, "CORRUPT ASSET", UUID.Zero); m_assetService.Store(corruptAsset); - IDictionary foundAssetUuids = new Dictionary(); + IDictionary foundAssetUuids = new Dictionary(); m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, AssetType.Object, foundAssetUuids); // We count the uuid as gathered even if the asset itself is corrupt. @@ -77,7 +77,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); - IDictionary foundAssetUuids = new Dictionary(); + IDictionary foundAssetUuids = new Dictionary(); m_uuidGatherer.GatherAssetUuids(missingAssetUuid, AssetType.Object, foundAssetUuids); diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 3edb677..4a1f648 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -84,9 +84,9 @@ namespace OpenSim.Region.Framework.Scenes /// The uuid of the asset for which to gather referenced assets /// The type of the asset for the uuid given /// The assets gathered - public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary assetUuids) + public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary assetUuids) { - assetUuids[assetUuid] = 1; + assetUuids[assetUuid] = assetType; if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType) { @@ -116,7 +116,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// The scene object for which to gather assets /// The assets gathered - public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary assetUuids) + public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary assetUuids) { // m_log.DebugFormat( // "[ASSET GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID); @@ -131,7 +131,7 @@ namespace OpenSim.Region.Framework.Scenes Primitive.TextureEntry textureEntry = part.Shape.Textures; // Get the prim's default texture. This will be used for faces which don't have their own texture - assetUuids[textureEntry.DefaultTexture.TextureID] = 1; + assetUuids[textureEntry.DefaultTexture.TextureID] = AssetType.Texture; // XXX: Not a great way to iterate through face textures, but there's no // other method available to tell how many faces there actually are @@ -141,13 +141,13 @@ namespace OpenSim.Region.Framework.Scenes if (texture != null) { //m_log.DebugFormat("[ARCHIVER]: Got face {0}", i++); - assetUuids[texture.TextureID] = 1; + assetUuids[texture.TextureID] = AssetType.Texture; } } // If the prim is a sculpt then preserve this information too if (part.Shape.SculptTexture != UUID.Zero) - assetUuids[part.Shape.SculptTexture] = 1; + assetUuids[part.Shape.SculptTexture] = AssetType.Texture; TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); @@ -217,7 +217,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// Dictionary in which to record the references - protected void GetScriptAssetUuids(UUID scriptUuid, IDictionary assetUuids) + protected void GetScriptAssetUuids(UUID scriptUuid, IDictionary assetUuids) { AssetBase scriptAsset = GetAsset(scriptUuid); @@ -232,7 +232,9 @@ namespace OpenSim.Region.Framework.Scenes { UUID uuid = new UUID(uuidMatch.Value); //m_log.DebugFormat("[ARCHIVER]: Recording {0} in script", uuid); - assetUuids[uuid] = 1; + + // Assume AssetIDs embedded in scripts are textures + assetUuids[uuid] = AssetType.Texture; } } } @@ -242,7 +244,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// Dictionary in which to record the references - protected void GetWearableAssetUuids(UUID wearableAssetUuid, IDictionary assetUuids) + protected void GetWearableAssetUuids(UUID wearableAssetUuid, IDictionary assetUuids) { AssetBase assetBase = GetAsset(wearableAssetUuid); @@ -257,8 +259,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (UUID uuid in wearableAsset.Textures.Values) { - //m_log.DebugFormat("[ARCHIVER]: Got bodypart uuid {0}", uuid); - assetUuids[uuid] = 1; + assetUuids[uuid] = AssetType.Texture; } } } @@ -270,7 +271,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - protected void GetSceneObjectAssetUuids(UUID sceneObjectUuid, IDictionary assetUuids) + protected void GetSceneObjectAssetUuids(UUID sceneObjectUuid, IDictionary assetUuids) { AssetBase objectAsset = GetAsset(sceneObjectUuid); @@ -284,7 +285,7 @@ namespace OpenSim.Region.Framework.Scenes } } - protected void GetGestureAssetUuids(UUID gestureUuid, IDictionary assetUuids) + protected void GetGestureAssetUuids(UUID gestureUuid, IDictionary assetUuids) { AssetBase assetBase = GetAsset(gestureUuid); @@ -316,7 +317,7 @@ namespace OpenSim.Region.Framework.Scenes // If it can be parsed as a UUID, it is an asset ID UUID uuid; if (UUID.TryParse(id, out uuid)) - assetUuids[uuid] = 1; + assetUuids[uuid] = AssetType.Animation; } } } -- cgit v1.1