From e5d59dc696e647624047465e0e718f2c65106b3c Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 28 Jan 2014 15:29:06 -0800 Subject: Repair database routines so they properly return null when asked for the heighmap of a region that does not exist. --- OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 6 +++++- OpenSim/Data/MySQL/MySQLSimulationData.cs | 6 +++++- OpenSim/Data/Null/NullSimulationData.cs | 1 + OpenSim/Data/PGSQL/PGSQLSimulationData.cs | 6 +++++- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 6 +++++- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index 9f5991b..1a5ecd6 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs @@ -531,10 +531,14 @@ ELSE /// public double[,] LoadTerrain(UUID regionID) { + double[,] ret = null; TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); - return terrData.GetDoubles(); + if (terrData != null) + ret = terrData.GetDoubles(); + return ret; } + // Returns 'null' if region not found public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) { TerrainData terrData = null; diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 42f2ebb..2921c1c 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -616,10 +616,14 @@ namespace OpenSim.Data.MySQL // Legacy region loading public double[,] LoadTerrain(UUID regionID) { + double[,] ret = null; TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); - return terrData.GetDoubles(); + if (terrData != null) + ret = terrData.GetDoubles(); + return ret; } + // Returns 'null' if region not found public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) { TerrainData terrData = null; diff --git a/OpenSim/Data/Null/NullSimulationData.cs b/OpenSim/Data/Null/NullSimulationData.cs index acde1a1..deeaced 100644 --- a/OpenSim/Data/Null/NullSimulationData.cs +++ b/OpenSim/Data/Null/NullSimulationData.cs @@ -148,6 +148,7 @@ namespace OpenSim.Data.Null } // Legacy. Just don't do this. + // Returns 'null' if region not found public double[,] LoadTerrain(UUID regionID) { if (m_terrains.ContainsKey(regionID)) diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs index 1505f87..77d87d4 100644 --- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs +++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs @@ -524,10 +524,14 @@ namespace OpenSim.Data.PGSQL /// public double[,] LoadTerrain(UUID regionID) { + double[,] ret = null; TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); - return terrData.GetDoubles(); + if (terrData != null) + ret = terrData.GetDoubles(); + return ret; } + // Returns 'null' if region not found public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) { TerrainData terrData = null; diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 5a34f09..9466e99 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -870,10 +870,14 @@ namespace OpenSim.Data.SQLite /// Heightfield data public double[,] LoadTerrain(UUID regionID) { + double[,] ret = null; TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); - return terrData.GetDoubles(); + if (terrData != null) + ret = terrData.GetDoubles(); + return ret; } + // Returns 'null' if region not found public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) { TerrainData terrData = null; -- cgit v1.1 From bfb0011cd3dd3235ea2adf97979e018d3cafec95 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 28 Jan 2014 15:43:47 -0800 Subject: Some major surgery on the sun module. Updates to the client were gated by a "mode" check. That mode check has been removed (it didn't result in any change of behavior anyway). Also added a command line variable update to set the sun position time offset (offset from the system clock). Default is no offset to preserve existing behavior. --- OpenSim/Region/CoreModules/World/Sun/SunModule.cs | 97 +++++++++++------------ 1 file changed, 46 insertions(+), 51 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index 6f344c8..c0b7312 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs @@ -68,9 +68,6 @@ namespace OpenSim.Region.CoreModules // updating those region settings in GenSunPos() private bool receivedEstateToolsSunUpdate = false; - // Configurable values - private string m_RegionMode = "SL"; - // Sun's position information is updated and sent to clients every m_UpdateInterval frames private int m_UpdateInterval = 0; @@ -90,7 +87,6 @@ namespace OpenSim.Region.CoreModules // private double m_longitude = 0; // private double m_latitude = 0; // Configurable defaults Defaults close to SL - private string d_mode = "SL"; private int d_frame_mod = 100; // Every 10 seconds (actually less) private double d_day_length = 4; // A VW day is 4 RW hours long private int d_year_length = 60; // There are 60 VW days in a VW year @@ -134,12 +130,15 @@ namespace OpenSim.Region.CoreModules private const int TICKS_PER_SECOND = 10000000; + private ulong m_CurrentTimeOffset = 0; + // Current time in elapsed seconds since Jan 1st 1970 private ulong CurrentTime { get { - return (ulong)(((DateTime.Now.Ticks) - TicksToEpoch + TicksUTCOffset) / TICKS_PER_SECOND); + ulong ctime = (ulong)(((DateTime.Now.Ticks) - TicksToEpoch + TicksUTCOffset) / TICKS_PER_SECOND); + return ctime + m_CurrentTimeOffset; } } @@ -291,8 +290,6 @@ namespace OpenSim.Region.CoreModules try { // Mode: determines how the sun is handled - m_RegionMode = config.Configs["Sun"].GetString("mode", d_mode); - // Mode: determines how the sun is handled // m_latitude = config.Configs["Sun"].GetDouble("latitude", d_latitude); // Mode: determines how the sun is handled // m_longitude = config.Configs["Sun"].GetDouble("longitude", d_longitude); @@ -314,7 +311,6 @@ namespace OpenSim.Region.CoreModules catch (Exception e) { m_log.Debug("[SUN]: Configuration access failed, using defaults. Reason: " + e.Message); - m_RegionMode = d_mode; m_YearLengthDays = d_year_length; m_DayLengthHours = d_day_length; m_HorizonShift = d_day_night; @@ -325,40 +321,28 @@ namespace OpenSim.Region.CoreModules // m_longitude = d_longitude; } - switch (m_RegionMode) - { - case "T1": - default: - case "SL": - // Time taken to complete a cycle (day and season) - - SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60); - SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); + SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60); + SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); - // Ration of real-to-virtual time + // Ration of real-to-virtual time - // VWTimeRatio = 24/m_day_length; + // VWTimeRatio = 24/m_day_length; - // Speed of rotation needed to complete a cycle in the - // designated period (day and season) + // Speed of rotation needed to complete a cycle in the + // designated period (day and season) - SunSpeed = m_SunCycle/SecondsPerSunCycle; - SeasonSpeed = m_SeasonalCycle/SecondsPerYear; + SunSpeed = m_SunCycle/SecondsPerSunCycle; + SeasonSpeed = m_SeasonalCycle/SecondsPerYear; - // Horizon translation + // Horizon translation - HorizonShift = m_HorizonShift; // Z axis translation - // HoursToRadians = (SunCycle/24)*VWTimeRatio; - - m_log.Debug("[SUN]: Mode is " + m_RegionMode); - m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days"); - m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift); - m_log.Debug("[SUN]: Percentage of time for daylight " + m_DayTimeSunHourScale); - m_log.Debug("[SUN]: Positional data updated every " + m_UpdateInterval + " frames"); - - break; - } + HorizonShift = m_HorizonShift; // Z axis translation + // HoursToRadians = (SunCycle/24)*VWTimeRatio; + m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days"); + m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift); + m_log.Debug("[SUN]: Percentage of time for daylight " + m_DayTimeSunHourScale); + m_log.Debug("[SUN]: Positional data updated every " + m_UpdateInterval + " frames"); } public Type ReplaceableInterface @@ -385,7 +369,8 @@ namespace OpenSim.Region.CoreModules string sunCommand = string.Format("sun {0}", kvp.Key); m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} []", sunCommand), kvp.Value, "", HandleSunConsoleCommand); } - + m_scene.AddCommand("Regions", this, "sun help", "sun help", "list parameters that can be changed", "", HandleSunConsoleCommand); + m_scene.AddCommand("Regions", this, "sun list", "sun list", "list parameters that can be changed", "", HandleSunConsoleCommand); ready = true; } @@ -419,23 +404,22 @@ namespace OpenSim.Region.CoreModules public void SunToClient(IClientAPI client) { - if (m_RegionMode != "T1") + if (ready) { - if (ready) + if (m_SunFixed) { - if (m_SunFixed) - { - // m_log.DebugFormat("[SUN]: SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ", m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString()); - client.SendSunPos(Position, Velocity, PosTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition); - } - else - { - // m_log.DebugFormat("[SUN]: SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ", m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString()); - client.SendSunPos(Position, Velocity, CurrentTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition); - } + // m_log.DebugFormat("[SUN]: Fixed SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ", + // m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString()); + client.SendSunPos(Position, Velocity, PosTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition); + } + else + { + // m_log.DebugFormat("[SUN]: SunHour {0}, Position {1}, PosTime {2}, OrbitalPosition : {3} ", + // m_SunFixedHour, Position.ToString(), PosTime.ToString(), OrbitalPosition.ToString()); + client.SendSunPos(Position, Velocity, CurrentTime, SecondsPerSunCycle, SecondsPerYear, OrbitalPosition); } } - } + } public void SunUpdate() { @@ -532,6 +516,9 @@ namespace OpenSim.Region.CoreModules case "update_interval": return m_UpdateInterval; + case "current_time": + return CurrentTime; + default: throw new Exception("Unknown sun parameter."); } @@ -572,7 +559,7 @@ namespace OpenSim.Region.CoreModules foreach (string output in ParseCmdParams(cmdparams)) { - m_log.Info("[SUN] " + output); + MainConsole.Instance.Output(output); } } @@ -581,10 +568,11 @@ namespace OpenSim.Region.CoreModules Dictionary Params = new Dictionary(); Params.Add("year_length", "number of days to a year"); - Params.Add("day_length", "number of seconds to a day"); + Params.Add("day_length", "number of hours to a day"); Params.Add("day_night_offset", "induces a horizon shift"); Params.Add("update_interval", "how often to update the sun's position in frames"); Params.Add("day_time_sun_hour_scale", "scales day light vs nite hours to change day/night ratio"); + Params.Add("current_time", "time in seconds of the simulator"); return Params; } @@ -646,6 +634,13 @@ namespace OpenSim.Region.CoreModules m_UpdateInterval = (int)value; break; + case "current_time": + // best to get the current time offset out of the currenttime equation then + // reset it + m_CurrentTimeOffset = 0; + m_CurrentTimeOffset = CurrentTime - (ulong)value; + break; + default: Output.Add(String.Format("Unknown parameter {0}.", args[1])); return Output; -- cgit v1.1 From d25265ae82a3ac3afc32f65f820c9ed0b2bff31f Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 28 Jan 2014 15:58:45 -0800 Subject: Fix terrain tests by properly initializing low detail terrain to zero height. Also remove PI heightmap test as new heightmaps only have two significant digits. --- OpenSim/Framework/TerrainData.cs | 1 + OpenSim/Region/CoreModules/World/Land/LandObject.cs | 5 ++++- OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs | 4 ---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/TerrainData.cs b/OpenSim/Framework/TerrainData.cs index 1c52a69..d1e0e7e 100644 --- a/OpenSim/Framework/TerrainData.cs +++ b/OpenSim/Framework/TerrainData.cs @@ -274,6 +274,7 @@ namespace OpenSim.Framework m_taint = new bool[SizeX / Constants.TerrainPatchSize, SizeY / Constants.TerrainPatchSize]; // m_log.DebugFormat("{0} new by dimensions. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ); ClearTaint(); + ClearLand(0f); } public HeightmapTerrainData(short[] cmap, float pCompressionFactor, int pX, int pY, int pZ) : this(pX, pY, pZ) diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index f8f4986..939512f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -134,7 +134,10 @@ namespace OpenSim.Region.CoreModules.World.Land public LandObject(UUID owner_id, bool is_group_owned, Scene scene) { m_scene = scene; - m_landBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; + if (m_scene == null) + m_landBitmap = new bool[Constants.RegionSize / landUnit, Constants.RegionSize / landUnit]; + else + m_landBitmap = new bool[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; LandData.OwnerID = owner_id; if (is_group_owned) diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs index be719ea..d557168 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs @@ -100,10 +100,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests x[0, 0] -= 1.0; Assert.That(x[0, 0] == 4.0, "Terrain addition/subtraction error."); - x[0, 0] = Math.PI; - double[,] doublesExport = x.GetDoubles(); - Assert.That(doublesExport[0, 0] == Math.PI, "Export to double[,] array not working correctly."); - x[0, 0] = 1.0; float[] floatsExport = x.GetFloatsSerialised(); Assert.That(floatsExport[0] == 1.0f, "Export to float[] not working correctly."); -- cgit v1.1 From 0c3493f61965ab3fcd16217f72ed2ae7a347130c Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 28 Jan 2014 16:25:01 -0800 Subject: clear land tainting when tested. Then testing, pass scene to LandObject as now needed to get region size --- OpenSim/Framework/TerrainData.cs | 6 +++++- OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/TerrainData.cs b/OpenSim/Framework/TerrainData.cs index d1e0e7e..9325df2 100644 --- a/OpenSim/Framework/TerrainData.cs +++ b/OpenSim/Framework/TerrainData.cs @@ -160,7 +160,11 @@ namespace OpenSim.Framework public override bool IsTaintedAt(int xx, int yy) { - return m_taint[xx / Constants.TerrainPatchSize, yy / Constants.TerrainPatchSize]; + int tx = xx / Constants.TerrainPatchSize; + int ty = yy / Constants.TerrainPatchSize; + bool ret = m_taint[tx, ty]; + m_taint[tx, ty] = false; + return ret; } // TerrainData.GetDatabaseBlob diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 53f41f9..e08a42d 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -579,7 +579,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests ArchiveConstants.CONTROL_FILE_PATH, new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup())); - LandObject lo = new LandObject(groupID, true, null); + LandObject lo = new LandObject(groupID, true, m_scene); lo.SetLandBitmap(lo.BasicFullRegionLandBitmap()); LandData ld = lo.LandData; ld.GlobalID = landID; -- cgit v1.1 From 2877c7d94df7711df27517df24fc326635dbc561 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 28 Jan 2014 16:34:22 -0800 Subject: Actually make the parameter updates change the behavior of sun movement. --- OpenSim/Region/CoreModules/World/Sun/SunModule.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index c0b7312..e04cb29 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs @@ -616,14 +616,18 @@ namespace OpenSim.Region.CoreModules { case "year_length": m_YearLengthDays = (int)value; + SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); break; case "day_length": m_DayLengthHours = value; + SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60); + SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); break; case "day_night_offset": m_HorizonShift = value; + HorizonShift = m_HorizonShift; break; case "day_time_sun_hour_scale": -- cgit v1.1 From 226b5e4d758288b6c57dfbd25e011927a31f46e6 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 28 Jan 2014 16:36:56 -0800 Subject: Increase the strength of brushes in brush test in an attempt to overcome rounding introduced with new terrain height class. --- OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs index d557168..81e87d7 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); ITerrainPaintableEffect effect = new RaiseSphere(); - effect.PaintEffect(map, allowMask, (int)Constants.RegionSize * 0.5f, (int)Constants.RegionSize * 0.5f, -1.0, 2, 0.1); + effect.PaintEffect(map, allowMask, (int)Constants.RegionSize * 0.5f, (int)Constants.RegionSize * 0.5f, -1.0, 4, 0.1); Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (127,128)."); Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (124,128)."); Assert.That(map[123, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (123,128)."); @@ -77,7 +77,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests } effect = new LowerSphere(); - effect.PaintEffect(map, allowMask, ((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), -1.0, 2, 6.0); + effect.PaintEffect(map, allowMask, ((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), -1.0, 4, 6.0); Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] < 1.0, "Lower brush should lowering value at this point (124,128)."); -- cgit v1.1 From dde0e547a792f556f300eb791cf77dc7cbfe6a63 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 28 Jan 2014 16:48:34 -0800 Subject: Change area of brush test to account for rounding errors in terrain implementation --- OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs index 81e87d7..13ac11e 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests effect.PaintEffect(map, allowMask, (int)Constants.RegionSize * 0.5f, (int)Constants.RegionSize * 0.5f, -1.0, 4, 0.1); Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (127,128)."); Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (124,128)."); - Assert.That(map[123, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (123,128)."); + Assert.That(map[120, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (120,128)."); Assert.That(map[128, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (128,128)."); Assert.That(map[0, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (0,128)."); @@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] < 1.0, "Lower brush should lowering value at this point (124,128)."); - Assert.That(map[123, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (123,128)."); + Assert.That(map[120, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (120,128)."); Assert.That(map[128, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (128,128)."); Assert.That(map[0, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (0,128)."); } -- cgit v1.1 From 678c1079155673f3e411e065ccc19b95dcf5a18e Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 28 Jan 2014 16:58:27 -0800 Subject: Temporarily disable brush test. It will come back when tuning is complete. --- OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs index 13ac11e..ff4cdfe 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs @@ -51,6 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests } } + /* // // Test RaiseSphere // @@ -84,6 +85,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests Assert.That(map[120, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (120,128)."); Assert.That(map[128, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (128,128)."); Assert.That(map[0, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (0,128)."); + */ } [Test] -- cgit v1.1 From 1900254e77b61f643f569621ace017052b27f792 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 28 Jan 2014 21:43:18 -0800 Subject: Restore brush tests with correct values and adjustments for new terrain height rounding characteristics. --- .../CoreModules/World/Terrain/Tests/TerrainTest.cs | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs index ff4cdfe..96c16a9 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs @@ -40,10 +40,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests [Test] public void BrushTest() { + int midRegion = (int)Constants.RegionSize / 2; + + // Create a mask that covers only the left half of the region bool[,] allowMask = new bool[(int)Constants.RegionSize, 256]; int x; int y; - for (x = 0; x < (int)((int)Constants.RegionSize * 0.5f); x++) + for (x = 0; x < midRegion; x++) { for (y = 0; y < (int)Constants.RegionSize; y++) { @@ -51,20 +54,18 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests } } - /* // // Test RaiseSphere // TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); ITerrainPaintableEffect effect = new RaiseSphere(); - effect.PaintEffect(map, allowMask, (int)Constants.RegionSize * 0.5f, (int)Constants.RegionSize * 0.5f, -1.0, 4, 0.1); - Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (127,128)."); - Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] > 0.0, "Raise brush should raising value at this point (124,128)."); - Assert.That(map[120, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (120,128)."); - Assert.That(map[128, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (128,128)."); - Assert.That(map[0, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Raise brush should not change value at this point (0,128)."); - + effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0); + Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128)."); + Assert.That(map[125, midRegion] > 0.0, "Raise brush should raising value at this point (124,128)."); + Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128)."); + Assert.That(map[128, midRegion] == 0.0, "Raise brush should not change value at this point (128,128)."); + Assert.That(map[0, midRegion] == 0.0, "Raise brush should not change value at this point (0,128)."); // // Test LowerSphere // @@ -78,14 +79,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests } effect = new LowerSphere(); - effect.PaintEffect(map, allowMask, ((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), -1.0, 4, 6.0); - Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); - Assert.That(map[127, (int)((int)Constants.RegionSize * 0.5f)] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); - Assert.That(map[124, (int)((int)Constants.RegionSize * 0.5f)] < 1.0, "Lower brush should lowering value at this point (124,128)."); - Assert.That(map[120, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (120,128)."); - Assert.That(map[128, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (128,128)."); - Assert.That(map[0, (int)((int)Constants.RegionSize * 0.5f)] == 1.0, "Lower brush should not change value at this point (0,128)."); - */ + effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0); + Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); + Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); + Assert.That(map[125, midRegion] < 1.0, "Lower brush should lowering value at this point (124,128)."); + Assert.That(map[120, midRegion] == 1.0, "Lower brush should not change value at this point (120,128)."); + Assert.That(map[128, midRegion] == 1.0, "Lower brush should not change value at this point (128,128)."); + Assert.That(map[0, midRegion] == 1.0, "Lower brush should not change value at this point (0,128)."); } [Test] -- cgit v1.1 From 3f5c6c897f9ed6a8a78e8beddf4f5713995d5f34 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 28 Jan 2014 22:40:39 -0800 Subject: One more run at fixing the sun module. Parameter setting fixed to work through the OSSL interface. And setting the parameters now adjusts all the dependent variables correctly so the sun moves at the modified rate. --- OpenSim/Region/CoreModules/World/Sun/SunModule.cs | 104 +++++++++++----------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index e04cb29..561552a 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs @@ -261,10 +261,8 @@ namespace OpenSim.Region.CoreModules private float GetCurrentTimeAsLindenSunHour() { - if (m_SunFixed) - return m_SunFixedHour + 6; - - return GetCurrentSunHour() + 6.0f; + float curtime = m_SunFixed ? m_SunFixedHour : GetCurrentSunHour(); + return (curtime + 6.0f) % 24.0f; } #region INonSharedRegion Methods @@ -517,7 +515,7 @@ namespace OpenSim.Region.CoreModules return m_UpdateInterval; case "current_time": - return CurrentTime; + return GetCurrentTimeAsLindenSunHour(); default: throw new Exception("Unknown sun parameter."); @@ -526,7 +524,51 @@ namespace OpenSim.Region.CoreModules public void SetSunParameter(string param, double value) { - HandleSunConsoleCommand("sun", new string[] {param, value.ToString() }); + switch (param) + { + case "year_length": + m_YearLengthDays = (int)value; + SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); + SeasonSpeed = m_SeasonalCycle/SecondsPerYear; + break; + + case "day_length": + m_DayLengthHours = value; + SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60); + SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); + SunSpeed = m_SunCycle/SecondsPerSunCycle; + SeasonSpeed = m_SeasonalCycle/SecondsPerYear; + break; + + case "day_night_offset": + m_HorizonShift = value; + HorizonShift = m_HorizonShift; + break; + + case "day_time_sun_hour_scale": + m_DayTimeSunHourScale = value; + break; + + case "update_interval": + m_UpdateInterval = (int)value; + break; + + case "current_time": + value = (value + 18.0) % 24.0; + // set the current offset so that the effective sun time is the parameter + m_CurrentTimeOffset = 0; // clear this first so we use raw time + m_CurrentTimeOffset = (ulong)(SecondsPerSunCycle * value/ 24.0) - (CurrentTime % SecondsPerSunCycle); + break; + + default: + throw new Exception("Unknown sun parameter."); + + // Generate shared values + GenSunPos(); + + // When sun settings are updated, we should update all clients with new settings. + SunUpdateToAllClients(); + } } public float GetCurrentSunHour() @@ -606,57 +648,15 @@ namespace OpenSim.Region.CoreModules } else if (args.Length == 3) { - float value = 0.0f; - if (!float.TryParse(args[2], out value)) + double value = 0.0; + if (! double.TryParse(args[2], out value)) { Output.Add(String.Format("The parameter value {0} is not a valid number.", args[2])); + return Output; } - switch (args[1].ToLower()) - { - case "year_length": - m_YearLengthDays = (int)value; - SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); - break; - - case "day_length": - m_DayLengthHours = value; - SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60); - SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); - break; - - case "day_night_offset": - m_HorizonShift = value; - HorizonShift = m_HorizonShift; - break; - - case "day_time_sun_hour_scale": - m_DayTimeSunHourScale = value; - break; - - case "update_interval": - m_UpdateInterval = (int)value; - break; - - case "current_time": - // best to get the current time offset out of the currenttime equation then - // reset it - m_CurrentTimeOffset = 0; - m_CurrentTimeOffset = CurrentTime - (ulong)value; - break; - - default: - Output.Add(String.Format("Unknown parameter {0}.", args[1])); - return Output; - } - + SetSunParameter(args[1].ToLower(), value); Output.Add(String.Format("Parameter {0} set to {1}.", args[1], value.ToString())); - - // Generate shared values - GenSunPos(); - - // When sun settings are updated, we should update all clients with new settings. - SunUpdateToAllClients(); } return Output; -- cgit v1.1 From 0842e2e15b6af6f940648b0b74488f2da88ce920 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 29 Jan 2014 06:44:14 -0800 Subject: BulletSim: default physical terrain implementation to heightmap. It originally looked like mesh terrain would perform better for vehicles but, after much use, heightmap is the clear winner. Force terrain implementation to heightmap if the physics region is larger than legacy region size. This solves running out of memory for very large regions. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 8 ++++++++ bin/OpenSimDefaults.ini | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 834228e..d993e6a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -538,7 +538,7 @@ public static class BSParam (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ), new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", - (float)BSTerrainPhys.TerrainImplementation.Mesh ), + (float)BSTerrainPhys.TerrainImplementation.Heightmap ), new ParameterDefn("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , 2 ), new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index fe014fc..2d2e55f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -235,6 +235,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters // Set default values for physics parameters plus any overrides from the ini file GetInitialParameterValues(config); + // Force some parameters to values depending on other configurations + // Only use heightmap terrain implementation if terrain larger than legacy size + if ((uint)regionExtent.X > Constants.RegionSize || (uint)regionExtent.Y > Constants.RegionSize) + { + m_log.WarnFormat("{0} Forcing terrain implementation to heightmap for large region", LogHeader); + BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap; + } + // Get the connection to the physics engine (could be native or one of many DLLs) PE = SelectUnderlyingBulletEngine(BulletEngineName); diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index df94239..026f285 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1001,10 +1001,10 @@ ; Terrain implementation can use either Bullet's heightField or BulletSim can build ; a mesh. 0=heightField, 1=mesh - TerrainImplementation = 1 + TerrainImplementation = 0 ; For mesh terrain, the detail of the created mesh. '1' gives 256x256 (heightfield ; resolution). '2' gives 512x512. Etc. Cannot be larger than '4'. Higher - ; magnification uses lots of memory. + ; magnifications use lots of memory. TerrainMeshMagnification = 2 ; Avatar physics height adjustments. -- cgit v1.1 From bdab05df0ecd68e31c7b7fe15614b812df58614b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 30 Jan 2014 00:03:22 +0000 Subject: Add "show grid user" robust/standalone console command for debug purposes. Shows all data on entries which match or start with a given ID. This would usually be a UUID. --- .../Services/UserAccountService/GridUserService.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs index bef1691..bfc27b5 100644 --- a/OpenSim/Services/UserAccountService/GridUserService.cs +++ b/OpenSim/Services/UserAccountService/GridUserService.cs @@ -50,6 +50,14 @@ namespace OpenSim.Services.UserAccountService MainConsole.Instance.Commands.AddCommand( "Users", false, + "show grid user", + "show grid user ", + "Show grid user entry or entries that match or start with the given ID. This will normally be a UUID.", + "This is for debug purposes to see what data is found for a particular user id.", + HandleShowGridUser); + + MainConsole.Instance.Commands.AddCommand( + "Users", false, "show grid users online", "show grid users online", "Show number of grid users registered as online.", @@ -58,6 +66,31 @@ namespace OpenSim.Services.UserAccountService HandleShowGridUsersOnline); } + protected void HandleShowGridUser(string module, string[] cmdparams) + { + if (cmdparams.Length != 4) + { + MainConsole.Instance.Output("Usage: show grid user "); + return; + } + + GridUserData[] data = m_Database.GetAll(cmdparams[3]); + + foreach (GridUserData gu in data) + { + ConsoleDisplayList cdl = new ConsoleDisplayList(); + + cdl.AddRow("User ID", gu.UserID); + + foreach (KeyValuePair kvp in gu.Data) + cdl.AddRow(kvp.Key, kvp.Value); + + MainConsole.Instance.Output(cdl.ToString()); + } + + MainConsole.Instance.OutputFormat("Entries: {0}", data.Length); + } + protected void HandleShowGridUsersOnline(string module, string[] cmdparams) { // if (cmdparams.Length != 4) -- cgit v1.1 From b73baeb4a454e493be03b2e0ed98ee1bca77e922 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 30 Jan 2014 00:40:56 +0000 Subject: Record whether login to home fails because no home set (UUID.Zero) or region not found. --- OpenSim/Services/LLLoginService/LLLoginService.cs | 29 +++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index fe43582..6a748fe 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -382,11 +382,30 @@ namespace OpenSim.Services.LLLoginService // GridRegion home = null; GridUserInfo guinfo = m_GridUserService.LoggedIn(account.PrincipalID.ToString()); - if (guinfo != null && (guinfo.HomeRegionID != UUID.Zero) && m_GridService != null) + + // We are only going to complain about no home if the user actually tries to login there, to avoid + // spamming the console. + if (guinfo != null) { - home = m_GridService.GetRegionByUUID(scopeID, guinfo.HomeRegionID); + if (guinfo.HomeRegionID == UUID.Zero && startLocation == "home") + { + m_log.WarnFormat( + "[LLOGIN SERVICE]: User {0} tried to login to a 'home' start location but they have none set", + account.Name); + } + else if (m_GridService != null) + { + home = m_GridService.GetRegionByUUID(scopeID, guinfo.HomeRegionID); + + if (home == null && startLocation == "home") + { + m_log.WarnFormat( + "[LLOGIN SERVICE]: User {0} tried to login to a 'home' start location with ID {1} but this was not found.", + account.Name, guinfo.HomeRegionID); + } + } } - if (guinfo == null) + else { // something went wrong, make something up, so that we don't have to test this anywhere else guinfo = new GridUserInfo(); @@ -506,10 +525,6 @@ namespace OpenSim.Services.LLLoginService if (home == null) { - m_log.WarnFormat( - "[LLOGIN SERVICE]: User {0} {1} tried to login to a 'home' start location but they have none set", - account.FirstName, account.LastName); - tryDefaults = true; } else -- cgit v1.1 From 67ec95bde88d852df0f150dd55ea19456b4a070b Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 24 Jan 2014 15:32:12 -0800 Subject: Updated methods for handling LSL script errors, deprecated, and not implemented --- .../Shared/Api/Implementation/LSL_Api.cs | 65 +++++++++++++++++++--- 1 file changed, 58 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e54b697..1aa094b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -101,7 +101,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// protected TaskInventoryItem m_item; - protected bool throwErrorOnNotImplemented = true; + protected bool throwErrorOnNotImplemented = false; protected AsyncCommandManager AsyncCommands = null; protected float m_ScriptDelayFactor = 1.0f; protected float m_ScriptDistanceFactor = 1.0f; @@ -11245,20 +11245,71 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return item.ItemID; } - internal void ShoutError(string msg) + /// + /// Reports the script error in the viewer's Script Warning/Error dialog and shouts it on the debug channel. + /// + /// The name of the command that generated the error. + /// The error message to report to the user. + internal void Error(string command, string message) { - llShout(ScriptBaseClass.DEBUG_CHANNEL, msg); + string text = command + ": " + message; + if (text.Length > 1023) + { + text = text.Substring(0, 1023); + } + + World.SimChat(Utils.StringToBytes(text), ChatTypeEnum.DebugChannel, ScriptBaseClass.DEBUG_CHANNEL, + m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false); + + IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); + if (wComm != null) + { + wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, text); + } } - internal void NotImplemented(string command) + /// + /// Reports that the command is not implemented as a script error. + /// + /// The name of the command that is not implemented. + /// Additional information to report to the user. (Optional) + internal void NotImplemented(string command, string message = "") { if (throwErrorOnNotImplemented) - throw new NotImplementedException("Command not implemented: " + command); + { + if (message != "") + { + message = " - " + message; + } + + throw new NotImplementedException("Command not implemented: " + command + message); + } + else + { + string text = "Command not implemented"; + if (message != "") + { + text = text + " - " + message; + } + + Error(command, text); + } } - internal void Deprecated(string command) + /// + /// Reports that the command is deprecated as a script error. + /// + /// The name of the command that is deprecated. + /// Additional information to report to the user. (Optional) + internal void Deprecated(string command, string message = "") { - throw new ScriptException("Command deprecated: " + command); + string text = "Command deprecated"; + if (message != "") + { + text = text + " - " + message; + } + + Error(command, text); } internal void LSLError(string msg) -- cgit v1.1 From 13bb9ea6826f9141704c1baf9f2366ae38c06245 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 24 Jan 2014 15:44:12 -0800 Subject: Updated ShoutError() calls to use new LSL error methods --- .../Shared/Api/Implementation/LSL_Api.cs | 65 +++++++++------------- 1 file changed, 27 insertions(+), 38 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1aa094b..f56010a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((item = GetScriptByName(name)) != UUID.Zero) m_ScriptEngine.ResetScript(item); else - ShoutError("llResetOtherScript: script "+name+" not found"); + Error("llResetOtherScript", "Script " + name + " not found"); } public LSL_Integer llGetScriptState(string name) @@ -275,7 +275,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return m_ScriptEngine.GetScriptState(item) ?1:0; } - ShoutError("llGetScriptState: script "+name+" not found"); + Error("llGetScriptState", "Script " + name + " not found"); // If we didn't find it, then it's safe to // assume it is not running. @@ -298,7 +298,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - ShoutError("llSetScriptState: script "+name+" not found"); + Error("llSetScriptState", "Script " + name + " not found"); } } @@ -3320,7 +3320,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface(); if (emailModule == null) { - ShoutError("llEmail: email module not configured"); + Error("llEmail", "Email module not configured"); return; } @@ -3334,7 +3334,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface(); if (emailModule == null) { - ShoutError("llGetNextEmail: email module not configured"); + Error("llGetNextEmail", "Email module not configured"); return; } Email email; @@ -3734,7 +3734,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 && !m_automaticLinkPermission) { - ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); + Error("llCreateLink", "PERMISSION_CHANGE_LINKS permission not set"); return; } @@ -3789,7 +3789,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 && !m_automaticLinkPermission) { - ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); + Error("llBreakLink", "PERMISSION_CHANGE_LINKS permission not set"); return; } @@ -4403,11 +4403,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (message == string.Empty) { - ShoutError("Trying to use llTextBox with empty message."); + Error("llTextBox", "Empty message"); } else if (message.Length > 512) { - ShoutError("Trying to use llTextBox with message over 512 characters."); + Error("llTextBox", "Message more than 512 characters"); } else { @@ -6861,15 +6861,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0); } - /// - /// This is a depecated function so this just replicates the result of - /// invoking it in SL - /// public void llRemoteLoadScript(string target, string name, int running, int start_param) { m_host.AddScriptLPS(1); - // Report an error as it does in SL - ShoutError("Deprecated. Please use llRemoteLoadScriptPin instead."); + Deprecated("llRemoteLoadScript", "Use llRemoteLoadScriptPin instead"); ScriptSleep(3000); } @@ -7951,9 +7946,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } catch (InvalidCastException e) { - ShoutError(string.Format( - "{0} error running rule #{1}: arg #{2} ", - originFunc, rulesParsed, idx - idxStart) + e.Message); + Error(originFunc, string.Format("Error running rule #{0}: arg #{1} - ", rulesParsed, idx - idxStart) + e.Message); } finally { @@ -10050,7 +10043,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api presence = World.GetScenePresence(agentID); } } - else ShoutError("The argument of PARCEL_MEDIA_COMMAND_AGENT must be a key"); + else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_AGENT must be a key"); ++i; } break; @@ -10081,7 +10074,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api url = (LSL_String)commandList.Data[i + 1]; update = true; } - else ShoutError("The argument of PARCEL_MEDIA_COMMAND_URL must be a string."); + else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_URL must be a string"); ++i; } break; @@ -10094,7 +10087,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api texture = (LSL_String)commandList.Data[i + 1]; update = true; } - else ShoutError("The argument of PARCEL_MEDIA_COMMAND_TEXTURE must be a string or key."); + else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_TEXTURE must be a string or a key"); ++i; } break; @@ -10106,7 +10099,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { time = (float)(LSL_Float)commandList.Data[i + 1]; } - else ShoutError("The argument of PARCEL_MEDIA_COMMAND_TIME must be a float."); + else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_TIME must be a float"); ++i; } break; @@ -10120,7 +10113,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api update = true; } - else ShoutError("The argument of PARCEL_MEDIA_COMMAND_AUTO_ALIGN must be an integer."); + else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_AUTO_ALIGN must be an integer"); ++i; } break; @@ -10133,7 +10126,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api mediaType = (LSL_String)commandList.Data[i + 1]; update = true; } - else ShoutError("The argument of PARCEL_MEDIA_COMMAND_TYPE must be a string."); + else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_TYPE must be a string"); ++i; } break; @@ -10146,7 +10139,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api description = (LSL_String)commandList.Data[i + 1]; update = true; } - else ShoutError("The argument of PARCEL_MEDIA_COMMAND_DESC must be a string."); + else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_DESC must be a string"); ++i; } break; @@ -10162,9 +10155,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api height = (LSL_Integer)commandList.Data[i + 2]; update = true; } - else ShoutError("The second argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer."); + else Error("llParcelMediaCommandList", "The second argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer"); } - else ShoutError("The first argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer."); + else Error("llParcelMediaCommandList", "The first argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer"); i += 2; } break; @@ -10336,7 +10329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) { - ShoutError("No permissions to track the camera"); + Error("llGetCameraPos", "No permissions to track the camera"); return Vector3.Zero; } @@ -10359,7 +10352,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) { - ShoutError("No permissions to track the camera"); + Error("llGetCameraRot", "No permissions to track the camera"); return Quaternion.Identity; } @@ -10382,14 +10375,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptSleep(2000); } - /// - /// The SL implementation shouts an error, it is deprecated - /// This duplicates SL - /// public void llRefreshPrimURL() { m_host.AddScriptLPS(1); - ShoutError("llRefreshPrimURL - not yet supported"); + Deprecated("llRefreshPrimURL"); ScriptSleep(20000); } @@ -11346,7 +11335,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (assetID == UUID.Zero) { // => complain loudly, as specified by the LSL docs - ShoutError("Notecard '" + name + "' could not be found."); + Error("llGetNumberOfNotecardLines", "Notecard '" + name + "' could not be found"); return UUID.Zero.ToString(); } @@ -11368,7 +11357,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (a == null || a.Type != 7) { - ShoutError("Notecard '" + name + "' could not be found."); + Error("llGetNumberOfNotecardLines", "Notecard '" + name + "' could not be found"); return; } @@ -11399,7 +11388,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (assetID == UUID.Zero) { // => complain loudly, as specified by the LSL docs - ShoutError("Notecard '" + name + "' could not be found."); + Error("llGetNotecardLine", "Notecard '" + name + "' could not be found"); return UUID.Zero.ToString(); } @@ -11422,7 +11411,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (a == null || a.Type != 7) { - ShoutError("Notecard '" + name + "' could not be found."); + Error("llGetNotecardLine", "Notecard '" + name + "' could not be found"); return; } -- cgit v1.1 From 257f9cec40786175157f8bfed7232b6532eabd5f Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 24 Jan 2014 16:34:01 -0800 Subject: Updated "not implemented" LSL errors to use NotImplemented() --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f56010a..6b203ab 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3053,7 +3053,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llStopLookAt() { m_host.AddScriptLPS(1); -// NotImplemented("llStopLookAt"); m_host.StopLookAt(); } @@ -3419,7 +3418,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api catch (NotImplementedException) { // Currently not implemented in DotNetEngine only XEngine - NotImplemented("llMinEventDelay in DotNetEngine"); + NotImplemented("llMinEventDelay", "In DotNetEngine"); } } @@ -10163,7 +10162,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; default: - NotImplemented("llParcelMediaCommandList parameter not supported yet: " + Enum.Parse(typeof(ParcelMediaCommandEnum), commandList.Data[i].ToString()).ToString()); + NotImplemented("llParcelMediaCommandList", "Parameter not supported yet: " + Enum.Parse(typeof(ParcelMediaCommandEnum), commandList.Data[i].ToString()).ToString()); break; }//end switch }//end for @@ -10271,7 +10270,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; default: ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; - NotImplemented("llParcelMediaQuery parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString()); + NotImplemented("llParcelMediaQuery", "Parameter not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString()); break; } -- cgit v1.1 From c9550e473d7c9ec64d1cbffc8005f03a1aef13db Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 24 Jan 2014 16:46:10 -0800 Subject: Updated "deprecated" LSL errors to use Deprecrated() --- .../Shared/Api/Implementation/LSL_Api.cs | 30 ++++++++-------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6b203ab..33dd77f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2553,9 +2553,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llSound(string sound, double volume, int queue, int loop) { m_host.AddScriptLPS(1); - // This function has been deprecated - // see http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSound - Deprecated("llSound"); + Deprecated("llSound", "Use llPlaySound instead"); } // Xantor 20080528 PlaySound updated so it accepts an objectinventory name -or- a key to a sound @@ -2914,28 +2912,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) { m_host.AddScriptLPS(1); - Deprecated("llMakeExplosion"); + Deprecated("llMakeExplosion", "Use llParticleSystem instead"); ScriptSleep(100); } public void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset) { m_host.AddScriptLPS(1); - Deprecated("llMakeFountain"); + Deprecated("llMakeFountain", "Use llParticleSystem instead"); ScriptSleep(100); } public void llMakeSmoke(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) { m_host.AddScriptLPS(1); - Deprecated("llMakeSmoke"); + Deprecated("llMakeSmoke", "Use llParticleSystem instead"); ScriptSleep(100); } public void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) { m_host.AddScriptLPS(1); - Deprecated("llMakeFire"); + Deprecated("llMakeFire", "Use llParticleSystem instead"); ScriptSleep(100); } @@ -3236,13 +3234,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llTakeCamera(string avatar) { m_host.AddScriptLPS(1); - Deprecated("llTakeCamera"); + Deprecated("llTakeCamera", "Use llSetCameraParams instead"); } public void llReleaseCamera(string avatar) { m_host.AddScriptLPS(1); - Deprecated("llReleaseCamera"); + Deprecated("llReleaseCamera", "Use llClearCameraParams instead"); } public LSL_String llGetOwner() @@ -3422,13 +3420,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - /// - /// llSoundPreload is deprecated. In SL this appears to do absolutely nothing - /// and is documented to have no delay. - /// public void llSoundPreload(string sound) { m_host.AddScriptLPS(1); + Deprecated("llSoundPreload", "Use llPreloadSound instead"); } public void llRotLookAt(LSL_Rotation target, double strength, double damping) @@ -8000,7 +7995,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String llXorBase64Strings(string str1, string str2) { m_host.AddScriptLPS(1); - Deprecated("llXorBase64Strings"); + Deprecated("llXorBase64Strings", "Use llXorBase64 instead"); ScriptSleep(300); return String.Empty; } @@ -8008,7 +8003,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llRemoteDataSetRegion() { m_host.AddScriptLPS(1); - Deprecated("llRemoteDataSetRegion"); + Deprecated("llRemoteDataSetRegion", "Use llOpenRemoteDataChannel instead"); } public LSL_Float llLog10(double val) @@ -10364,13 +10359,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return Quaternion.Identity; } - /// - /// The SL implementation does nothing, it is deprecated - /// This duplicates SL - /// public void llSetPrimURL(string url) { m_host.AddScriptLPS(1); + Deprecated("llSetPrimURL", "Use llSetPrimMediaParams instead"); ScriptSleep(2000); } -- cgit v1.1 From 9db4090c0771a28e8b9591f7403b28b7fe06a1df Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 24 Jan 2014 16:53:17 -0800 Subject: Replaced LSLError() calls with calls to Error() --- .../Shared/Api/Implementation/LSL_Api.cs | 25 +++++++++------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 33dd77f..02b4007 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -890,7 +890,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (channelID == 0) { - LSLError("Cannot use llRegionSay() on channel 0"); + Error("llRegionSay", "Cannot use on channel 0"); return; } @@ -2884,7 +2884,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) { - LSLError("No permissions to give money"); + Error("llGiveMoney", "No permissions to give money"); return; } @@ -2892,7 +2892,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(destination, out toID)) { - LSLError("Bad key in llGiveMoney"); + Error("llGiveMoney", "Bad key in llGiveMoney"); return; } @@ -4391,7 +4391,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID av = new UUID(); if (!UUID.TryParse(agent,out av)) { - LSLError("First parameter to llTextBox needs to be a key"); + Error("llTextBox", "First parameter must be a key"); return; } @@ -6811,17 +6811,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID av = new UUID(); if (!UUID.TryParse(avatar,out av)) { - LSLError("First parameter to llDialog needs to be a key"); + Error("llDialog", "First parameter must be a key"); return; } if (buttons.Length < 1) { - LSLError("No less than 1 button can be shown"); + Error("llDialog", "At least 1 button must be shown"); return; } if (buttons.Length > 12) { - LSLError("No more than 12 buttons can be shown"); + Error("llDialog", "No more than 12 buttons can be shown"); return; } string[] buts = new string[buttons.Length]; @@ -6829,12 +6829,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (buttons.Data[i].ToString() == String.Empty) { - LSLError("button label cannot be blank"); + Error("llDialog", "Button label cannot be blank"); return; } if (buttons.Data[i].ToString().Length > 24) { - LSLError("button label cannot be longer than 24 characters"); + Error("llDialog", "Button label cannot be longer than 24 characters"); return; } buts[i] = buttons.Data[i].ToString(); @@ -10302,7 +10302,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (quick_pay_buttons.Data.Length < 4) { - LSLError("List must have at least 4 elements"); + Error("llSetPayPrice", "List must have at least 4 elements"); return; } m_host.ParentGroup.RootPart.PayPrice[0]=price; @@ -11292,11 +11292,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Error(command, text); } - internal void LSLError(string msg) - { - throw new ScriptException("LSL Runtime Error: " + msg); - } - public delegate void AssetRequestCallback(UUID assetID, AssetBase asset); protected void WithNotecard(UUID assetID, AssetRequestCallback cb) { -- cgit v1.1 From d405254971b2e33dc9a469701689d91af5693e75 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 24 Jan 2014 17:33:12 -0800 Subject: Replaced llSay()ing LSL errors with calls Error() --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 02b4007..24b473d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2955,13 +2955,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (item == null) { - llSay(0, "Could not find object " + inventory); + Error("llRezAtRoot", "Could not find object " + inventory); return; } if (item.InvType != (int)InventoryType.Object) { - llSay(0, "Unable to create requested object. Object is missing from database."); + Error("llRezAtRoot", "Unable to create requested object. Object is missing from database."); return; } @@ -4003,7 +4003,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(destination, out destId)) { - llSay(0, "Could not parse key " + destination); + Error("llGiveInventory", "Could not parse key " + destination); return; } @@ -4011,8 +4011,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (item == null) { - llSay(0, String.Format("Could not find object '{0}'", inventory)); - throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory)); + Error("llGiveInventory", String.Format("Could not find object '{0}'", inventory)); } UUID objId = item.ItemID; @@ -4036,7 +4035,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (account == null) { - llSay(0, "Can't find destination "+destId.ToString()); + Error("llGiveInventory", "Can't find destination " + destId.ToString()); return; } } @@ -6876,7 +6875,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(target, out destId)) { - llSay(0, "Could not parse key " + target); + Error("llRemoteLoadScriptPin", "Could not parse key " + target); return; } @@ -6892,7 +6891,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // make sure the object is a script if (item == null || item.Type != 10) { - llSay(0, "Could not find script " + name); + Error("llRemoteLoadScriptPin", "Could not find script " + name); return; } @@ -9718,7 +9717,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (item == null) { - llSay(0, "No item name '" + item + "'"); + Error("llGetInventoryCreator", "Cannot find item '" + item + "'"); return String.Empty; } -- cgit v1.1 From 3d62f4369d800f854d8306f1ebf4ce5d3de71818 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 25 Jan 2014 12:00:11 -0800 Subject: Replaced throwing exceptions with calls to Error() --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 24b473d..ae9f827 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7972,9 +7972,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string encodedData = Convert.ToBase64String(encData_byte); return encodedData; } - catch (Exception e) + catch { - throw new Exception("Error in base64Encode" + e.Message); + Error("llBase64ToString", "Error encoding string"); + return String.Empty; } } @@ -7985,9 +7986,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { return Util.Base64ToString(str); } - catch (Exception e) + catch { - throw new Exception("Error in base64Decode" + e.Message); + Error("llBase64ToString", "Error decoding string"); + return String.Empty; } } @@ -10678,7 +10680,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!ok || flag < 0 || flag > (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE) { - throw new ScriptException("Parameter " + i.ToString() + " is an invalid flag"); + Error("llHTTPRequest", "Parameter " + i.ToString() + " is an invalid flag"); } param.Add(parameters.Data[i].ToString()); //Add parameter flag @@ -10702,12 +10704,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { //There must be at least one name/value pair for custom header if (count == 1) - throw new ScriptException("Missing name/value for custom header at parameter " + i.ToString()); + Error("llHTTPRequest", "Missing name/value for custom header at parameter " + i.ToString()); break; } if (HttpStandardHeaders.Contains(parameters.Data[i].ToString(), StringComparer.OrdinalIgnoreCase)) - throw new ScriptException("Name is invalid as a custom header at parameter " + i.ToString()); + Error("llHTTPRequest", "Name is invalid as a custom header at parameter " + i.ToString()); param.Add(parameters.Data[i].ToString()); param.Add(parameters.Data[i+1].ToString()); -- cgit v1.1 From 1380b37d71d50bb2e701f3e0a70ab0f1e2aa3407 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 25 Jan 2014 12:44:39 -0800 Subject: Made error messages more consistent --- .../Shared/Api/Implementation/LSL_Api.cs | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ae9f827..6991831 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((item = GetScriptByName(name)) != UUID.Zero) m_ScriptEngine.ResetScript(item); else - Error("llResetOtherScript", "Script " + name + " not found"); + Error("llResetOtherScript", "Can't find script '" + name + "'"); } public LSL_Integer llGetScriptState(string name) @@ -275,7 +275,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return m_ScriptEngine.GetScriptState(item) ?1:0; } - Error("llGetScriptState", "Script " + name + " not found"); + Error("llGetScriptState", "Can't find script '" + name + "'"); // If we didn't find it, then it's safe to // assume it is not running. @@ -298,7 +298,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - Error("llSetScriptState", "Script " + name + " not found"); + Error("llSetScriptState", "Can't find script '" + name + "'"); } } @@ -2955,13 +2955,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (item == null) { - Error("llRezAtRoot", "Could not find object " + inventory); + Error("llRezAtRoot", "Can't find object '" + inventory + "'"); return; } if (item.InvType != (int)InventoryType.Object) { - Error("llRezAtRoot", "Unable to create requested object. Object is missing from database."); + Error("llRezAtRoot", "Can't create requested object; object is missing from database"); return; } @@ -4003,7 +4003,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(destination, out destId)) { - Error("llGiveInventory", "Could not parse key " + destination); + Error("llGiveInventory", "Can't parse destination key '" + destination + "'"); return; } @@ -4011,7 +4011,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (item == null) { - Error("llGiveInventory", String.Format("Could not find object '{0}'", inventory)); + Error("llGiveInventory", "Can't find inventory object '" + inventory + "'"); } UUID objId = item.ItemID; @@ -4035,7 +4035,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (account == null) { - Error("llGiveInventory", "Can't find destination " + destId.ToString()); + Error("llGiveInventory", "Can't find destination '" + destId.ToString() + "'"); return; } } @@ -6875,7 +6875,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!UUID.TryParse(target, out destId)) { - Error("llRemoteLoadScriptPin", "Could not parse key " + target); + Error("llRemoteLoadScriptPin", "Can't parse key '" + target + "'"); return; } @@ -6891,7 +6891,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // make sure the object is a script if (item == null || item.Type != 10) { - Error("llRemoteLoadScriptPin", "Could not find script " + name); + Error("llRemoteLoadScriptPin", "Can't find script '" + name + "'"); return; } @@ -9719,7 +9719,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (item == null) { - Error("llGetInventoryCreator", "Cannot find item '" + item + "'"); + Error("llGetInventoryCreator", "Can't find item '" + item + "'"); return String.Empty; } @@ -11322,7 +11322,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (assetID == UUID.Zero) { // => complain loudly, as specified by the LSL docs - Error("llGetNumberOfNotecardLines", "Notecard '" + name + "' could not be found"); + Error("llGetNumberOfNotecardLines", "Can't find notecard '" + name + "'"); return UUID.Zero.ToString(); } @@ -11344,7 +11344,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (a == null || a.Type != 7) { - Error("llGetNumberOfNotecardLines", "Notecard '" + name + "' could not be found"); + Error("llGetNumberOfNotecardLines", "Can't find notecard '" + name + "'"); return; } @@ -11375,7 +11375,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (assetID == UUID.Zero) { // => complain loudly, as specified by the LSL docs - Error("llGetNotecardLine", "Notecard '" + name + "' could not be found"); + Error("llGetNotecardLine", "Can't find notecard '" + name + "'"); return UUID.Zero.ToString(); } @@ -11398,7 +11398,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (a == null || a.Type != 7) { - Error("llGetNotecardLine", "Notecard '" + name + "' could not be found"); + Error("llGetNotecardLine", "Can't find notecard '" + name + "'"); return; } -- cgit v1.1 From b8e22f02e79e84d29e65a46751d68235f93aa8e8 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Thu, 19 Dec 2013 14:08:46 +0200 Subject: Make sure Web streams are disposed after use --- OpenSim/Framework/WebUtil.cs | 6 +- .../Avatar/UserProfiles/UserProfileModule.cs | 77 ++++++++++------------ .../Scripting/HttpRequest/ScriptsHttpRequests.cs | 7 +- .../CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- .../RegionReadyModule/RegionReadyModule.cs | 2 +- .../Neighbour/NeighbourServicesConnector.cs | 4 +- 6 files changed, 45 insertions(+), 53 deletions(-) diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index bcf6af8..54a6c0c 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -1030,7 +1030,7 @@ namespace OpenSim.Framework finally { if (requestStream != null) - requestStream.Close(); + requestStream.Dispose(); // capture how much time was spent writing tickdata = Util.EnvironmentTickCountSubtract(tickstart); @@ -1183,7 +1183,7 @@ namespace OpenSim.Framework finally { if (requestStream != null) - requestStream.Close(); + requestStream.Dispose(); // capture how much time was spent writing tickdata = Util.EnvironmentTickCountSubtract(tickstart); @@ -1268,4 +1268,4 @@ namespace OpenSim.Framework return deserial; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index b21082f..9ae7452 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -1290,9 +1290,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles webRequest.ContentType = "application/json-rpc"; webRequest.Method = "POST"; - Stream dataStream = webRequest.GetRequestStream(); - dataStream.Write(content, 0, content.Length); - dataStream.Close(); + using (Stream dataStream = webRequest.GetRequestStream()) + dataStream.Write(content, 0, content.Length); WebResponse webResponse = null; try @@ -1306,26 +1305,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles return false; } - Stream rstream = webResponse.GetResponseStream(); - - OSDMap mret = new OSDMap(); - try - { - mret = (OSDMap)OSDParser.DeserializeJson(rstream); - } - catch (Exception e) + using (webResponse) + using (Stream rstream = webResponse.GetResponseStream()) { - m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); - return false; - } + OSDMap mret = (OSDMap)OSDParser.DeserializeJson(rstream); + if (mret.ContainsKey("error")) + return false; - if (mret.ContainsKey("error")) - return false; - - // get params... - OSD.DeserializeMembers(ref parameters, (OSDMap) mret["result"]); - return true; + // get params... + OSD.DeserializeMembers(ref parameters, (OSDMap)mret["result"]); + return true; + } } /// @@ -1366,9 +1357,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles webRequest.ContentType = "application/json-rpc"; webRequest.Method = "POST"; - Stream dataStream = webRequest.GetRequestStream(); - dataStream.Write(content, 0, content.Length); - dataStream.Close(); + using (Stream dataStream = webRequest.GetRequestStream()) + dataStream.Write(content, 0, content.Length); WebResponse webResponse = null; try @@ -1382,29 +1372,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles return false; } - Stream rstream = webResponse.GetResponseStream(); - - OSDMap response = new OSDMap(); - try - { - response = (OSDMap)OSDParser.DeserializeJson(rstream); - } - catch (Exception e) + using (webResponse) + using (Stream rstream = webResponse.GetResponseStream()) { - m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); - return false; - } + OSDMap response = new OSDMap(); + try + { + response = (OSDMap)OSDParser.DeserializeJson(rstream); + } + catch (Exception e) + { + m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); + return false; + } - if(response.ContainsKey("error")) - { - data = response["error"]; - return false; - } + if (response.ContainsKey("error")) + { + data = response["error"]; + return false; + } - data = response; + data = response; - return true; + return true; + } } + #endregion Web Util } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index c3a8afd..a7237ea 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -488,9 +488,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest byte[] data = Util.UTF8.GetBytes(OutboundBody); Request.ContentLength = data.Length; - Stream bstream = Request.GetRequestStream(); - bstream.Write(data, 0, data.Length); - bstream.Close(); + using (Stream bstream = Request.GetRequestStream()) + bstream.Write(data, 0, data.Length); } try @@ -584,4 +583,4 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest Request.Abort(); } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index cf2ef29..03e044b 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -915,7 +915,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap finally { if (os != null) - os.Close(); + os.Dispose(); } string response_mapItems_reply = null; diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index eb386fe..e10b9ad 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -301,7 +301,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady finally { if (os != null) - os.Close(); + os.Dispose(); } } } diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index 774fe2a..96a756d 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs @@ -162,7 +162,7 @@ namespace OpenSim.Services.Connectors finally { if (os != null) - os.Close(); + os.Dispose(); } // Let's wait for the response @@ -202,4 +202,4 @@ namespace OpenSim.Services.Connectors return true; } } -} \ No newline at end of file +} -- cgit v1.1 From abb193ec9421f167286f5cd07ff8d2b1fe207749 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Wed, 22 Jan 2014 16:14:42 +0200 Subject: In UuidGatherer, gather materials referenced in the prim's TextureEntry Signed-off-by: dahlia --- OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index 75a51b5..fe6cb84 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -161,7 +161,7 @@ namespace OpenSim.Region.Framework.Scenes { // Get the prim's default texture. This will be used for faces which don't have their own texture if (textureEntry.DefaultTexture != null) - assetUuids[textureEntry.DefaultTexture.TextureID] = (sbyte)AssetType.Texture; + GatherTextureEntryAssets(textureEntry.DefaultTexture, assetUuids); if (textureEntry.FaceTextures != null) { @@ -169,7 +169,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (Primitive.TextureEntryFace texture in textureEntry.FaceTextures) { if (texture != null) - assetUuids[texture.TextureID] = (sbyte)AssetType.Texture; + GatherTextureEntryAssets(texture, assetUuids); } } } @@ -233,6 +233,19 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Gather all the asset uuids found in one face of a Texture Entry. + /// + private void GatherTextureEntryAssets(Primitive.TextureEntryFace texture, IDictionary assetUuids) + { + assetUuids[texture.TextureID] = (sbyte)AssetType.Texture; + + if (texture.MaterialID != UUID.Zero) + { + GatherAssetUuids(texture.MaterialID, (sbyte)OpenSimAssetType.Material, assetUuids); + } + } + // /// // /// The callback made when we request the asset for an object from the asset service. // /// -- cgit v1.1 From a8e64cd59a7a296b7cae6fc0a66255a7f566e10d Mon Sep 17 00:00:00 2001 From: dahlia Date: Sat, 1 Feb 2014 04:09:20 -0800 Subject: Overload INPCModule.CreateNPC() to allow agentID to be specified. Note: this is intended for use in region modules and is not exposed to scripts. --- OpenSim/Region/Framework/Interfaces/INPCModule.cs | 26 ++++++++++++++++++++++ .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 15 ++++++++++++- .../Region/OptionalModules/World/NPC/NPCModule.cs | 26 ++++++++++++++++++++-- 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 9817cf7..d5dcddd 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -72,6 +72,32 @@ namespace OpenSim.Region.Framework.Interfaces AvatarAppearance appearance); /// + /// Create an NPC with a user-supplied agentID + /// + /// + /// + /// + /// + /// The desired agent ID + /// + /// + /// Make the NPC show up as an agent on LSL sensors. The default is + /// that they show up as the NPC type instead, but this is currently + /// an OpenSim-only extension. + /// + /// + /// + /// The avatar appearance to use for the new NPC. + /// + /// + /// The UUID of the ScenePresence created. UUID.Zero if there was a + /// failure. + /// + UUID CreateNPC(string firstname, string lastname, + Vector3 position, UUID agentID, UUID owner, bool senseAsAgent, Scene scene, + AvatarAppearance appearance); + + /// /// Check if the agent is an NPC. /// /// diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index a895ee1..fb644b7 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC private readonly string m_firstname; private readonly string m_lastname; private readonly Vector3 m_startPos; - private readonly UUID m_uuid = UUID.Random(); + private readonly UUID m_uuid; private readonly Scene m_scene; private readonly UUID m_ownerID; @@ -71,6 +71,19 @@ namespace OpenSim.Region.OptionalModules.World.NPC m_firstname = firstname; m_lastname = lastname; m_startPos = position; + m_uuid = UUID.Random(); + m_scene = scene; + m_ownerID = ownerID; + SenseAsAgent = senseAsAgent; + } + + public NPCAvatar( + string firstname, string lastname, UUID agentID, Vector3 position, UUID ownerID, bool senseAsAgent, Scene scene) + { + m_firstname = firstname; + m_lastname = lastname; + m_startPos = position; + m_uuid = agentID; m_scene = scene; m_ownerID = ownerID; SenseAsAgent = senseAsAgent; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index fffe1ab..8a2da6e 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -140,8 +140,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC Vector3 position, UUID owner, bool senseAsAgent, Scene scene, AvatarAppearance appearance) { - NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, - owner, senseAsAgent, scene); + return CreateNPC(firstname, lastname, position, UUID.Zero, owner, senseAsAgent, scene, appearance); + } + + public UUID CreateNPC(string firstname, string lastname, + Vector3 position, UUID agentID, UUID owner, bool senseAsAgent, Scene scene, + AvatarAppearance appearance) + { + NPCAvatar npcAvatar = null; + + try + { + if (agentID == UUID.Zero) + npcAvatar = new NPCAvatar(firstname, lastname, position, + owner, senseAsAgent, scene); + else + npcAvatar = new NPCAvatar(firstname, lastname, agentID, position, + owner, senseAsAgent, scene); + } + catch (Exception e) + { + m_log.Info("[NPC MODULE]: exception creating NPC avatar: " + e.ToString()); + return UUID.Zero; + } + npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue); -- cgit v1.1 From 9c97fb8e127e91d48cf92eeed238cf80878e2286 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 2 Feb 2014 11:17:49 -0800 Subject: Implement terrain merging in TerrainChannel. Modify archiver to use terrain merging when loading oars. This makes displacement AND rotation properly work on terrain when loading oars. Especially useful when loading legacy region oars into large varregions. --- .../World/Archiver/ArchiveReadRequest.cs | 40 +++++++----- .../CoreModules/World/Archiver/ArchiverModule.cs | 31 ++++++++-- .../CoreModules/World/Terrain/TerrainModule.cs | 35 ++--------- .../Region/Framework/Interfaces/ITerrainChannel.cs | 3 + .../Region/Framework/Interfaces/ITerrainModule.cs | 2 +- OpenSim/Region/Framework/Scenes/TerrainChannel.cs | 72 ++++++++++++++++++++++ 6 files changed, 129 insertions(+), 54 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index f4807ad..6f68966 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver protected Vector3 m_displacement = Vector3.Zero; /// - /// Rotation to apply to the objects as they are loaded. + /// Rotation (in radians) to apply to the objects as they are loaded. /// protected float m_rotation = 0f; @@ -184,7 +184,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero; m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f; m_rotationCenter = options.ContainsKey("rotationCenter") ? (Vector3)options["rotationCenter"] - : new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0f); + : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f); // Zero can never be a valid user id m_validUserUuids[UUID.Zero] = false; @@ -454,8 +454,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver // Reload serialized prims m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); - float angle = (float)(m_rotation / 180.0 * Math.PI); - OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, angle); + OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, m_rotation); UUID oldTelehubUUID = scene.RegionInfo.RegionSettings.TelehubObject; @@ -483,16 +482,25 @@ namespace OpenSim.Region.CoreModules.World.Archiver // Happily this does not do much to the object since it hasn't been added to the scene yet if (sceneObject.AttachmentPoint == 0) { - if (angle != 0f) + if (m_displacement != Vector3.Zero || m_rotation != 0f) { - sceneObject.RootPart.RotationOffset = rot * sceneObject.GroupRotation; - Vector3 offset = sceneObject.AbsolutePosition - m_rotationCenter; - offset *= rot; - sceneObject.AbsolutePosition = m_rotationCenter + offset; - } - if (m_displacement != Vector3.Zero) - { - sceneObject.AbsolutePosition += m_displacement; + Vector3 pos = sceneObject.AbsolutePosition; + if (m_rotation != 0f) + { + // Rotate the object + sceneObject.RootPart.RotationOffset = rot * sceneObject.GroupRotation; + // Get object position relative to rotation axis + Vector3 offset = pos - m_rotationCenter; + // Rotate the object position + offset *= rot; + // Restore the object position back to relative to the region + pos = m_rotationCenter + offset; + } + if (m_displacement != Vector3.Zero) + { + pos += m_displacement; + } + sceneObject.AbsolutePosition = pos; } } @@ -868,10 +876,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver ITerrainModule terrainModule = scene.RequestModuleInterface(); MemoryStream ms = new MemoryStream(data); - if (m_displacement != Vector3.Zero) + if (m_displacement != Vector3.Zero || m_rotation != 0f) { - Vector2 terrainDisplacement = new Vector2(m_displacement.X, m_displacement.Y); - terrainModule.LoadFromStream(terrainPath, terrainDisplacement, ms); + Vector2 rotationCenter = new Vector2(m_rotationCenter.X, m_rotationCenter.Y); + terrainModule.LoadFromStream(terrainPath, m_displacement, m_rotation, rotationCenter, ms); } else { diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 2a6f1eb..6fbac4c 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -120,19 +120,38 @@ namespace OpenSim.Region.CoreModules.World.Archiver { displacement = v == null ? Vector3.Zero : Vector3.Parse(v); } - catch (Exception e) + catch { m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing displacement"); - displacement = new Vector3(0f, 0f, 0f); + m_log.ErrorFormat("[ARCHIVER MODULE] Must be represented as vector3: --displacement \"<128,128,0>\""); + return; } }); options.Add("rotation=", delegate (string v) { - rotation = float.Parse(v); - rotation = Util.Clamp(rotation, -359f, 359f); + try + { + rotation = v == null ? 0f : float.Parse(v); + } + catch + { + m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing rotation"); + m_log.ErrorFormat("[ARCHIVER MODULE] Must be an angle in degrees between -360 and +360: --rotation 45"); + return; + } + // Convert to radians for internals + rotation = Util.Clamp(rotation, -359f, 359f) / 180f * (float)Math.PI; }); options.Add("rotationcenter=", delegate (string v) { - // RA 20130119: libomv's Vector2.Parse doesn't work. Need to use vector3 for the moment - rotationCenter = Vector3.Parse(v); + try + { + rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v); + } + catch + { + m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing rotation displacement"); + m_log.ErrorFormat("[ARCHIVER MODULE] Must be represented as vector3: --rotationcenter \"<128,128,0>\""); + return; + } }); // Send a message to the region ready module diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 7bc5e88..08891d9 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -316,8 +316,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain public void LoadFromStream(string filename, Stream stream) { - Vector2 defaultDisplacement = new Vector2(0f, 0f); - LoadFromStream(filename, defaultDisplacement, stream); + LoadFromStream(filename, Vector3.Zero, 0f, Vector2.Zero, stream); } /// @@ -325,7 +324,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain /// /// Filename to terrain file. Type is determined by extension. /// - public void LoadFromStream(string filename, Vector2 displacement, Stream stream) + public void LoadFromStream(string filename, Vector3 displacement, + float radianRotation, Vector2 rotationDisplacement, Stream stream) { foreach (KeyValuePair loader in m_loaders) { @@ -336,7 +336,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain try { ITerrainChannel channel = loader.Value.LoadStream(stream); - MergeTerrainIntoExisting(channel, displacement); + m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement); UpdateRevertMap(); } catch (NotImplementedException) @@ -356,33 +356,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename)); } - private void MergeTerrainIntoExisting(ITerrainChannel channel, Vector2 displacement) - { - if (displacement == Vector2.Zero) - { - // If there is no displacement, just use this channel as the new heightmap - m_scene.Heightmap = channel; - m_channel = channel; - } - else - { - // If there is a displacement, we copy the loaded heightmap into the overall region - for (int xx = 0; xx < channel.Width; xx++) - { - for (int yy = 0; yy < channel.Height; yy++) - { - int dispX = xx + (int)displacement.X; - int dispY = yy + (int)displacement.Y; - if (dispX >= 0 && dispX < m_channel.Width - && dispY >= 0 && dispY < m_channel.Height) - { - m_channel[dispX, dispY] = channel[xx, yy]; - } - } - } - } - } - private static Stream URIFetch(Uri uri) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainChannel.cs b/OpenSim/Region/Framework/Interfaces/ITerrainChannel.cs index 469bd31..f660b8d 100644 --- a/OpenSim/Region/Framework/Interfaces/ITerrainChannel.cs +++ b/OpenSim/Region/Framework/Interfaces/ITerrainChannel.cs @@ -26,6 +26,7 @@ */ using OpenSim.Framework; +using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { @@ -56,5 +57,7 @@ namespace OpenSim.Region.Framework.Interfaces ITerrainChannel MakeCopy(); string SaveToXmlString(); void LoadFromXmlString(string data); + // Merge some terrain into this channel + void Merge(ITerrainChannel newTerrain, Vector3 displacement, float radianRotation, Vector2 rotationDisplacement); } } diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs index 189a30a..a6f5d98 100644 --- a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// void LoadFromStream(string filename, Stream stream); - void LoadFromStream(string filename, Vector2 displacement, Stream stream); + void LoadFromStream(string filename, Vector3 displacement, float radianRotation, Vector2 rotationDisplacement, Stream stream); void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap); /// /// Save a terrain to a stream. diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs index b4b1823..24709dc 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs @@ -36,6 +36,8 @@ using OpenSim.Data; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; +using OpenMetaverse; + using log4net; namespace OpenSim.Region.Framework.Scenes @@ -212,6 +214,76 @@ namespace OpenSim.Region.Framework.Scenes sr.Close(); } + // ITerrainChannel.Merge + public void Merge(ITerrainChannel newTerrain, Vector3 displacement, float radianRotation, Vector2 rotationDisplacement) + { + for (int xx = 0; xx < newTerrain.Width; xx++) + { + for (int yy = 0; yy < newTerrain.Height; yy++) + { + int dispX = (int)displacement.X; + int dispY = (int)displacement.Y; + float newHeight = (float)newTerrain[xx, yy] + displacement.Z; + if (radianRotation == 0) + { + // If no rotation, place the new height in the specified location + dispX += xx; + dispY += yy; + if (dispX >= 0 && dispX < m_terrainData.SizeX && dispY >= 0 && dispY < m_terrainData.SizeY) + { + m_terrainData[dispX, dispY] = newHeight; + } + } + else + { + // If rotating, we have to smooth the result because the conversion + // to ints will mean heightmap entries will not get changed + // First compute the rotation location for the new height. + dispX += (int)(rotationDisplacement.X + + ((float)xx - rotationDisplacement.X) * Math.Cos(radianRotation) + - ((float)yy - rotationDisplacement.Y) * Math.Sin(radianRotation) ); + + dispY += (int)(rotationDisplacement.Y + + ((float)xx - rotationDisplacement.X) * Math.Sin(radianRotation) + + ((float)yy - rotationDisplacement.Y) * Math.Cos(radianRotation) ); + + if (dispX >= 0 && dispX < m_terrainData.SizeX && dispY >= 0 && dispY < m_terrainData.SizeY) + { + float oldHeight = m_terrainData[dispX, dispY]; + // Smooth the heights around this location if the old height is far from this one + for (int sxx = dispX - 2; sxx < dispX + 2; sxx++) + { + for (int syy = dispY - 2; syy < dispY + 2; syy++) + { + if (sxx >= 0 && sxx < m_terrainData.SizeX && syy >= 0 && syy < m_terrainData.SizeY) + { + if (sxx == dispX && syy == dispY) + { + // Set height for the exact rotated point + m_terrainData[dispX, dispY] = newHeight; + } + else + { + if (Math.Abs(m_terrainData[sxx, syy] - newHeight) > 1f) + { + // If the adjacent height is far off, force it to this height + m_terrainData[sxx, syy] = newHeight; + } + } + } + } + } + } + + if (dispX >= 0 && dispX < m_terrainData.SizeX && dispY >= 0 && dispY < m_terrainData.SizeY) + { + m_terrainData[dispX, dispY] = (float)newTerrain[xx, yy]; + } + } + } + } + } + #endregion public TerrainChannel Copy() -- cgit v1.1 From 2a4dd34616bdb0641f841766dfd15c4c784d3549 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 2 Feb 2014 12:21:18 -0800 Subject: Change new 'load oar' parameters to be hyphenated to be consistant with existing parameters. ('--forceterrain' becomes '--force-terrain'). The old forms have been kept for downward compatiblity. --- OpenSim/Region/Application/OpenSim.cs | 16 ++++++++-------- .../CoreModules/World/Archiver/ArchiveReadRequest.cs | 6 +++--- .../Region/CoreModules/World/Archiver/ArchiverModule.cs | 14 +++++++------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 1e36853..a609b77 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -267,18 +267,18 @@ namespace OpenSim m_console.Commands.AddCommand("Archiving", false, "load oar", "load oar [--merge] [--skip-assets]" - + " [--forceterrain] [--forceparcels]" - + " [--rotation degrees] [--rotationCenter \"\"]" + + " [--force-terrain] [--force-parcels]" + + " [--rotation degrees] [--rotation-center \"\"]" + " [--displacement \"\"]" + " []", "Load a region's data from an OAR archive.", "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading)." + Environment.NewLine - + "--skip-assets will load the OAR but ignore the assets it contains." + Environment.NewLine - + "--displacement will add this value to the position of every object loaded" + Environment.NewLine - + "--forceterrain forces the loading of terrain from the oar (undoes suppression done by --merge)" + Environment.NewLine - + "--forceparcels forces the loading of parcels from the oar (undoes suppression done by --merge)" + Environment.NewLine - + "--rotation specified rotation to be applied to the oar. Specified in degrees." + Environment.NewLine - + "--rotationcenter Location (relative to original OAR) to apply rotation. Default is <128,128,0>" + Environment.NewLine + + "--skip-assets will load the OAR but ignore the assets it contains." + Environment.NewLine + + "--displacement will add this value to the position of every object loaded" + Environment.NewLine + + "--force-terrain forces the loading of terrain from the oar (undoes suppression done by --merge)" + Environment.NewLine + + "--force-parcels forces the loading of parcels from the oar (undoes suppression done by --merge)" + Environment.NewLine + + "--rotation specified rotation to be applied to the oar. Specified in degrees." + Environment.NewLine + + "--rotation-center Location (relative to original OAR) to apply rotation. Default is <128,128,0>" + Environment.NewLine + "The path can be either a filesystem location or a URI." + " If this is not given then the command looks for an OAR named region.oar in the current directory.", LoadOar); diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 6f68966..23008a0 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -177,13 +177,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_errorMessage = String.Empty; m_merge = options.ContainsKey("merge"); - m_forceTerrain = options.ContainsKey("forceTerrain"); - m_forceParcels = options.ContainsKey("forceParcels"); + m_forceTerrain = options.ContainsKey("force-terrain"); + m_forceParcels = options.ContainsKey("force-parcels"); m_skipAssets = options.ContainsKey("skipAssets"); m_requestId = requestId; m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero; m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f; - m_rotationCenter = options.ContainsKey("rotationCenter") ? (Vector3)options["rotationCenter"] + m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"] : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f); // Zero can never be a valid user id diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 6fbac4c..9fa1fbd 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -113,8 +113,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver OptionSet options = new OptionSet(); options.Add("m|merge", delegate (string v) { mergeOar = (v != null); }); options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); }); - options.Add("forceterrain", delegate (string v) { forceTerrain = (v != null); }); - options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); + options.Add("force-terrain", delegate (string v) { forceTerrain = (v != null); }); + options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); }); options.Add("displacement=", delegate (string v) { try { @@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver // Convert to radians for internals rotation = Util.Clamp(rotation, -359f, 359f) / 180f * (float)Math.PI; }); - options.Add("rotationcenter=", delegate (string v) { + options.Add("rotation-center=", delegate (string v) { try { rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v); @@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver catch { m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing rotation displacement"); - m_log.ErrorFormat("[ARCHIVER MODULE] Must be represented as vector3: --rotationcenter \"<128,128,0>\""); + m_log.ErrorFormat("[ARCHIVER MODULE] Must be represented as vector3: --rotation-center \"<128,128,0>\""); return; } }); @@ -174,11 +174,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver Dictionary archiveOptions = new Dictionary(); if (mergeOar) archiveOptions.Add("merge", null); if (skipAssets) archiveOptions.Add("skipAssets", null); - if (forceTerrain) archiveOptions.Add("forceTerrain", null); - if (forceParcels) archiveOptions.Add("forceParcels", null); + if (forceTerrain) archiveOptions.Add("force-terrain", null); + if (forceParcels) archiveOptions.Add("force-parcels", null); archiveOptions.Add("displacement", displacement); archiveOptions.Add("rotation", rotation); - archiveOptions.Add("rotationCenter", rotationCenter); + archiveOptions.Add("rotation-center", rotationCenter); if (mainParams.Count > 2) { -- cgit v1.1 From 8c6a0cb44abc74203350bafdd192a8520b9acf56 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 2 Feb 2014 17:18:08 -0800 Subject: Really add the old parameter names to load oar to keep downward compatibiliy --- OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 9fa1fbd..a89fe1c 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -114,7 +114,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver options.Add("m|merge", delegate (string v) { mergeOar = (v != null); }); options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); }); options.Add("force-terrain", delegate (string v) { forceTerrain = (v != null); }); + options.Add("forceterrain", delegate (string v) { forceTerrain = (v != null); }); // downward compatibility options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); }); + options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility options.Add("displacement=", delegate (string v) { try { -- cgit v1.1 From 41b6602a775fb0a2a36d60c554364ff8e5efdbce Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 2 Feb 2014 22:16:01 -0800 Subject: Add "--no-objects" parameter to 'load oar'. --- OpenSim/Region/Application/OpenSim.cs | 2 ++ OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 5 ++++- OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index a609b77..77b9440 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -268,6 +268,7 @@ namespace OpenSim m_console.Commands.AddCommand("Archiving", false, "load oar", "load oar [--merge] [--skip-assets]" + " [--force-terrain] [--force-parcels]" + + " [--no-objects]" + " [--rotation degrees] [--rotation-center \"\"]" + " [--displacement \"\"]" + " []", @@ -279,6 +280,7 @@ namespace OpenSim + "--force-parcels forces the loading of parcels from the oar (undoes suppression done by --merge)" + Environment.NewLine + "--rotation specified rotation to be applied to the oar. Specified in degrees." + Environment.NewLine + "--rotation-center Location (relative to original OAR) to apply rotation. Default is <128,128,0>" + Environment.NewLine + + "--no-objects suppresses the addition of any objects (good for loading only the terrain)" + Environment.NewLine + "The path can be either a filesystem location or a URI." + " If this is not given then the command looks for an OAR named region.oar in the current directory.", LoadOar); diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 23008a0..0c4b79b 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -130,6 +130,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// protected Vector3 m_rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0f); + protected bool m_noObjects = false; + /// /// Used to cache lookups for valid uuids. /// @@ -179,6 +181,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_merge = options.ContainsKey("merge"); m_forceTerrain = options.ContainsKey("force-terrain"); m_forceParcels = options.ContainsKey("force-parcels"); + m_noObjects = options.ContainsKey("no-objects"); m_skipAssets = options.ContainsKey("skipAssets"); m_requestId = requestId; m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero; @@ -261,7 +264,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver // Process the file - if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) + if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH) && !m_noObjects) { sceneContext.SerialisedSceneObjects.Add(Encoding.UTF8.GetString(data)); } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index a89fe1c..2b2da6f 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -106,6 +106,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver bool skipAssets = false; bool forceTerrain = false; bool forceParcels = false; + bool noObjects = false; Vector3 displacement = new Vector3(0f, 0f, 0f); float rotation = 0f; Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); @@ -117,6 +118,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver options.Add("forceterrain", delegate (string v) { forceTerrain = (v != null); }); // downward compatibility options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); }); options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility + options.Add("no-objects", delegate (string v) { noObjects = (v != null); }); options.Add("displacement=", delegate (string v) { try { @@ -178,6 +180,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (skipAssets) archiveOptions.Add("skipAssets", null); if (forceTerrain) archiveOptions.Add("force-terrain", null); if (forceParcels) archiveOptions.Add("force-parcels", null); + if (noObjects) archiveOptions.Add("no-objects", null); archiveOptions.Add("displacement", displacement); archiveOptions.Add("rotation", rotation); archiveOptions.Add("rotation-center", rotationCenter); -- cgit v1.1