Added a setting to [Startup] section of config that will allow the simulator to start up with no regions configured.
I added the boolean config setting "allow_regionless", defaulting to false. If set to true, opensim will start up ok if no region configurations are found in the specified region_info_source. It will not ask the user to create a region.remove-scene-viewer
parent
c14c4bc1ec
commit
39d7945efc
|
@ -48,11 +48,13 @@ namespace OpenSim.Framework.RegionLoader.Filesystem
|
||||||
public RegionInfo[] LoadRegions()
|
public RegionInfo[] LoadRegions()
|
||||||
{
|
{
|
||||||
string regionConfigPath = Path.Combine(Util.configDir(), "Regions");
|
string regionConfigPath = Path.Combine(Util.configDir(), "Regions");
|
||||||
|
bool allowRegionless = false;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IConfig startupConfig = (IConfig)m_configSource.Configs["Startup"];
|
IConfig startupConfig = (IConfig)m_configSource.Configs["Startup"];
|
||||||
regionConfigPath = startupConfig.GetString("regionload_regionsdir", regionConfigPath).Trim();
|
regionConfigPath = startupConfig.GetString("regionload_regionsdir", regionConfigPath).Trim();
|
||||||
|
allowRegionless = startupConfig.GetBoolean("allow_regionless", false);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
@ -68,7 +70,7 @@ namespace OpenSim.Framework.RegionLoader.Filesystem
|
||||||
string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
|
string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
|
||||||
|
|
||||||
// Create an empty Regions.ini if there are no existing config files.
|
// Create an empty Regions.ini if there are no existing config files.
|
||||||
if (configFiles.Length == 0 && iniFiles.Length == 0)
|
if (!allowRegionless && configFiles.Length == 0 && iniFiles.Length == 0)
|
||||||
{
|
{
|
||||||
new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.ini"), false, m_configSource);
|
new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.ini"), false, m_configSource);
|
||||||
iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
|
iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
|
||||||
|
|
|
@ -57,6 +57,8 @@ namespace OpenSim.Framework.RegionLoader.Web
|
||||||
{
|
{
|
||||||
IConfig startupConfig = (IConfig) m_configSource.Configs["Startup"];
|
IConfig startupConfig = (IConfig) m_configSource.Configs["Startup"];
|
||||||
string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim();
|
string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim();
|
||||||
|
bool allowRegionless = startupConfig.GetBoolean("allow_regionless", false);
|
||||||
|
|
||||||
if (url == String.Empty)
|
if (url == String.Empty)
|
||||||
{
|
{
|
||||||
m_log.Error("[WEBLOADER]: Unable to load webserver URL - URL was empty.");
|
m_log.Error("[WEBLOADER]: Unable to load webserver URL - URL was empty.");
|
||||||
|
@ -64,37 +66,63 @@ namespace OpenSim.Framework.RegionLoader.Web
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
RegionInfo[] regionInfos = new RegionInfo[] {};
|
||||||
|
int regionCount = 0;
|
||||||
HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
|
HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
|
||||||
webRequest.Timeout = 30000; //30 Second Timeout
|
webRequest.Timeout = 30000; //30 Second Timeout
|
||||||
m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url);
|
m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url);
|
||||||
HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
|
|
||||||
m_log.Debug("[WEBLOADER]: Downloading region information...");
|
|
||||||
StreamReader reader = new StreamReader(webResponse.GetResponseStream());
|
|
||||||
string xmlSource = String.Empty;
|
|
||||||
string tempStr = reader.ReadLine();
|
|
||||||
while (tempStr != null)
|
|
||||||
{
|
|
||||||
xmlSource = xmlSource + tempStr;
|
|
||||||
tempStr = reader.ReadLine();
|
|
||||||
}
|
|
||||||
m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
|
|
||||||
xmlSource.Length);
|
|
||||||
XmlDocument xmlDoc = new XmlDocument();
|
|
||||||
xmlDoc.LoadXml(xmlSource);
|
|
||||||
if (xmlDoc.FirstChild.Name == "Regions")
|
|
||||||
{
|
|
||||||
RegionInfo[] regionInfos = new RegionInfo[xmlDoc.FirstChild.ChildNodes.Count];
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
|
|
||||||
{
|
|
||||||
m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
|
|
||||||
regionInfos[i] =
|
|
||||||
new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
|
|
||||||
}
|
|
||||||
|
|
||||||
return regionInfos;
|
try
|
||||||
|
{
|
||||||
|
HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
|
||||||
|
m_log.Debug("[WEBLOADER]: Downloading region information...");
|
||||||
|
StreamReader reader = new StreamReader(webResponse.GetResponseStream());
|
||||||
|
string xmlSource = String.Empty;
|
||||||
|
string tempStr = reader.ReadLine();
|
||||||
|
while (tempStr != null)
|
||||||
|
{
|
||||||
|
xmlSource = xmlSource + tempStr;
|
||||||
|
tempStr = reader.ReadLine();
|
||||||
|
}
|
||||||
|
m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
|
||||||
|
xmlSource.Length);
|
||||||
|
XmlDocument xmlDoc = new XmlDocument();
|
||||||
|
xmlDoc.LoadXml(xmlSource);
|
||||||
|
if (xmlDoc.FirstChild.Name == "Regions")
|
||||||
|
{
|
||||||
|
regionCount = xmlDoc.FirstChild.ChildNodes.Count;
|
||||||
|
|
||||||
|
if (regionCount > 0)
|
||||||
|
{
|
||||||
|
regionInfos = new RegionInfo[regionCount];
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
|
||||||
|
{
|
||||||
|
m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
|
||||||
|
regionInfos[i] =
|
||||||
|
new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (WebException ex)
|
||||||
|
{
|
||||||
|
if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound)
|
||||||
|
{
|
||||||
|
if (!allowRegionless)
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regionCount > 0 | allowRegionless)
|
||||||
|
return regionInfos;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Error("[WEBLOADER]: No region configs were available.");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,10 +112,13 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
|
if (m_scene != null)
|
||||||
if (m_textureManager != null)
|
|
||||||
{
|
{
|
||||||
m_textureManager.RegisterRender(GetContentType(), this);
|
m_textureManager = m_scene.RequestModuleInterface<IDynamicTextureManager>();
|
||||||
|
if (m_textureManager != null)
|
||||||
|
{
|
||||||
|
m_textureManager.RegisterRender(GetContentType(), this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -233,6 +233,7 @@ namespace OpenSim.Tools.Configger
|
||||||
config = defaultConfig.AddConfig("Startup");
|
config = defaultConfig.AddConfig("Startup");
|
||||||
|
|
||||||
config.Set("region_info_source", "filesystem");
|
config.Set("region_info_source", "filesystem");
|
||||||
|
config.Set("allow_regionless", false);
|
||||||
|
|
||||||
config.Set("gridmode", false);
|
config.Set("gridmode", false);
|
||||||
config.Set("physics", "OpenDynamicsEngine");
|
config.Set("physics", "OpenDynamicsEngine");
|
||||||
|
|
|
@ -71,6 +71,11 @@
|
||||||
;; in a <Regions> tag.
|
;; in a <Regions> tag.
|
||||||
; regionload_webserver_url = "http://example.com/regions.xml";
|
; regionload_webserver_url = "http://example.com/regions.xml";
|
||||||
|
|
||||||
|
;# {allow_regionless} {} {Allow simulator to start up with no regions configured.} {true false} false
|
||||||
|
;; Allow the simulator to start up if there are no region configuration available
|
||||||
|
;; from the selected region_info_source.
|
||||||
|
; allow_regionless = false
|
||||||
|
|
||||||
;# {NonPhysicalPrimMax} {} {Maximum size of nonphysical prims?} {} 256
|
;# {NonPhysicalPrimMax} {} {Maximum size of nonphysical prims?} {} 256
|
||||||
;; Maximum size for non-physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonphysicalPrimMax!).
|
;; Maximum size for non-physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonphysicalPrimMax!).
|
||||||
; NonPhysicalPrimMax = 256
|
; NonPhysicalPrimMax = 256
|
||||||
|
|
|
@ -70,6 +70,10 @@
|
||||||
; except that everything is also enclosed in a <Regions> tag.
|
; except that everything is also enclosed in a <Regions> tag.
|
||||||
; regionload_webserver_url = "http://example.com/regions.xml";
|
; regionload_webserver_url = "http://example.com/regions.xml";
|
||||||
|
|
||||||
|
;; Allow the simulator to start up if there are no region configuration available
|
||||||
|
;; from the selected region_info_source.
|
||||||
|
allow_regionless = false
|
||||||
|
|
||||||
; Maximum size of non physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonphysicalPrimMax!).
|
; Maximum size of non physical prims. Affects resizing of existing prims. This can be overriden in the region config file (as NonphysicalPrimMax!).
|
||||||
NonPhysicalPrimMax = 256
|
NonPhysicalPrimMax = 256
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue