aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJohn Hurliman2010-03-15 14:17:17 -0700
committerJohn Hurliman2010-03-15 14:17:17 -0700
commit33f5d0d1e90c3e63e06a200043a01c32768335c1 (patch)
tree8be352ceace25400a51c3a26ca1c2ce654788e55 /OpenSim/Region/Framework
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-33f5d0d1e90c3e63e06a200043a01c32768335c1.zip
opensim-SC_OLD-33f5d0d1e90c3e63e06a200043a01c32768335c1.tar.gz
opensim-SC_OLD-33f5d0d1e90c3e63e06a200043a01c32768335c1.tar.bz2
opensim-SC_OLD-33f5d0d1e90c3e63e06a200043a01c32768335c1.tar.xz
* 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
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs29
2 files changed, 17 insertions, 16 deletions
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
61 AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, "CORRUPT ASSET", UUID.Zero); 61 AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, "CORRUPT ASSET", UUID.Zero);
62 m_assetService.Store(corruptAsset); 62 m_assetService.Store(corruptAsset);
63 63
64 IDictionary<UUID, int> foundAssetUuids = new Dictionary<UUID, int>(); 64 IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>();
65 m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, AssetType.Object, foundAssetUuids); 65 m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, AssetType.Object, foundAssetUuids);
66 66
67 // We count the uuid as gathered even if the asset itself is corrupt. 67 // We count the uuid as gathered even if the asset itself is corrupt.
@@ -77,7 +77,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
77 TestHelper.InMethod(); 77 TestHelper.InMethod();
78 78
79 UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); 79 UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
80 IDictionary<UUID, int> foundAssetUuids = new Dictionary<UUID, int>(); 80 IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>();
81 81
82 m_uuidGatherer.GatherAssetUuids(missingAssetUuid, AssetType.Object, foundAssetUuids); 82 m_uuidGatherer.GatherAssetUuids(missingAssetUuid, AssetType.Object, foundAssetUuids);
83 83
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
84 /// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param> 84 /// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param>
85 /// <param name="assetType">The type of the asset for the uuid given</param> 85 /// <param name="assetType">The type of the asset for the uuid given</param>
86 /// <param name="assetUuids">The assets gathered</param> 86 /// <param name="assetUuids">The assets gathered</param>
87 public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, int> assetUuids) 87 public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, AssetType> assetUuids)
88 { 88 {
89 assetUuids[assetUuid] = 1; 89 assetUuids[assetUuid] = assetType;
90 90
91 if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType) 91 if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType)
92 { 92 {
@@ -116,7 +116,7 @@ namespace OpenSim.Region.Framework.Scenes
116 /// 116 ///
117 /// <param name="sceneObject">The scene object for which to gather assets</param> 117 /// <param name="sceneObject">The scene object for which to gather assets</param>
118 /// <param name="assetUuids">The assets gathered</param> 118 /// <param name="assetUuids">The assets gathered</param>
119 public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary<UUID, int> assetUuids) 119 public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary<UUID, AssetType> assetUuids)
120 { 120 {
121// m_log.DebugFormat( 121// m_log.DebugFormat(
122// "[ASSET GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID); 122// "[ASSET GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID);
@@ -131,7 +131,7 @@ namespace OpenSim.Region.Framework.Scenes
131 Primitive.TextureEntry textureEntry = part.Shape.Textures; 131 Primitive.TextureEntry textureEntry = part.Shape.Textures;
132 132
133 // Get the prim's default texture. This will be used for faces which don't have their own texture 133 // Get the prim's default texture. This will be used for faces which don't have their own texture
134 assetUuids[textureEntry.DefaultTexture.TextureID] = 1; 134 assetUuids[textureEntry.DefaultTexture.TextureID] = AssetType.Texture;
135 135
136 // XXX: Not a great way to iterate through face textures, but there's no 136 // XXX: Not a great way to iterate through face textures, but there's no
137 // other method available to tell how many faces there actually are 137 // other method available to tell how many faces there actually are
@@ -141,13 +141,13 @@ namespace OpenSim.Region.Framework.Scenes
141 if (texture != null) 141 if (texture != null)
142 { 142 {
143 //m_log.DebugFormat("[ARCHIVER]: Got face {0}", i++); 143 //m_log.DebugFormat("[ARCHIVER]: Got face {0}", i++);
144 assetUuids[texture.TextureID] = 1; 144 assetUuids[texture.TextureID] = AssetType.Texture;
145 } 145 }
146 } 146 }
147 147
148 // If the prim is a sculpt then preserve this information too 148 // If the prim is a sculpt then preserve this information too
149 if (part.Shape.SculptTexture != UUID.Zero) 149 if (part.Shape.SculptTexture != UUID.Zero)
150 assetUuids[part.Shape.SculptTexture] = 1; 150 assetUuids[part.Shape.SculptTexture] = AssetType.Texture;
151 151
152 TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); 152 TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
153 153
@@ -217,7 +217,7 @@ namespace OpenSim.Region.Framework.Scenes
217 /// </summary> 217 /// </summary>
218 /// <param name="scriptUuid"></param> 218 /// <param name="scriptUuid"></param>
219 /// <param name="assetUuids">Dictionary in which to record the references</param> 219 /// <param name="assetUuids">Dictionary in which to record the references</param>
220 protected void GetScriptAssetUuids(UUID scriptUuid, IDictionary<UUID, int> assetUuids) 220 protected void GetScriptAssetUuids(UUID scriptUuid, IDictionary<UUID, AssetType> assetUuids)
221 { 221 {
222 AssetBase scriptAsset = GetAsset(scriptUuid); 222 AssetBase scriptAsset = GetAsset(scriptUuid);
223 223
@@ -232,7 +232,9 @@ namespace OpenSim.Region.Framework.Scenes
232 { 232 {
233 UUID uuid = new UUID(uuidMatch.Value); 233 UUID uuid = new UUID(uuidMatch.Value);
234 //m_log.DebugFormat("[ARCHIVER]: Recording {0} in script", uuid); 234 //m_log.DebugFormat("[ARCHIVER]: Recording {0} in script", uuid);
235 assetUuids[uuid] = 1; 235
236 // Assume AssetIDs embedded in scripts are textures
237 assetUuids[uuid] = AssetType.Texture;
236 } 238 }
237 } 239 }
238 } 240 }
@@ -242,7 +244,7 @@ namespace OpenSim.Region.Framework.Scenes
242 /// </summary> 244 /// </summary>
243 /// <param name="wearableAssetUuid"></param> 245 /// <param name="wearableAssetUuid"></param>
244 /// <param name="assetUuids">Dictionary in which to record the references</param> 246 /// <param name="assetUuids">Dictionary in which to record the references</param>
245 protected void GetWearableAssetUuids(UUID wearableAssetUuid, IDictionary<UUID, int> assetUuids) 247 protected void GetWearableAssetUuids(UUID wearableAssetUuid, IDictionary<UUID, AssetType> assetUuids)
246 { 248 {
247 AssetBase assetBase = GetAsset(wearableAssetUuid); 249 AssetBase assetBase = GetAsset(wearableAssetUuid);
248 250
@@ -257,8 +259,7 @@ namespace OpenSim.Region.Framework.Scenes
257 259
258 foreach (UUID uuid in wearableAsset.Textures.Values) 260 foreach (UUID uuid in wearableAsset.Textures.Values)
259 { 261 {
260 //m_log.DebugFormat("[ARCHIVER]: Got bodypart uuid {0}", uuid); 262 assetUuids[uuid] = AssetType.Texture;
261 assetUuids[uuid] = 1;
262 } 263 }
263 } 264 }
264 } 265 }
@@ -270,7 +271,7 @@ namespace OpenSim.Region.Framework.Scenes
270 /// </summary> 271 /// </summary>
271 /// <param name="sceneObject"></param> 272 /// <param name="sceneObject"></param>
272 /// <param name="assetUuids"></param> 273 /// <param name="assetUuids"></param>
273 protected void GetSceneObjectAssetUuids(UUID sceneObjectUuid, IDictionary<UUID, int> assetUuids) 274 protected void GetSceneObjectAssetUuids(UUID sceneObjectUuid, IDictionary<UUID, AssetType> assetUuids)
274 { 275 {
275 AssetBase objectAsset = GetAsset(sceneObjectUuid); 276 AssetBase objectAsset = GetAsset(sceneObjectUuid);
276 277
@@ -284,7 +285,7 @@ namespace OpenSim.Region.Framework.Scenes
284 } 285 }
285 } 286 }
286 287
287 protected void GetGestureAssetUuids(UUID gestureUuid, IDictionary<UUID, int> assetUuids) 288 protected void GetGestureAssetUuids(UUID gestureUuid, IDictionary<UUID, AssetType> assetUuids)
288 { 289 {
289 AssetBase assetBase = GetAsset(gestureUuid); 290 AssetBase assetBase = GetAsset(gestureUuid);
290 291
@@ -316,7 +317,7 @@ namespace OpenSim.Region.Framework.Scenes
316 // If it can be parsed as a UUID, it is an asset ID 317 // If it can be parsed as a UUID, it is an asset ID
317 UUID uuid; 318 UUID uuid;
318 if (UUID.TryParse(id, out uuid)) 319 if (UUID.TryParse(id, out uuid))
319 assetUuids[uuid] = 1; 320 assetUuids[uuid] = AssetType.Animation;
320 } 321 }
321 } 322 }
322 } 323 }