diff options
author | dahlia | 2013-04-24 20:43:15 -0700 |
---|---|---|
committer | dahlia | 2013-04-24 20:43:15 -0700 |
commit | c10405330d0fa5855c3f8180fdc8347cb87fed4f (patch) | |
tree | 10ee142bfd9dab354c80e574102394247cd79ce9 | |
parent | Make the kicked user's avie truly disappear when it's god-kicked. (diff) | |
download | opensim-SC-c10405330d0fa5855c3f8180fdc8347cb87fed4f.zip opensim-SC-c10405330d0fa5855c3f8180fdc8347cb87fed4f.tar.gz opensim-SC-c10405330d0fa5855c3f8180fdc8347cb87fed4f.tar.bz2 opensim-SC-c10405330d0fa5855c3f8180fdc8347cb87fed4f.tar.xz |
UUIDGatherer now includes UUIDs which reference texture assets used as materials
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index ad33607..0e83781 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs | |||
@@ -34,6 +34,7 @@ using System.Threading; | |||
34 | using log4net; | 34 | using log4net; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenMetaverse.Assets; | 36 | using OpenMetaverse.Assets; |
37 | using OpenMetaverse.StructuredData; | ||
37 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework.Scenes.Serialization; | 39 | using OpenSim.Region.Framework.Scenes.Serialization; |
39 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
@@ -184,6 +185,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
184 | if (!assetUuids.ContainsKey(tii.AssetID)) | 185 | if (!assetUuids.ContainsKey(tii.AssetID)) |
185 | GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids); | 186 | GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids); |
186 | } | 187 | } |
188 | |||
189 | // get any texture UUIDs used for materials such as normal and specular maps | ||
190 | GatherMaterialsUuids(part, assetUuids); | ||
187 | } | 191 | } |
188 | catch (Exception e) | 192 | catch (Exception e) |
189 | { | 193 | { |
@@ -208,6 +212,68 @@ namespace OpenSim.Region.Framework.Scenes | |||
208 | // } | 212 | // } |
209 | // } | 213 | // } |
210 | 214 | ||
215 | |||
216 | /// <summary> | ||
217 | /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps | ||
218 | /// </summary> | ||
219 | /// <param name="part"></param> | ||
220 | /// <param name="assetUuids"></param> | ||
221 | public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids) | ||
222 | { | ||
223 | // scan thru the dynAttrs map of this part for any textures used as materials | ||
224 | OSDMap OSMaterials = null; | ||
225 | |||
226 | lock (part.DynAttrs) | ||
227 | { | ||
228 | if (part.DynAttrs.ContainsKey("OS:Materials")) | ||
229 | OSMaterials = part.DynAttrs["OS:Materials"]; | ||
230 | if (OSMaterials != null && OSMaterials.ContainsKey("Materials")) | ||
231 | { | ||
232 | OSD osd = OSMaterials["Materials"]; | ||
233 | //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd)); | ||
234 | |||
235 | if (osd is OSDArray) | ||
236 | { | ||
237 | OSDArray matsArr = osd as OSDArray; | ||
238 | foreach (OSDMap matMap in matsArr) | ||
239 | { | ||
240 | try | ||
241 | { | ||
242 | if (matMap.ContainsKey("Material")) | ||
243 | { | ||
244 | OSDMap mat = matMap["Material"] as OSDMap; | ||
245 | if (mat.ContainsKey("NormMap")) | ||
246 | { | ||
247 | UUID normalMapId = mat["NormMap"].AsUUID(); | ||
248 | if (normalMapId != UUID.Zero) | ||
249 | { | ||
250 | assetUuids[normalMapId] = AssetType.Texture; | ||
251 | //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString()); | ||
252 | } | ||
253 | } | ||
254 | if (mat.ContainsKey("SpecMap")) | ||
255 | { | ||
256 | UUID specularMapId = mat["SpecMap"].AsUUID(); | ||
257 | if (specularMapId != UUID.Zero) | ||
258 | { | ||
259 | assetUuids[specularMapId] = AssetType.Texture; | ||
260 | //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString()); | ||
261 | } | ||
262 | } | ||
263 | } | ||
264 | |||
265 | } | ||
266 | catch (Exception e) | ||
267 | { | ||
268 | m_log.Warn("[UUID Gatherer]: exception getting materials: " + e.Message); | ||
269 | } | ||
270 | } | ||
271 | } | ||
272 | } | ||
273 | } | ||
274 | } | ||
275 | |||
276 | |||
211 | /// <summary> | 277 | /// <summary> |
212 | /// Get an asset synchronously, potentially using an asynchronous callback. If the | 278 | /// Get an asset synchronously, potentially using an asynchronous callback. If the |
213 | /// asynchronous callback is used, we will wait for it to complete. | 279 | /// asynchronous callback is used, we will wait for it to complete. |