aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins
diff options
context:
space:
mode:
authorMW2009-02-26 20:01:20 +0000
committerMW2009-02-26 20:01:20 +0000
commit33e7c09b7b894551b35fb8ab29133c96a5d7b037 (patch)
treea21839dc38477c2679b9c94fcebc96cca8bcc26d /OpenSim/ApplicationPlugins
parentAttempt to fix the "region starts but doesn't load anything" issue (diff)
downloadopensim-SC-33e7c09b7b894551b35fb8ab29133c96a5d7b037.zip
opensim-SC-33e7c09b7b894551b35fb8ab29133c96a5d7b037.tar.gz
opensim-SC-33e7c09b7b894551b35fb8ab29133c96a5d7b037.tar.bz2
opensim-SC-33e7c09b7b894551b35fb8ab29133c96a5d7b037.tar.xz
Added IRegistryCore and RegistryCore to OpenSim.Framework.
Added a ApplicationRegistry to OpenSimBase. Changed LoadRegionsPlugin so it registers itself to that application registry. Added a event to LoadRegionsPlugin, that is triggered when it creates a new scene ,although maybe this event should actually be in opensimBase incase other plugins are creating regions (like the RemoteAdminPlugin).
Diffstat (limited to 'OpenSim/ApplicationPlugins')
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs22
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs4
2 files changed, 22 insertions, 4 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index 24372fe..962f7b3 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -38,13 +38,19 @@ using OpenSim.Region.CoreModules.Avatar.InstantMessage;
38using OpenSim.Region.CoreModules.Scripting.DynamicTexture; 38using OpenSim.Region.CoreModules.Scripting.DynamicTexture;
39using OpenSim.Region.CoreModules.Scripting.LoadImageURL; 39using OpenSim.Region.CoreModules.Scripting.LoadImageURL;
40using OpenSim.Region.CoreModules.Scripting.XMLRPC; 40using OpenSim.Region.CoreModules.Scripting.XMLRPC;
41using OpenSim.Framework.Servers;
41 42
42namespace OpenSim.ApplicationPlugins.LoadRegions 43namespace OpenSim.ApplicationPlugins.LoadRegions
43{ 44{
45 public delegate void NewRegionCreated(IScene scene);
46
44 public class LoadRegionsPlugin : IApplicationPlugin 47 public class LoadRegionsPlugin : IApplicationPlugin
45 { 48 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 50
51 public event NewRegionCreated OnNewRegionCreated;
52 private NewRegionCreated m_newRegionCreatedHandler;
53
48 #region IApplicationPlugin Members 54 #region IApplicationPlugin Members
49 55
50 // TODO: required by IPlugin, but likely not at all right 56 // TODO: required by IPlugin, but likely not at all right
@@ -56,6 +62,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
56 62
57 protected OpenSimBase m_openSim; 63 protected OpenSimBase m_openSim;
58 64
65
59 public void Initialise() 66 public void Initialise()
60 { 67 {
61 m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!"); 68 m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!");
@@ -65,6 +72,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
65 public void Initialise(OpenSimBase openSim) 72 public void Initialise(OpenSimBase openSim)
66 { 73 {
67 m_openSim = openSim; 74 m_openSim = openSim;
75 m_openSim.ApplicationRegistry.RegisterInterface<LoadRegionsPlugin>(this);
68 } 76 }
69 77
70 public void PostInitialise() 78 public void PostInitialise()
@@ -99,9 +107,18 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
99 107
100 for (int i = 0; i < regionsToLoad.Length; i++) 108 for (int i = 0; i < regionsToLoad.Length; i++)
101 { 109 {
110 IScene scene;
102 m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId.ToString() + 111 m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId.ToString() +
103 ")"); 112 ")");
104 m_openSim.CreateRegion(regionsToLoad[i], true); 113 m_openSim.CreateRegion(regionsToLoad[i], true, out scene);
114 if (scene != null)
115 {
116 m_newRegionCreatedHandler = OnNewRegionCreated;
117 if (m_newRegionCreatedHandler != null)
118 {
119 m_newRegionCreatedHandler(scene);
120 }
121 }
105 } 122 }
106 123
107 m_openSim.ModuleLoader.PostInitialise(); 124 m_openSim.ModuleLoader.PostInitialise();
@@ -182,9 +199,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
182 { 199 {
183 if (regionhandle == regionsToLoad[i].RegionHandle) 200 if (regionhandle == regionsToLoad[i].RegionHandle)
184 { 201 {
202 IScene scene;
185 m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + 203 m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
186 Thread.CurrentThread.ManagedThreadId.ToString() + ")"); 204 Thread.CurrentThread.ManagedThreadId.ToString() + ")");
187 openSim.CreateRegion(regionsToLoad[i], true); 205 openSim.CreateRegion(regionsToLoad[i], true, out scene);
188 } 206 }
189 } 207 }
190 } 208 }
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 7f6ca9a..fcc02d8 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -563,8 +563,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
563 region.RegionID, regionXmlPath); 563 region.RegionID, regionXmlPath);
564 region.SaveRegionToFile("dynamic region", regionXmlPath); 564 region.SaveRegionToFile("dynamic region", regionXmlPath);
565 } 565 }
566 566 IScene newscene;
567 m_app.CreateRegion(region); 567 m_app.CreateRegion(region, out newscene);
568 568
569 responseData["success"] = "true"; 569 responseData["success"] = "true";
570 responseData["region_name"] = region.RegionName; 570 responseData["region_name"] = region.RegionName;