diff options
author | Justin Clarke Casey | 2008-07-06 15:38:39 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-07-06 15:38:39 +0000 |
commit | 238f2274e33d2bbfb20cc0639bd15aa42a043307 (patch) | |
tree | 03324e5828d1c8fc495c1a3d6bb1106357e8d11e /OpenSim/Region/Environment/Modules/World/Archiver | |
parent | Mantis#1677. Thank you, Melanie for a patch that: (diff) | |
download | opensim-SC_OLD-238f2274e33d2bbfb20cc0639bd15aa42a043307.zip opensim-SC_OLD-238f2274e33d2bbfb20cc0639bd15aa42a043307.tar.gz opensim-SC_OLD-238f2274e33d2bbfb20cc0639bd15aa42a043307.tar.bz2 opensim-SC_OLD-238f2274e33d2bbfb20cc0639bd15aa42a043307.tar.xz |
* refactor: archiver code clean up so that it's more readable for the next functionality addition
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Archiver')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs | 63 |
1 files changed, 43 insertions, 20 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs index 2a1f695..11d0c65 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs | |||
@@ -112,6 +112,47 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
112 | 112 | ||
113 | return m_requestedObjectAsset; | 113 | return m_requestedObjectAsset; |
114 | } | 114 | } |
115 | |||
116 | /// <summary> | ||
117 | /// Record the uuids referenced by the given wearable asset | ||
118 | /// </summary> | ||
119 | /// <param name="wearableAssetUuid"></param> | ||
120 | /// <param name="assetUuids">Dictionary in which to record the references</param> | ||
121 | protected void GetWearableAssetUuids(LLUUID wearableAssetUuid, IDictionary<LLUUID, int> assetUuids) | ||
122 | { | ||
123 | AssetBase assetBase = GetAsset(wearableAssetUuid); | ||
124 | //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data)); | ||
125 | AssetWearable wearableAsset = new AssetBodypart(assetBase.Data); | ||
126 | wearableAsset.Decode(); | ||
127 | |||
128 | m_log.DebugFormat( | ||
129 | "[ARCHIVER]: Wearable asset {0} references {1} assets", wearableAssetUuid, wearableAsset.Textures.Count); | ||
130 | |||
131 | foreach (LLUUID uuid in wearableAsset.Textures.Values) | ||
132 | { | ||
133 | //m_log.DebugFormat("[ARCHIVER]: Got bodypart uuid {0}", uuid); | ||
134 | assetUuids[uuid] = 1; | ||
135 | } | ||
136 | } | ||
137 | |||
138 | /// <summary> | ||
139 | /// Get all the asset uuids associated with a given object. This includes both those directly associated with | ||
140 | /// it (e.g. face textures) and recursively, those of items within it's inventory (e.g. objects contained | ||
141 | /// within this object). | ||
142 | /// </summary> | ||
143 | /// <param name="sceneObject"></param> | ||
144 | /// <param name="assetUuids"></param> | ||
145 | protected void GetSceneObjectAssetUuids(LLUUID sceneObjectUuid, IDictionary<LLUUID, int> assetUuids) | ||
146 | { | ||
147 | AssetBase objectAsset = GetAsset(sceneObjectUuid); | ||
148 | |||
149 | if (null != objectAsset) | ||
150 | { | ||
151 | string xml = Helpers.FieldToUTF8String(objectAsset.Data); | ||
152 | SceneObjectGroup sog = new SceneObjectGroup(m_scene, m_scene.RegionInfo.RegionHandle, xml); | ||
153 | GetSceneObjectAssetUuids(sog, assetUuids); | ||
154 | } | ||
155 | } | ||
115 | 156 | ||
116 | /// <summary> | 157 | /// <summary> |
117 | /// Get all the asset uuids associated with a given object. This includes both those directly associated with | 158 | /// Get all the asset uuids associated with a given object. This includes both those directly associated with |
@@ -157,29 +198,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver | |||
157 | 198 | ||
158 | if ((int)AssetType.Bodypart == tii.Type || ((int)AssetType.Clothing == tii.Type)) | 199 | if ((int)AssetType.Bodypart == tii.Type || ((int)AssetType.Clothing == tii.Type)) |
159 | { | 200 | { |
160 | AssetBase assetBase = GetAsset(tii.AssetID); | 201 | GetWearableAssetUuids(tii.AssetID, assetUuids); |
161 | //m_log.Debug(new System.Text.ASCIIEncoding().GetString(bodypartAsset.Data)); | ||
162 | AssetWearable wearableAsset = new AssetBodypart(assetBase.Data); | ||
163 | wearableAsset.Decode(); | ||
164 | |||
165 | m_log.DebugFormat("[ARCHIVER]: Wearable asset {0} references {1} assets", tii.AssetID, wearableAsset.Textures.Count); | ||
166 | |||
167 | foreach (LLUUID uuid in wearableAsset.Textures.Values) | ||
168 | { | ||
169 | //m_log.DebugFormat("[ARCHIVER]: Got bodypart uuid {0}", uuid); | ||
170 | assetUuids[uuid] = 1; | ||
171 | } | ||
172 | } | 202 | } |
173 | if ((int)AssetType.Object == tii.Type) | 203 | if ((int)AssetType.Object == tii.Type) |
174 | { | 204 | { |
175 | AssetBase objectAsset = GetAsset(tii.AssetID); | 205 | GetSceneObjectAssetUuids(tii.AssetID, assetUuids); |
176 | |||
177 | if (null != objectAsset) | ||
178 | { | ||
179 | string xml = Helpers.FieldToUTF8String(objectAsset.Data); | ||
180 | SceneObjectGroup sog = new SceneObjectGroup(m_scene, m_scene.RegionInfo.RegionHandle, xml); | ||
181 | GetSceneObjectAssetUuids(sog, assetUuids); | ||
182 | } | ||
183 | } | 206 | } |
184 | else | 207 | else |
185 | { | 208 | { |