aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie Thielker2015-08-16 01:45:15 +0200
committerMelanie Thielker2015-08-16 01:45:15 +0200
commitc83da03183135919adf3846b7436aa55a98d33a0 (patch)
tree28ec442ca00e6e27fdae16c29e496d644da74317 /OpenSim/Region
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-c83da03183135919adf3846b7436aa55a98d33a0.zip
opensim-SC-c83da03183135919adf3846b7436aa55a98d33a0.tar.gz
opensim-SC-c83da03183135919adf3846b7436aa55a98d33a0.tar.bz2
opensim-SC-c83da03183135919adf3846b7436aa55a98d33a0.tar.xz
Create want and need lists for agent data interchange formats.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 6f172e7..a928db4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -82,6 +82,13 @@ namespace OpenSim.Region.Framework.Scenes
82 /// </value> 82 /// </value>
83 protected Dictionary<Type, List<object>> ModuleInterfaces = new Dictionary<Type, List<object>>(); 83 protected Dictionary<Type, List<object>> ModuleInterfaces = new Dictionary<Type, List<object>>();
84 84
85 /// <summary>
86 /// These two objects hold the information about any formats used
87 /// by modules that hold agent specific data.
88 /// </summary>
89 protected List<UUID> FormatsOffered = new List<UUID>();
90 protected Dictionary<object, List<UUID>> FormatsWanted = new Dictionary<object, List<UUID>>();
91
85 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); 92 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
86 93
87 /// <value> 94 /// <value>
@@ -367,6 +374,31 @@ namespace OpenSim.Region.Framework.Scenes
367 return m_moduleCommanders; 374 return m_moduleCommanders;
368 } 375 }
369 376
377 protected void CheckAndAddAgentDataFormats(object mod)
378 {
379 if (!(mod is IAgentStatefulModule))
380 return;
381
382 IAgentStatefulModule m = (IAgentStatefulModule)mod;
383
384 List<UUID> renderFormats = m.GetRenderStateFormats();
385 List<UUID> acceptFormats = m.GetAcceptStateFormats();
386
387 foreach (UUID render in renderFormats)
388 {
389 if (!(FormatsOffered.Contains(render)))
390 FormatsOffered.Add(render);
391 }
392
393 if (acceptFormats.Count == 0)
394 return;
395
396 if (FormatsWanted.ContainsKey(mod))
397 return;
398
399 FormatsWanted[mod] = acceptFormats;
400 }
401
370 /// <summary> 402 /// <summary>
371 /// Register an interface to a region module. This allows module methods to be called directly as 403 /// Register an interface to a region module. This allows module methods to be called directly as
372 /// well as via events. If there is already a module registered for this interface, it is not replaced 404 /// well as via events. If there is already a module registered for this interface, it is not replaced
@@ -389,6 +421,8 @@ namespace OpenSim.Region.Framework.Scenes
389 421
390 l.Add(mod); 422 l.Add(mod);
391 423
424 CheckAndAddAgentDataFormats(mod);
425
392 if (mod is IEntityCreator) 426 if (mod is IEntityCreator)
393 { 427 {
394 IEntityCreator entityCreator = (IEntityCreator)mod; 428 IEntityCreator entityCreator = (IEntityCreator)mod;
@@ -401,6 +435,14 @@ namespace OpenSim.Region.Framework.Scenes
401 435
402 public void UnregisterModuleInterface<M>(M mod) 436 public void UnregisterModuleInterface<M>(M mod)
403 { 437 {
438 // We can't unregister agent stateful modules because
439 // that would require much more data to be held about formats
440 // and would make that code slower and less efficient.
441 // No known modules are unregistered anyway, ever, unless
442 // the simulator shuts down anyway.
443 if (mod is IAgentStatefulModule)
444 return;
445
404 List<Object> l; 446 List<Object> l;
405 if (ModuleInterfaces.TryGetValue(typeof(M), out l)) 447 if (ModuleInterfaces.TryGetValue(typeof(M), out l))
406 { 448 {
@@ -431,6 +473,8 @@ namespace OpenSim.Region.Framework.Scenes
431 473
432 l.Add(mod); 474 l.Add(mod);
433 475
476 CheckAndAddAgentDataFormats(mod);
477
434 if (mod is IEntityCreator) 478 if (mod is IEntityCreator)
435 { 479 {
436 IEntityCreator entityCreator = (IEntityCreator)mod; 480 IEntityCreator entityCreator = (IEntityCreator)mod;