diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index a8c40ec813..b07a4d6a36 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -28,6 +28,7 @@
using System;
using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Scenes;
+using Nini.Config;
namespace OpenSim
{
@@ -52,70 +53,16 @@ namespace OpenSim
Console.WriteLine("Starting...\n");
- bool sandBoxMode = true;
- bool startLoginServer = true;
- string physicsEngine = "basicphysics";
+ ArgvConfigSource source = new ArgvConfigSource(args);
- bool userAccounts = false;
- bool gridLocalAsset = false;
- bool useConfigFile = false;
- bool silent = false;
- string configFile = "simconfig.xml";
-
- for (int i = 0; i < args.Length; i++)
- {
- if (args[i] == "-gridmode")
- {
- sandBoxMode = false;
- startLoginServer = false;
- }
+ source.AddSwitch("Startup", "inifile");
+ source.AddSwitch("Startup", "configfile");
+ source.AddSwitch("Startup", "gridmode");
+ source.AddSwitch("Startup", "physics");
+ source.AddSwitch("Startup", "config");
+ source.AddSwitch("Startup", "noverbose");
- if (args[i] == "-accounts")
- {
- userAccounts = true;
- }
- if (args[i] == "-realphysx")
- {
- physicsEngine = "RealPhysX";
- }
- if (args[i] == "-bulletX")
- {
- physicsEngine = "BulletXEngine";
- }
- if (args[i] == "-ode")
- {
- physicsEngine = "OpenDynamicsEngine";
- }
- if (args[i] == "-localasset")
- {
- gridLocalAsset = true;
- }
- if (args[i] == "-configfile")
- {
- useConfigFile = true;
- }
- if (args[i] == "-noverbose")
- {
- silent = true;
- }
- if (args[i] == "-config")
- {
- try
- {
- i++;
- configFile = args[i];
- }
- catch (Exception e)
- {
- Console.WriteLine("-config: Please specify a config file. (" + e.ToString() + ")");
- }
- }
- }
-
- OpenSimMain sim = new OpenSimMain(sandBoxMode, startLoginServer, physicsEngine, useConfigFile, silent, configFile);
-
- sim.user_accounts = userAccounts;
- sim.m_gridLocalAsset = gridLocalAsset;
+ OpenSimMain sim = new OpenSimMain(source);
sim.StartUp();
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index fbd6790907..c68f75e9b6 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -29,6 +29,7 @@
using System;
using System.IO;
using libsecondlife;
+using Nini.Config;
using OpenSim.Assets;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
@@ -39,7 +40,7 @@ using OpenSim.Framework.Servers;
using OpenSim.Framework.Types;
using OpenSim.Framework.Configuration;
using OpenSim.Physics.Manager;
-
+
using OpenSim.Region.ClientStack;
using OpenSim.Region.Communications.Local;
using OpenSim.Region.Communications.OGS1;
@@ -57,7 +58,6 @@ namespace OpenSim
{
public string m_physicsEngine;
public bool m_sandbox;
- public bool m_loginserver;
public bool user_accounts;
public bool m_gridLocalAsset;
protected bool m_useConfigFile;
@@ -70,18 +70,37 @@ namespace OpenSim
private bool m_silent;
private string m_logFilename = ("region-console-" + Guid.NewGuid().ToString() + ".log");
- public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngineName, bool useConfigFile, bool silent, string configFileName)
- :base( )
+ public OpenSimMain(IConfigSource configSource)
+ : base()
{
- m_useConfigFile = useConfigFile;
- m_sandbox = sandBoxMode;
- m_loginserver = startLoginServer;
- m_physicsEngine = physicsEngineName;
- m_configFileName = configFileName;
- m_silent = silent;
+ IConfigSource startupSource = configSource;
+ string iniFile = startupSource.Configs["Startup"].GetString("inifile", "NA");
+ if (iniFile != "NA")
+ {
+ //a ini is set to be used for startup settings
+ string iniFilePath = Path.Combine(Util.configDir(), iniFile);
+ if (File.Exists(iniFilePath))
+ {
+ startupSource = new IniConfigSource(iniFilePath);
+
+ //enable follow line, if we want the original config source(normally commandline args) merged with ini file settings.
+ //in this case we have it so if both sources have the same named setting, command line value will overwrite the ini file value.
+ //(as if someone has bothered to enter a command line arg, we should take notice of it)
+ //startupSource.Merge(configSource);
+ }
+ }
+ ReadConfigSettings(startupSource);
+ }
+
+ protected void ReadConfigSettings(IConfigSource configSource)
+ {
+ m_useConfigFile = configSource.Configs["Startup"].GetBoolean("configfile", false);
+ m_sandbox = !configSource.Configs["Startup"].GetBoolean("gridmode", false);
+ m_physicsEngine = configSource.Configs["Startup"].GetString("physics", "basicphysics");
+ m_configFileName = configSource.Configs["Startup"].GetString("config", "simconfig.xml");
+ m_silent = configSource.Configs["Startup"].GetBoolean("noverbose", false);
}
-
///
/// Performs initialisation of the scene, such as loading configuration from disk.
///
@@ -91,7 +110,7 @@ namespace OpenSim
{
Directory.CreateDirectory(Util.logDir());
}
- m_log = new LogBase(Path.Combine(Util.logDir(),m_logFilename), "Region", this, m_silent);
+ m_log = new LogBase(Path.Combine(Util.logDir(), m_logFilename), "Region", this, m_silent);
MainLog.Instance = m_log;
base.StartUp();
@@ -103,11 +122,11 @@ namespace OpenSim
if (m_sandbox)
{
- m_commsManager = new CommunicationsLocal( m_networkServersInfo, m_httpServer, m_assetCache);
+ m_commsManager = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache);
}
else
{
- m_commsManager = new CommunicationsOGS1( m_networkServersInfo, m_httpServer , m_assetCache);
+ m_commsManager = new CommunicationsOGS1(m_networkServersInfo, m_httpServer, m_assetCache);
}
@@ -129,15 +148,15 @@ namespace OpenSim
for (int i = 0; i < configFiles.Length; i++)
{
- Console.WriteLine("Loading region config file");
+ //Console.WriteLine("Loading region config file");
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i]);
-
+
UDPServer udpServer;
Scene scene = SetupScene(regionInfo, out udpServer);
-
+
m_localScenes.Add(scene);
-
-
+
+
m_udpServers.Add(udpServer);
m_regionData.Add(regionInfo);
}
@@ -148,7 +167,7 @@ namespace OpenSim
this.m_udpServers[i].ServerListener();
}
-
+
}
protected override StorageManager CreateStorageManager(RegionInfo regionInfo)
@@ -160,10 +179,10 @@ namespace OpenSim
{
return new Scene(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer);
}
-
+
protected override void Initialize()
{
- m_networkServersInfo = new NetworkServersInfo("NETWORK SERVERS INFO", Path.Combine(Util.configDir(),"network_servers_information.xml"));
+ m_networkServersInfo = new NetworkServersInfo("NETWORK SERVERS INFO", Path.Combine(Util.configDir(), "network_servers_information.xml"));
m_httpServerPort = m_networkServersInfo.HttpListenerPort;
m_assetCache = new AssetCache("OpenSim.Region.GridInterfaces.Local.dll", m_networkServersInfo.AssetURL, m_networkServersInfo.AssetSendKey);
}
@@ -174,15 +193,15 @@ namespace OpenSim
{
Directory.CreateDirectory(Util.logDir());
}
-
- return new LogBase((Path.Combine(Util.logDir(),m_logFilename)), "Region", this, m_silent);
+
+ return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "Region", this, m_silent);
}
# region Setup methods
- protected override PhysicsScene GetPhysicsScene( )
+ protected override PhysicsScene GetPhysicsScene()
{
- return GetPhysicsScene( m_physicsEngine );
+ return GetPhysicsScene(m_physicsEngine);
}
private class SimStatusHandler : IStreamHandler
@@ -201,7 +220,7 @@ namespace OpenSim
{
get { return "GET"; }
}
-
+
public string Path
{
get { return "/simstatus/"; }
diff --git a/OpenSim/Region/Environment/PermissionManager.cs b/OpenSim/Region/Environment/PermissionManager.cs
index 3f1ba1855a..ea93050299 100644
--- a/OpenSim/Region/Environment/PermissionManager.cs
+++ b/OpenSim/Region/Environment/PermissionManager.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Region.Environment
return false;
SceneObject task = (SceneObject)m_scene.Entities[obj];
- LLUUID taskOwner = null; // Since we dont have a 'owner' property on task yet
+ LLUUID taskOwner = task.rootPrimitive.OwnerID;
// Object owners should be able to edit their own content
if (user == taskOwner)
diff --git a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs
index 8ed04d9056..3eb34b4c77 100644
--- a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs
+++ b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs
@@ -94,16 +94,24 @@ namespace OpenSim.Region.Environment.Scenes
return dupe;
}
+ ///
+ ///
+ ///
+ ///
public void CopyRootPart(AllNewSceneObjectPart2 part)
{
- AllNewSceneObjectPart2 newPart = part.Copy(m_scene);
+ AllNewSceneObjectPart2 newPart = part.Copy(m_scene.PrimIDAllocate());
this.m_parts.Add(newPart.UUID, newPart);
this.SetPartAsRoot(newPart);
}
+ ///
+ ///
+ ///
+ ///
public void CopyPart(AllNewSceneObjectPart2 part)
{
- AllNewSceneObjectPart2 newPart = part.Copy(m_scene);
+ AllNewSceneObjectPart2 newPart = part.Copy(m_scene.PrimIDAllocate());
this.m_parts.Add(newPart.UUID, newPart);
this.SetPartAsNonRoot(newPart);
}
diff --git a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs
index 65b4287256..42acab9a80 100644
--- a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs
+++ b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs
@@ -27,7 +27,7 @@ namespace OpenSim.Region.Environment.Scenes
public uint EveryoneMask = FULL_MASK_PERMISSIONS;
public uint BaseMask = FULL_MASK_PERMISSIONS;
- protected PrimitiveBaseShape m_shape;
+
protected byte[] m_particleSystem = new byte[0];
protected AllNewSceneObjectGroup2 m_parentGroup;
@@ -54,9 +54,6 @@ namespace OpenSim.Region.Environment.Scenes
}
protected string m_name;
- ///
- ///
- ///
public virtual string Name
{
get { return m_name; }
@@ -154,9 +151,9 @@ namespace OpenSim.Region.Environment.Scenes
set { m_touchName = value; }
}
+ protected PrimitiveBaseShape m_shape;
public PrimitiveBaseShape Shape
{
-
get { return this.m_shape; }
set { m_shape = value; }
}
@@ -245,14 +242,13 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public AllNewSceneObjectPart2 Copy(Scene scene)
+ public AllNewSceneObjectPart2 Copy(uint localID)
{
AllNewSceneObjectPart2 dupe = (AllNewSceneObjectPart2)this.MemberwiseClone();
dupe.m_shape = m_shape.Copy();
dupe.m_regionHandle = m_regionHandle;
- uint newLocalID = scene.PrimIDAllocate();
dupe.UUID = LLUUID.Random();
- dupe.LocalID = newLocalID;
+ dupe.LocalID = localID;
dupe.OffsetPosition = new LLVector3(OffsetPosition.X, OffsetPosition.Y, OffsetPosition.Z);
dupe.RotationOffset = new LLQuaternion(RotationOffset.X, RotationOffset.Y, RotationOffset.Z, RotationOffset.W);
dupe.Velocity = new LLVector3(0, 0, 0);
@@ -303,7 +299,7 @@ namespace OpenSim.Region.Environment.Scenes
}
else
{
- if (m_updateFlag == 2) // is a new prim just been created/reloaded or has major changes
+ if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
{
SendFullUpdateToAllClients();
ClearUpdateSchedule();
diff --git a/prebuild.xml b/prebuild.xml
index ab00e20c6c..dcf03ecf32 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -666,7 +666,7 @@
-
+