aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-06-28 18:50:33 +0100
committerJustin Clark-Casey (justincc)2013-06-28 18:50:33 +0100
commitf6ce87c96d037787963d203346c5cb1a1dd52747 (patch)
tree0c783b973dd9bc929a81fa67fadc871a5bbc5134 /OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs
parentadd method docs for DAMap.GetStore() and DAMap.SetStore() (diff)
downloadopensim-SC_OLD-f6ce87c96d037787963d203346c5cb1a1dd52747.zip
opensim-SC_OLD-f6ce87c96d037787963d203346c5cb1a1dd52747.tar.gz
opensim-SC_OLD-f6ce87c96d037787963d203346c5cb1a1dd52747.tar.bz2
opensim-SC_OLD-f6ce87c96d037787963d203346c5cb1a1dd52747.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Materials/MaterialsDemoModule.cs136
1 files changed, 69 insertions, 67 deletions
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
125 m_scene = scene; 125 m_scene = scene;
126 m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; 126 m_scene.EventManager.OnRegisterCaps += OnRegisterCaps;
127 m_scene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene; 127 m_scene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene;
128 m_scene.EventManager.OnGatherUuids += GatherMaterialsUuids; 128// m_scene.EventManager.OnGatherUuids += GatherMaterialsUuids;
129 } 129 }
130 130
131 void EventManager_OnObjectAddedToScene(SceneObjectGroup obj) 131 void EventManager_OnObjectAddedToScene(SceneObjectGroup obj)
@@ -161,7 +161,7 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
161 161
162 m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; 162 m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
163 m_scene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene; 163 m_scene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene;
164 m_scene.EventManager.OnGatherUuids -= GatherMaterialsUuids; 164// m_scene.EventManager.OnGatherUuids -= GatherMaterialsUuids;
165 165
166 m_log.DebugFormat("[MaterialsDemoModule]: REGION {0} REMOVED", scene.RegionInfo.RegionName); 166 m_log.DebugFormat("[MaterialsDemoModule]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
167 } 167 }
@@ -579,70 +579,72 @@ namespace OpenSim.Region.OptionalModules.MaterialsDemoModule
579 output.Flush(); 579 output.Flush();
580 } 580 }
581 581
582 /// <summary> 582 // FIXME: This code is currently still in UuidGatherer since we cannot use Scene.EventManager as some
583 /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps 583 // calls to the gatherer are done for objects with no scene.
584 /// </summary> 584// /// <summary>
585 /// <param name="part"></param> 585// /// Gather all of the texture asset UUIDs used to reference "Materials" such as normal and specular maps
586 /// <param name="assetUuids"></param> 586// /// </summary>
587 private void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids) 587// /// <param name="part"></param>
588 { 588// /// <param name="assetUuids"></param>
589 // scan thru the dynAttrs map of this part for any textures used as materials 589// private void GatherMaterialsUuids(SceneObjectPart part, IDictionary<UUID, AssetType> assetUuids)
590 OSD osdMaterials = null; 590// {
591 591// // scan thru the dynAttrs map of this part for any textures used as materials
592 lock (part.DynAttrs) 592// OSD osdMaterials = null;
593 { 593//
594 if (part.DynAttrs.ContainsStore("OpenSim", "Materials")) 594// lock (part.DynAttrs)
595 { 595// {
596 OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials"); 596// if (part.DynAttrs.ContainsStore("OpenSim", "Materials"))
597 if (materialsStore == null) 597// {
598 return; 598// OSDMap materialsStore = part.DynAttrs.GetStore("OpenSim", "Materials");
599 599// if (materialsStore == null)
600 materialsStore.TryGetValue("Materials", out osdMaterials); 600// return;
601 } 601//
602 602// materialsStore.TryGetValue("Materials", out osdMaterials);
603 if (osdMaterials != null) 603// }
604 { 604//
605 //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd)); 605// if (osdMaterials != null)
606 606// {
607 if (osdMaterials is OSDArray) 607// //m_log.Info("[UUID Gatherer]: found Materials: " + OSDParser.SerializeJsonString(osd));
608 { 608//
609 OSDArray matsArr = osdMaterials as OSDArray; 609// if (osdMaterials is OSDArray)
610 foreach (OSDMap matMap in matsArr) 610// {
611 { 611// OSDArray matsArr = osdMaterials as OSDArray;
612 try 612// foreach (OSDMap matMap in matsArr)
613 { 613// {
614 if (matMap.ContainsKey("Material")) 614// try
615 { 615// {
616 OSDMap mat = matMap["Material"] as OSDMap; 616// if (matMap.ContainsKey("Material"))
617 if (mat.ContainsKey("NormMap")) 617// {
618 { 618// OSDMap mat = matMap["Material"] as OSDMap;
619 UUID normalMapId = mat["NormMap"].AsUUID(); 619// if (mat.ContainsKey("NormMap"))
620 if (normalMapId != UUID.Zero) 620// {
621 { 621// UUID normalMapId = mat["NormMap"].AsUUID();
622 assetUuids[normalMapId] = AssetType.Texture; 622// if (normalMapId != UUID.Zero)
623 //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString()); 623// {
624 } 624// assetUuids[normalMapId] = AssetType.Texture;
625 } 625// //m_log.Info("[UUID Gatherer]: found normal map ID: " + normalMapId.ToString());
626 if (mat.ContainsKey("SpecMap")) 626// }
627 { 627// }
628 UUID specularMapId = mat["SpecMap"].AsUUID(); 628// if (mat.ContainsKey("SpecMap"))
629 if (specularMapId != UUID.Zero) 629// {
630 { 630// UUID specularMapId = mat["SpecMap"].AsUUID();
631 assetUuids[specularMapId] = AssetType.Texture; 631// if (specularMapId != UUID.Zero)
632 //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString()); 632// {
633 } 633// assetUuids[specularMapId] = AssetType.Texture;
634 } 634// //m_log.Info("[UUID Gatherer]: found specular map ID: " + specularMapId.ToString());
635 } 635// }
636 636// }
637 } 637// }
638 catch (Exception e) 638//
639 { 639// }
640 m_log.Warn("[MaterialsDemoModule]: exception getting materials: " + e.Message); 640// catch (Exception e)
641 } 641// {
642 } 642// m_log.Warn("[MaterialsDemoModule]: exception getting materials: " + e.Message);
643 } 643// }
644 } 644// }
645 } 645// }
646 } 646// }
647// }
648// }
647 } 649 }
648} \ No newline at end of file 650} \ No newline at end of file