aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authordahlia2014-01-20 15:01:18 -0800
committerdahlia2014-01-20 15:01:18 -0800
commit7bd42fc42f0d945fe96b058d06f14c091d96b2d2 (patch)
tree45bf1a185c544fe24cd1632562d2ad7a0694c77e /OpenSim
parentrather than converting existing materials to assets, just retrieve them and m... (diff)
downloadopensim-SC-7bd42fc42f0d945fe96b058d06f14c091d96b2d2.zip
opensim-SC-7bd42fc42f0d945fe96b058d06f14c091d96b2d2.tar.gz
opensim-SC-7bd42fc42f0d945fe96b058d06f14c091d96b2d2.tar.bz2
opensim-SC-7bd42fc42f0d945fe96b058d06f14c091d96b2d2.tar.xz
Add back code to UuidGatherer to retrieve UUIDs for materials stored in DynAttrs. This is unfortunately still necessary until a better solution for handling existing legacy materials can be implemented
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs73
1 files changed, 73 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 42a1977..75a51b5 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -218,6 +218,10 @@ namespace OpenSim.Region.Framework.Scenes
218 // inventory transfer. There needs to be a way for a module to register a method without assuming a 218 // inventory transfer. There needs to be a way for a module to register a method without assuming a
219 // Scene.EventManager is present. 219 // Scene.EventManager is present.
220// part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids); 220// part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids);
221
222
223 // still needed to retrieve textures used as materials for any parts containing legacy materials stored in DynAttrs
224 GatherMaterialsUuids(part, assetUuids);
221 } 225 }
222 catch (Exception e) 226 catch (Exception e)
223 { 227 {
@@ -241,6 +245,75 @@ namespace OpenSim.Region.Framework.Scenes
241// Monitor.Pulse(this); 245// Monitor.Pulse(this);
242// } 246// }
243// } 247// }
248
249 /// <summary>
250 /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps
251 /// stored in legacy format in part.DynAttrs
252 /// </summary>
253 /// <param name="part"></param>
254 /// <param name="assetUuids"></param>
255 //public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids)
256 public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, sbyte> assetUuids)
257 {
258 // scan thru the dynAttrs map of this part for any textures used as materials
259 OSD osdMaterials = null;
260
261 lock (part.DynAttrs)
262 {
263 if (part.DynAttrs.ContainsStore("OpenSim", "Materials"))
264 {
265 OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials");
266
267 if (materialsStore == null)
268 return;
269
270 materialsStore.TryGetValue("Materials", out osdMaterials);
271 }
272
273 if (osdMaterials != null)
274 {
275 //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd));
276
277 if (osdMaterials is OSDArray)
278 {
279 OSDArray matsArr = osdMaterials as OSDArray;
280 foreach (OSDMap matMap in matsArr)
281 {
282 try
283 {
284 if (matMap.ContainsKey("Material"))
285 {
286 OSDMap mat = matMap["Material"] as OSDMap;
287 if (mat.ContainsKey("NormMap"))
288 {
289 UUID normalMapId = mat["NormMap"].AsUUID();
290 if (normalMapId != UUID.Zero)
291 {
292 assetUuids[normalMapId] = (sbyte)AssetType.Texture;
293 //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString());
294 }
295 }
296 if (mat.ContainsKey("SpecMap"))
297 {
298 UUID specularMapId = mat["SpecMap"].AsUUID();
299 if (specularMapId != UUID.Zero)
300 {
301 assetUuids[specularMapId] = (sbyte)AssetType.Texture;
302 //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString());
303 }
304 }
305 }
306
307 }
308 catch (Exception e)
309 {
310 m_log.Warn("[UUID Gatherer]: exception getting materials: " + e.Message);
311 }
312 }
313 }
314 }
315 }
316 }
244 317
245 /// <summary> 318 /// <summary>
246 /// Get an asset synchronously, potentially using an asynchronous callback. If the 319 /// Get an asset synchronously, potentially using an asynchronous callback. If the