From f6ce87c96d037787963d203346c5cb1a1dd52747 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 28 Jun 2013 18:50:33 +0100
Subject: Reinsert code for gathering uuids reference by materials back
directly into UuidGatherer for now.
This cannot be triggered as an event from Scene.EventManager since some invocations of UuidGatherer (e.g. IAR saving) use scene objects which are not in scenes.
There needs to be some way for modules to register for events which are not connected with a particular scene.
---
.../Materials/MaterialsDemoModule.cs | 136 +++++++++++----------
1 file changed, 69 insertions(+), 67 deletions(-)
(limited to 'OpenSim/Region/OptionalModules/Materials')
diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs
index 34dc552..1cfbab0 100644
--- a/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs
+++ b/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs
@@ -125,7 +125,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
m_scene = scene;
m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
m_scene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene;
- m_scene.EventManager.OnGatherUuids += GatherMaterialsUuids;
+// m_scene.EventManager.OnGatherUuids += GatherMaterialsUuids;
}
void EventManager_OnObjectAddedToScene(SceneObjectGroup obj)
@@ -161,7 +161,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
m_scene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene;
- m_scene.EventManager.OnGatherUuids -= GatherMaterialsUuids;
+// m_scene.EventManager.OnGatherUuids -= GatherMaterialsUuids;
m_log.DebugFormat("[MaterialsDemoModule]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
}
@@ -579,70 +579,72 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
output.Flush();
}
- ///
- /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps
- ///
- ///
- ///
- private void GatherMaterialsUuids(SceneObjectPart part, IDictionary assetUuids)
- {
- // scan thru the dynAttrs map of this part for any textures used as materials
- OSD osdMaterials = null;
-
- lock (part.DynAttrs)
- {
- if (part.DynAttrs.ContainsStore("OpenSim", "Materials"))
- {
- OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials");
- if (materialsStore == null)
- return;
-
- materialsStore.TryGetValue("Materials", out osdMaterials);
- }
-
- if (osdMaterials != null)
- {
- //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd));
-
- if (osdMaterials is OSDArray)
- {
- OSDArray matsArr = osdMaterials as OSDArray;
- foreach (OSDMap matMap in matsArr)
- {
- try
- {
- if (matMap.ContainsKey("Material"))
- {
- OSDMap mat = matMap["Material"] as OSDMap;
- if (mat.ContainsKey("NormMap"))
- {
- UUID normalMapId = mat["NormMap"].AsUUID();
- if (normalMapId != UUID.Zero)
- {
- assetUuids[normalMapId] = AssetType.Texture;
- //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString());
- }
- }
- if (mat.ContainsKey("SpecMap"))
- {
- UUID specularMapId = mat["SpecMap"].AsUUID();
- if (specularMapId != UUID.Zero)
- {
- assetUuids[specularMapId] = AssetType.Texture;
- //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString());
- }
- }
- }
-
- }
- catch (Exception e)
- {
- m_log.Warn("[MaterialsDemoModule]: exception getting materials: " + e.Message);
- }
- }
- }
- }
- }
- }
+ // FIXME: This code is currently still in UuidGatherer since we cannot use Scene.EventManager as some
+ // calls to the gatherer are done for objects with no scene.
+// ///
+// /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps
+// ///
+// ///
+// ///
+// private void GatherMaterialsUuids(SceneObjectPart part, IDictionary assetUuids)
+// {
+// // scan thru the dynAttrs map of this part for any textures used as materials
+// OSD osdMaterials = null;
+//
+// lock (part.DynAttrs)
+// {
+// if (part.DynAttrs.ContainsStore("OpenSim", "Materials"))
+// {
+// OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials");
+// if (materialsStore == null)
+// return;
+//
+// materialsStore.TryGetValue("Materials", out osdMaterials);
+// }
+//
+// if (osdMaterials != null)
+// {
+// //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd));
+//
+// if (osdMaterials is OSDArray)
+// {
+// OSDArray matsArr = osdMaterials as OSDArray;
+// foreach (OSDMap matMap in matsArr)
+// {
+// try
+// {
+// if (matMap.ContainsKey("Material"))
+// {
+// OSDMap mat = matMap["Material"] as OSDMap;
+// if (mat.ContainsKey("NormMap"))
+// {
+// UUID normalMapId = mat["NormMap"].AsUUID();
+// if (normalMapId != UUID.Zero)
+// {
+// assetUuids[normalMapId] = AssetType.Texture;
+// //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString());
+// }
+// }
+// if (mat.ContainsKey("SpecMap"))
+// {
+// UUID specularMapId = mat["SpecMap"].AsUUID();
+// if (specularMapId != UUID.Zero)
+// {
+// assetUuids[specularMapId] = AssetType.Texture;
+// //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString());
+// }
+// }
+// }
+//
+// }
+// catch (Exception e)
+// {
+// m_log.Warn("[MaterialsDemoModule]: exception getting materials: " + e.Message);
+// }
+// }
+// }
+// }
+// }
+// }
}
}
\ No newline at end of file
--
cgit v1.1