aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-06-27 23:42:35 +0100
committerJustin Clark-Casey (justincc)2013-06-27 23:42:35 +0100
commit149487ea0f74a46a70c98b3a31259b667f4d29b2 (patch)
tree19524863c98a1d5b229cfda790913da1588d372b /OpenSim/Region/Framework/Scenes/UuidGatherer.cs
parentMake the concept of namespaces explicit in dynamic attributes (diff)
downloadopensim-SC_OLD-149487ea0f74a46a70c98b3a31259b667f4d29b2.zip
opensim-SC_OLD-149487ea0f74a46a70c98b3a31259b667f4d29b2.tar.gz
opensim-SC_OLD-149487ea0f74a46a70c98b3a31259b667f4d29b2.tar.bz2
opensim-SC_OLD-149487ea0f74a46a70c98b3a31259b667f4d29b2.tar.xz
refactor: Move code for gathering textures referenced by materials into MaterialsDemoModule from UuidGatherer
This code is now triggered via EventManager.OnGatherUuids which modules can subscribe to.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/UuidGatherer.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs69
1 files changed, 2 insertions, 67 deletions
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 586b59d..3492813 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -186,8 +186,7 @@ namespace OpenSim.Region.Framework.Scenes
186 GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids); 186 GatherAssetUuids(tii.AssetID, (AssetType)tii.Type, assetUuids);
187 } 187 }
188 188
189 // get any texture UUIDs used for materials such as normal and specular maps 189 part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids);
190 GatherMaterialsUuids(part, assetUuids);
191 } 190 }
192 catch (Exception e) 191 catch (Exception e)
193 { 192 {
@@ -211,71 +210,7 @@ namespace OpenSim.Region.Framework.Scenes
211// Monitor.Pulse(this); 210// Monitor.Pulse(this);
212// } 211// }
213// } 212// }
214 213
215 /// <summary>
216 /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps
217 /// </summary>
218 /// <param name="part"></param>
219 /// <param name="assetUuids"></param>
220 public void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids)
221 {
222 // scan thru the dynAttrs map of this part for any textures used as materials
223 OSD osdMaterials = null;
224
225 lock (part.DynAttrs)
226 {
227 if (part.DynAttrs.ContainsStore("OpenSim", "Materials"))
228 {
229 OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials");
230 materialsStore.TryGetValue("Materials", out osdMaterials);
231 }
232
233 if (osdMaterials != null)
234 {
235 //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd));
236
237 if (osdMaterials is OSDArray)
238 {
239 OSDArray matsArr = osdMaterials as OSDArray;
240 foreach (OSDMap matMap in matsArr)
241 {
242 try
243 {
244 if (matMap.ContainsKey("Material"))
245 {
246 OSDMap mat = matMap["Material"] as OSDMap;
247 if (mat.ContainsKey("NormMap"))
248 {
249 UUID normalMapId = mat["NormMap"].AsUUID();
250 if (normalMapId != UUID.Zero)
251 {
252 assetUuids[normalMapId] = AssetType.Texture;
253 //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString());
254 }
255 }
256 if (mat.ContainsKey("SpecMap"))
257 {
258 UUID specularMapId = mat["SpecMap"].AsUUID();
259 if (specularMapId != UUID.Zero)
260 {
261 assetUuids[specularMapId] = AssetType.Texture;
262 //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString());
263 }
264 }
265 }
266
267 }
268 catch (Exception e)
269 {
270 m_log.Warn("[UUID Gatherer]: exception getting materials: " + e.Message);
271 }
272 }
273 }
274 }
275 }
276 }
277
278
279 /// <summary> 214 /// <summary>
280 /// Get an asset synchronously, potentially using an asynchronous callback. If the 215 /// Get an asset synchronously, potentially using an asynchronous callback. If the
281 /// asynchronous callback is used, we will wait for it to complete. 216 /// asynchronous callback is used, we will wait for it to complete.