From 2b60a5c5d64f38caf243119105416c1101c6eb6c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 May 2012 02:45:17 +0100 Subject: Add is_megaregion flag into oar control file. Not currently read - for future use. Please do not rely on this remaining here. An adaptation of part of Garmin's patch from http://opensimulator.org/mantis/view.php?id=5975, thanks! Flag only written if the SW corner OAR is saved - this is the only one that captures object data presently (though not land or terrain data). This adds an IRegionCombinerModule interface and the necessary methods on RegionCombinerModule --- .../RegionCombinerModule/RegionCombinerModule.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index a142f26..37b3037 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -43,9 +43,8 @@ using Mono.Addins; [assembly: AddinDependency("OpenSim", "0.5")] namespace OpenSim.Region.RegionCombinerModule { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class RegionCombinerModule : ISharedRegionModule + public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -59,6 +58,15 @@ namespace OpenSim.Region.RegionCombinerModule get { return null; } } + public bool IsMegaregion + { + get + { + lock (m_startingScenes) + return m_startingScenes.Count > 1; + } + } + private Dictionary m_regions = new Dictionary(); private bool enabledYN = false; private Dictionary m_startingScenes = new Dictionary(); @@ -69,9 +77,11 @@ namespace OpenSim.Region.RegionCombinerModule enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false); if (enabledYN) + { MainConsole.Instance.Commands.AddCommand( "RegionCombinerModule", false, "fix-phantoms", "fix-phantoms", "Fixes phantom objects after an import to megaregions", FixPhantoms); + } } public void Close() @@ -80,6 +90,8 @@ namespace OpenSim.Region.RegionCombinerModule public void AddRegion(Scene scene) { + if (enabledYN) + scene.RegisterModuleInterface(this); } public void RemoveRegion(Scene scene) @@ -96,6 +108,12 @@ namespace OpenSim.Region.RegionCombinerModule } } + public bool IsRootRegion(UUID sceneId) + { + lock (m_regions) + return m_regions.ContainsKey(sceneId); + } + private void NewPresence(ScenePresence presence) { if (presence.IsChildAgent) -- cgit v1.1 From 26dfcf5395474041e6719da20d7ecb847dd0ee38 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 May 2012 03:07:24 +0100 Subject: Add some method doc to RegionCombinerModule. Clean up log messages. --- .../RegionCombinerModule/RegionCombinerModule.cs | 39 ++++++++++++++++------ 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 37b3037..3af5cc2 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -67,8 +67,22 @@ namespace OpenSim.Region.RegionCombinerModule } } + /// + /// This holds the root regions for the megaregions. + /// + /// + /// At this point we can actually assume there is only ever one megaregion (and hence only one entry here). + /// private Dictionary m_regions = new Dictionary(); + + /// + /// Is this module enabled? + /// private bool enabledYN = false; + + /// + /// The scenes that comprise the megaregion. + /// private Dictionary m_startingScenes = new Dictionary(); public void Initialise(IConfigSource source) @@ -448,9 +462,9 @@ namespace OpenSim.Region.RegionCombinerModule if (!connectedYN) { DoWorkForRootRegion(regionConnections, scene); - } } + // Set up infinite borders around the entire AABB of the combined ConnectedRegions AdjustLargeRegionBounds(); } @@ -469,9 +483,10 @@ namespace OpenSim.Region.RegionCombinerModule conn.UpdateExtents(extents); - m_log.DebugFormat("Scene: {0} to the west of Scene{1} Offset: {2}. Extents:{3}", - conn.RegionScene.RegionInfo.RegionName, - regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); + m_log.DebugFormat( + "[REGION COMBINER MODULE]: Scene {0} to the west of Scene {1}, Offset: {2}, Extents: {3}", + conn.RegionScene.RegionInfo.RegionName, + regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); scene.BordersLocked = true; conn.RegionScene.BordersLocked = true; @@ -547,9 +562,10 @@ namespace OpenSim.Region.RegionCombinerModule ConnectedRegion.RegionScene = scene; conn.ConnectedRegions.Add(ConnectedRegion); - m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", - conn.RegionScene.RegionInfo.RegionName, - regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); + m_log.DebugFormat( + "[REGION COMBINER MODULE]: Scene: {0} to the northeast of Scene {1}, Offset: {2}, Extents: {3}", + conn.RegionScene.RegionInfo.RegionName, + regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); @@ -602,9 +618,10 @@ namespace OpenSim.Region.RegionCombinerModule conn.ConnectedRegions.Add(ConnectedRegion); - m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}", - conn.RegionScene.RegionInfo.RegionName, - regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); + m_log.DebugFormat( + "[REGION COMBINER MODULE]: Scene: {0} to the NorthEast of Scene {1}, Offset: {2}, Extents: {3}", + conn.RegionScene.RegionInfo.RegionName, + regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); @@ -681,6 +698,8 @@ namespace OpenSim.Region.RegionCombinerModule private void DoWorkForRootRegion(RegionConnections regionConnections, Scene scene) { + m_log.DebugFormat("[REGION COMBINER MODULE]: Adding root region {0}", scene.RegionInfo.RegionName); + RegionData rdata = new RegionData(); rdata.Offset = Vector3.Zero; rdata.RegionId = scene.RegionInfo.originRegionID; -- cgit v1.1 From 3f2a727b6d6b0cf6c2e2c7ef11ebd0f3f1fefa83 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 May 2012 03:17:21 +0100 Subject: Remove recent IRegionCombinerModule.IsMegaregion(). In theory, there can be more than one megaregion in a simulator, separated by water. Rename IsRootRegion() to IsRootForMegaregion() --- OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 3af5cc2..fadc30d 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -58,20 +58,11 @@ namespace OpenSim.Region.RegionCombinerModule get { return null; } } - public bool IsMegaregion - { - get - { - lock (m_startingScenes) - return m_startingScenes.Count > 1; - } - } - /// /// This holds the root regions for the megaregions. /// /// - /// At this point we can actually assume there is only ever one megaregion (and hence only one entry here). + /// Usually there is only ever one megaregion (and hence only one entry here). /// private Dictionary m_regions = new Dictionary(); @@ -122,7 +113,7 @@ namespace OpenSim.Region.RegionCombinerModule } } - public bool IsRootRegion(UUID sceneId) + public bool IsRootForMegaregion(UUID sceneId) { lock (m_regions) return m_regions.ContainsKey(sceneId); -- cgit v1.1 From 4e5ac27928f0bdcb5bd7c772dbdcdd049d6ab4c4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 May 2012 03:45:58 +0100 Subject: Make the megaregion total area given to the physics module accurate instead of over-inflated. This was previously over-inflated because adding a region to the NE of the root region resulted in double counting of regions already added. An accurate extent will also be necessary for other purposes. --- OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index fadc30d..a2050b2 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -595,9 +595,15 @@ namespace OpenSim.Region.RegionCombinerModule ((conn.Y * (int)Constants.RegionSize))); Vector3 extents = Vector3.Zero; - extents.Y = regionConnections.YEnd + conn.YEnd; - extents.X = regionConnections.XEnd + conn.XEnd; - conn.UpdateExtents(extents); + + // We do not want to inflate the extents for regions strictly to the NE of the root region, since this + // would double count regions strictly to the north and east that have already been added. +// extents.Y = regionConnections.YEnd + conn.YEnd; +// extents.X = regionConnections.XEnd + conn.XEnd; +// conn.UpdateExtents(extents); + + extents.Y = conn.YEnd; + extents.X = conn.XEnd; scene.BordersLocked = true; conn.RegionScene.BordersLocked = true; -- cgit v1.1 From d7f90dee1ce0bd84200f327ce3f62697c876ef5b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 May 2012 03:56:25 +0100 Subject: Correct some log messages in RegionCombinerModule about the position of the root region of a megaregion relative to an added region --- OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index a2050b2..95db22b 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -229,8 +229,6 @@ namespace OpenSim.Region.RegionCombinerModule westBorder.CrossDirection = Cardinals.W; scene.WestBorders[0] = westBorder; - - RegionConnections regionConnections = new RegionConnections(); regionConnections.ConnectedRegions = new List(); regionConnections.RegionScene = scene; @@ -475,7 +473,7 @@ namespace OpenSim.Region.RegionCombinerModule conn.UpdateExtents(extents); m_log.DebugFormat( - "[REGION COMBINER MODULE]: Scene {0} to the west of Scene {1}, Offset: {2}, Extents: {3}", + "[REGION COMBINER MODULE]: Root region {0} is to the west of region {1}, Offset: {2}, Extents: {3}", conn.RegionScene.RegionInfo.RegionName, regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); @@ -554,7 +552,7 @@ namespace OpenSim.Region.RegionCombinerModule conn.ConnectedRegions.Add(ConnectedRegion); m_log.DebugFormat( - "[REGION COMBINER MODULE]: Scene: {0} to the northeast of Scene {1}, Offset: {2}, Extents: {3}", + "[REGION COMBINER MODULE]: Root region {0} is to the south of region {1}, Offset: {2}, Extents: {3}", conn.RegionScene.RegionInfo.RegionName, regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); @@ -616,7 +614,7 @@ namespace OpenSim.Region.RegionCombinerModule conn.ConnectedRegions.Add(ConnectedRegion); m_log.DebugFormat( - "[REGION COMBINER MODULE]: Scene: {0} to the NorthEast of Scene {1}, Offset: {2}, Extents: {3}", + "[REGION COMBINER MODULE]: Region {0} is to the southwest of Scene {1}, Offset: {2}, Extents: {3}", conn.RegionScene.RegionInfo.RegionName, regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); -- cgit v1.1 From fb8705dd4de2dc28b283b105f21c56e2ca9d89ff Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 May 2012 04:01:05 +0100 Subject: refactor: Rename connection paramaters from "conn" and "regionConnections" so that it's easy to tell whether they refer to the root region connection or a new region connection --- .../RegionCombinerModule/RegionCombinerModule.cs | 260 +++++++++++---------- 1 file changed, 133 insertions(+), 127 deletions(-) (limited to 'OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 95db22b..b3750ca 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -229,22 +229,21 @@ namespace OpenSim.Region.RegionCombinerModule westBorder.CrossDirection = Cardinals.W; scene.WestBorders[0] = westBorder; - RegionConnections regionConnections = new RegionConnections(); - regionConnections.ConnectedRegions = new List(); - regionConnections.RegionScene = scene; - regionConnections.RegionLandChannel = scene.LandChannel; - regionConnections.RegionId = scene.RegionInfo.originRegionID; - regionConnections.X = scene.RegionInfo.RegionLocX; - regionConnections.Y = scene.RegionInfo.RegionLocY; - regionConnections.XEnd = (int)Constants.RegionSize; - regionConnections.YEnd = (int)Constants.RegionSize; - + RegionConnections newConn = new RegionConnections(); + newConn.ConnectedRegions = new List(); + newConn.RegionScene = scene; + newConn.RegionLandChannel = scene.LandChannel; + newConn.RegionId = scene.RegionInfo.originRegionID; + newConn.X = scene.RegionInfo.RegionLocX; + newConn.Y = scene.RegionInfo.RegionLocY; + newConn.XEnd = (int)Constants.RegionSize; + newConn.YEnd = (int)Constants.RegionSize; lock (m_regions) { bool connectedYN = false; - foreach (RegionConnections conn in m_regions.Values) + foreach (RegionConnections rootConn in m_regions.Values) { #region commented /* @@ -410,12 +409,12 @@ namespace OpenSim.Region.RegionCombinerModule //xxx - if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd - >= (regionConnections.X * (int)Constants.RegionSize)) - && (((int)conn.Y * (int)Constants.RegionSize) - >= (regionConnections.Y * (int)Constants.RegionSize))) + if ((((int)rootConn.X * (int)Constants.RegionSize) + rootConn.XEnd + >= (newConn.X * (int)Constants.RegionSize)) + && (((int)rootConn.Y * (int)Constants.RegionSize) + >= (newConn.Y * (int)Constants.RegionSize))) { - connectedYN = DoWorkForOneRegionOverPlusXY(conn, regionConnections, scene); + connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene); break; } @@ -423,12 +422,12 @@ namespace OpenSim.Region.RegionCombinerModule //xyx //xxx //xxx - if ((((int)conn.X * (int)Constants.RegionSize) - >= (regionConnections.X * (int)Constants.RegionSize)) - && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd - >= (regionConnections.Y * (int)Constants.RegionSize))) + if ((((int)rootConn.X * (int)Constants.RegionSize) + >= (newConn.X * (int)Constants.RegionSize)) + && (((int)rootConn.Y * (int)Constants.RegionSize) + rootConn.YEnd + >= (newConn.Y * (int)Constants.RegionSize))) { - connectedYN = DoWorkForOneRegionOverXPlusY(conn, regionConnections, scene); + connectedYN = DoWorkForOneRegionOverXPlusY(rootConn, newConn, scene); break; } @@ -436,12 +435,12 @@ namespace OpenSim.Region.RegionCombinerModule //xxy //xxx //xxx - if ((((int)conn.X * (int)Constants.RegionSize) + conn.XEnd - >= (regionConnections.X * (int)Constants.RegionSize)) - && (((int)conn.Y * (int)Constants.RegionSize) + conn.YEnd - >= (regionConnections.Y * (int)Constants.RegionSize))) + if ((((int)rootConn.X * (int)Constants.RegionSize) + rootConn.XEnd + >= (newConn.X * (int)Constants.RegionSize)) + && (((int)rootConn.Y * (int)Constants.RegionSize) + rootConn.YEnd + >= (newConn.Y * (int)Constants.RegionSize))) { - connectedYN = DoWorkForOneRegionOverPlusXPlusY(conn, regionConnections, scene); + connectedYN = DoWorkForOneRegionOverPlusXPlusY(rootConn, newConn, scene); break; } @@ -450,7 +449,7 @@ namespace OpenSim.Region.RegionCombinerModule // If !connectYN means that this region is a root region if (!connectedYN) { - DoWorkForRootRegion(regionConnections, scene); + DoWorkForRootRegion(newConn, scene); } } @@ -458,59 +457,57 @@ namespace OpenSim.Region.RegionCombinerModule AdjustLargeRegionBounds(); } - private bool DoWorkForOneRegionOverPlusXY(RegionConnections conn, RegionConnections regionConnections, Scene scene) + private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene) { Vector3 offset = Vector3.Zero; - offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - - ((conn.X * (int)Constants.RegionSize))); - offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - - ((conn.Y * (int)Constants.RegionSize))); + offset.X = (((newConn.X * (int)Constants.RegionSize)) - + ((rootConn.X * (int)Constants.RegionSize))); + offset.Y = (((newConn.Y * (int)Constants.RegionSize)) - + ((rootConn.Y * (int)Constants.RegionSize))); Vector3 extents = Vector3.Zero; - extents.Y = conn.YEnd; - extents.X = conn.XEnd + regionConnections.XEnd; + extents.Y = rootConn.YEnd; + extents.X = rootConn.XEnd + newConn.XEnd; - conn.UpdateExtents(extents); + rootConn.UpdateExtents(extents); m_log.DebugFormat( "[REGION COMBINER MODULE]: Root region {0} is to the west of region {1}, Offset: {2}, Extents: {3}", - conn.RegionScene.RegionInfo.RegionName, - regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); + rootConn.RegionScene.RegionInfo.RegionName, + newConn.RegionScene.RegionInfo.RegionName, offset, extents); scene.BordersLocked = true; - conn.RegionScene.BordersLocked = true; + rootConn.RegionScene.BordersLocked = true; RegionData ConnectedRegion = new RegionData(); ConnectedRegion.Offset = offset; ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; ConnectedRegion.RegionScene = scene; - conn.ConnectedRegions.Add(ConnectedRegion); + rootConn.ConnectedRegions.Add(ConnectedRegion); // Inform root region Physics about the extents of this region - conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); + rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); // Inform Child region that it needs to forward it's terrain to the root region - scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); + scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); // Extend the borders as appropriate - lock (conn.RegionScene.EastBorders) - conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; + lock (rootConn.RegionScene.EastBorders) + rootConn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; - lock (conn.RegionScene.NorthBorders) - conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; + lock (rootConn.RegionScene.NorthBorders) + rootConn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; - lock (conn.RegionScene.SouthBorders) - conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; + lock (rootConn.RegionScene.SouthBorders) + rootConn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; lock (scene.WestBorders) { - - - scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West + scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - rootConn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West // Trigger auto teleport to root region - scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX; - scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY; + scene.WestBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX; + scene.WestBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY; } // Reset Terrain.. since terrain loads before we get here, we need to load @@ -519,57 +516,60 @@ namespace OpenSim.Region.RegionCombinerModule scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); // Unlock borders - conn.RegionScene.BordersLocked = false; + rootConn.RegionScene.BordersLocked = false; scene.BordersLocked = false; // Create a client event forwarder and add this region's events to the root region. - if (conn.ClientEventForwarder != null) - conn.ClientEventForwarder.AddSceneToEventForwarding(scene); + if (rootConn.ClientEventForwarder != null) + rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); return true; } - private bool DoWorkForOneRegionOverXPlusY(RegionConnections conn, RegionConnections regionConnections, Scene scene) + private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene) { Vector3 offset = Vector3.Zero; - offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - - ((conn.X * (int)Constants.RegionSize))); - offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - - ((conn.Y * (int)Constants.RegionSize))); + offset.X = (((newConn.X * (int)Constants.RegionSize)) - + ((rootConn.X * (int)Constants.RegionSize))); + offset.Y = (((newConn.Y * (int)Constants.RegionSize)) - + ((rootConn.Y * (int)Constants.RegionSize))); Vector3 extents = Vector3.Zero; - extents.Y = regionConnections.YEnd + conn.YEnd; - extents.X = conn.XEnd; - conn.UpdateExtents(extents); + extents.Y = newConn.YEnd + rootConn.YEnd; + extents.X = rootConn.XEnd; + rootConn.UpdateExtents(extents); scene.BordersLocked = true; - conn.RegionScene.BordersLocked = true; + rootConn.RegionScene.BordersLocked = true; RegionData ConnectedRegion = new RegionData(); ConnectedRegion.Offset = offset; ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; ConnectedRegion.RegionScene = scene; - conn.ConnectedRegions.Add(ConnectedRegion); + rootConn.ConnectedRegions.Add(ConnectedRegion); m_log.DebugFormat( "[REGION COMBINER MODULE]: Root region {0} is to the south of region {1}, Offset: {2}, Extents: {3}", - conn.RegionScene.RegionInfo.RegionName, - regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); - - conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); - scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); - - lock (conn.RegionScene.NorthBorders) - conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; - lock (conn.RegionScene.EastBorders) - conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; - lock (conn.RegionScene.WestBorders) - conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; + rootConn.RegionScene.RegionInfo.RegionName, + newConn.RegionScene.RegionInfo.RegionName, offset, extents); + + rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); + scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); + + lock (rootConn.RegionScene.NorthBorders) + rootConn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; + + lock (rootConn.RegionScene.EastBorders) + rootConn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; + + lock (rootConn.RegionScene.WestBorders) + rootConn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; + lock (scene.SouthBorders) { - scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south - scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX; - scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY; + scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - rootConn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south + scene.SouthBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX; + scene.SouthBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY; } // Reset Terrain.. since terrain normally loads first. @@ -578,19 +578,21 @@ namespace OpenSim.Region.RegionCombinerModule //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); scene.BordersLocked = false; - conn.RegionScene.BordersLocked = false; - if (conn.ClientEventForwarder != null) - conn.ClientEventForwarder.AddSceneToEventForwarding(scene); + rootConn.RegionScene.BordersLocked = false; + + if (rootConn.ClientEventForwarder != null) + rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); + return true; } - private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections conn, RegionConnections regionConnections, Scene scene) + private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene) { Vector3 offset = Vector3.Zero; - offset.X = (((regionConnections.X * (int)Constants.RegionSize)) - - ((conn.X * (int)Constants.RegionSize))); - offset.Y = (((regionConnections.Y * (int)Constants.RegionSize)) - - ((conn.Y * (int)Constants.RegionSize))); + offset.X = (((newConn.X * (int)Constants.RegionSize)) - + ((rootConn.X * (int)Constants.RegionSize))); + offset.Y = (((newConn.Y * (int)Constants.RegionSize)) - + ((rootConn.Y * (int)Constants.RegionSize))); Vector3 extents = Vector3.Zero; @@ -600,68 +602,70 @@ namespace OpenSim.Region.RegionCombinerModule // extents.X = regionConnections.XEnd + conn.XEnd; // conn.UpdateExtents(extents); - extents.Y = conn.YEnd; - extents.X = conn.XEnd; + extents.Y = rootConn.YEnd; + extents.X = rootConn.XEnd; scene.BordersLocked = true; - conn.RegionScene.BordersLocked = true; + rootConn.RegionScene.BordersLocked = true; RegionData ConnectedRegion = new RegionData(); ConnectedRegion.Offset = offset; ConnectedRegion.RegionId = scene.RegionInfo.originRegionID; ConnectedRegion.RegionScene = scene; - conn.ConnectedRegions.Add(ConnectedRegion); + rootConn.ConnectedRegions.Add(ConnectedRegion); m_log.DebugFormat( "[REGION COMBINER MODULE]: Region {0} is to the southwest of Scene {1}, Offset: {2}, Extents: {3}", - conn.RegionScene.RegionInfo.RegionName, - regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); + rootConn.RegionScene.RegionInfo.RegionName, + newConn.RegionScene.RegionInfo.RegionName, offset, extents); - conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); - scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); - lock (conn.RegionScene.NorthBorders) + rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); + scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); + + lock (rootConn.RegionScene.NorthBorders) { - if (conn.RegionScene.NorthBorders.Count == 1)// && 2) + if (rootConn.RegionScene.NorthBorders.Count == 1)// && 2) { //compound border // already locked above - conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; + rootConn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; + + lock (rootConn.RegionScene.EastBorders) + rootConn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; - lock (conn.RegionScene.EastBorders) - conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; - lock (conn.RegionScene.WestBorders) - conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; + lock (rootConn.RegionScene.WestBorders) + rootConn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; } } lock (scene.SouthBorders) { - scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - conn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south - scene.SouthBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX; - scene.SouthBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY; + scene.SouthBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocY - rootConn.RegionScene.RegionInfo.RegionLocY) * (int)Constants.RegionSize); //auto teleport south + scene.SouthBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX; + scene.SouthBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY; } - lock (conn.RegionScene.EastBorders) + lock (rootConn.RegionScene.EastBorders) { - if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) + if (rootConn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) { - conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; - lock (conn.RegionScene.NorthBorders) - conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; - lock (conn.RegionScene.SouthBorders) - conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; + rootConn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; + lock (rootConn.RegionScene.NorthBorders) + rootConn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; + lock (rootConn.RegionScene.SouthBorders) + rootConn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; } } lock (scene.WestBorders) { - scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - conn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West - scene.WestBorders[0].TriggerRegionX = conn.RegionScene.RegionInfo.RegionLocX; - scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY; + scene.WestBorders[0].BorderLine.Z = (int)((scene.RegionInfo.RegionLocX - rootConn.RegionScene.RegionInfo.RegionLocX) * (int)Constants.RegionSize); //auto teleport West + scene.WestBorders[0].TriggerRegionX = rootConn.RegionScene.RegionInfo.RegionLocX; + scene.WestBorders[0].TriggerRegionY = rootConn.RegionScene.RegionInfo.RegionLocY; } /* @@ -680,18 +684,17 @@ namespace OpenSim.Region.RegionCombinerModule scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); scene.BordersLocked = false; - conn.RegionScene.BordersLocked = false; + rootConn.RegionScene.BordersLocked = false; - if (conn.ClientEventForwarder != null) - conn.ClientEventForwarder.AddSceneToEventForwarding(scene); + if (rootConn.ClientEventForwarder != null) + rootConn.ClientEventForwarder.AddSceneToEventForwarding(scene); return true; //scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset,extents); - } - private void DoWorkForRootRegion(RegionConnections regionConnections, Scene scene) + private void DoWorkForRootRegion(RegionConnections rootConn, Scene scene) { m_log.DebugFormat("[REGION COMBINER MODULE]: Adding root region {0}", scene.RegionInfo.RegionName); @@ -700,28 +703,31 @@ namespace OpenSim.Region.RegionCombinerModule rdata.RegionId = scene.RegionInfo.originRegionID; rdata.RegionScene = scene; // save it's land channel - regionConnections.RegionLandChannel = scene.LandChannel; + rootConn.RegionLandChannel = scene.LandChannel; // Substitue our landchannel RegionCombinerLargeLandChannel lnd = new RegionCombinerLargeLandChannel(rdata, scene.LandChannel, - regionConnections.ConnectedRegions); + rootConn.ConnectedRegions); + scene.LandChannel = lnd; + // Forward the permissions modules of each of the connected regions to the root region lock (m_regions) { - foreach (RegionData r in regionConnections.ConnectedRegions) + foreach (RegionData r in rootConn.ConnectedRegions) { - ForwardPermissionRequests(regionConnections, r.RegionScene); + ForwardPermissionRequests(rootConn, r.RegionScene); } } + // Create the root region's Client Event Forwarder - regionConnections.ClientEventForwarder = new RegionCombinerClientEventForwarder(regionConnections); + rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn); // Sets up the CoarseLocationUpdate forwarder for this root region scene.EventManager.OnNewPresence += SetCourseLocationDelegate; // Adds this root region to a dictionary of regions that are connectable - m_regions.Add(scene.RegionInfo.originRegionID, regionConnections); + m_regions.Add(scene.RegionInfo.originRegionID, rootConn); } private void SetCourseLocationDelegate(ScenePresence presence) -- cgit v1.1 From 824a3a114b1142325f523e2039ed070cce9ea850 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 May 2012 04:22:30 +0100 Subject: refactor: Add RegionConnection.PosX and PosY to return position in meters rather than copy/pasting the necessary calculations in lots of places. --- .../RegionCombinerModule/RegionCombinerModule.cs | 36 ++++++---------------- 1 file changed, 10 insertions(+), 26 deletions(-) (limited to 'OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index b3750ca..81ed339 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -408,11 +408,7 @@ namespace OpenSim.Region.RegionCombinerModule //xxy //xxx - - if ((((int)rootConn.X * (int)Constants.RegionSize) + rootConn.XEnd - >= (newConn.X * (int)Constants.RegionSize)) - && (((int)rootConn.Y * (int)Constants.RegionSize) - >= (newConn.Y * (int)Constants.RegionSize))) + if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY >= newConn.PosY) { connectedYN = DoWorkForOneRegionOverPlusXY(rootConn, newConn, scene); break; @@ -422,10 +418,7 @@ namespace OpenSim.Region.RegionCombinerModule //xyx //xxx //xxx - if ((((int)rootConn.X * (int)Constants.RegionSize) - >= (newConn.X * (int)Constants.RegionSize)) - && (((int)rootConn.Y * (int)Constants.RegionSize) + rootConn.YEnd - >= (newConn.Y * (int)Constants.RegionSize))) + if (rootConn.PosX >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY) { connectedYN = DoWorkForOneRegionOverXPlusY(rootConn, newConn, scene); break; @@ -435,10 +428,7 @@ namespace OpenSim.Region.RegionCombinerModule //xxy //xxx //xxx - if ((((int)rootConn.X * (int)Constants.RegionSize) + rootConn.XEnd - >= (newConn.X * (int)Constants.RegionSize)) - && (((int)rootConn.Y * (int)Constants.RegionSize) + rootConn.YEnd - >= (newConn.Y * (int)Constants.RegionSize))) + if (rootConn.PosX + rootConn.XEnd >= newConn.PosX && rootConn.PosY + rootConn.YEnd >= newConn.PosY) { connectedYN = DoWorkForOneRegionOverPlusXPlusY(rootConn, newConn, scene); break; @@ -460,10 +450,8 @@ namespace OpenSim.Region.RegionCombinerModule private bool DoWorkForOneRegionOverPlusXY(RegionConnections rootConn, RegionConnections newConn, Scene scene) { Vector3 offset = Vector3.Zero; - offset.X = (((newConn.X * (int)Constants.RegionSize)) - - ((rootConn.X * (int)Constants.RegionSize))); - offset.Y = (((newConn.Y * (int)Constants.RegionSize)) - - ((rootConn.Y * (int)Constants.RegionSize))); + offset.X = newConn.PosX - rootConn.PosX; + offset.Y = newConn.PosY - rootConn.PosY; Vector3 extents = Vector3.Zero; extents.Y = rootConn.YEnd; @@ -529,10 +517,8 @@ namespace OpenSim.Region.RegionCombinerModule private bool DoWorkForOneRegionOverXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene) { Vector3 offset = Vector3.Zero; - offset.X = (((newConn.X * (int)Constants.RegionSize)) - - ((rootConn.X * (int)Constants.RegionSize))); - offset.Y = (((newConn.Y * (int)Constants.RegionSize)) - - ((rootConn.Y * (int)Constants.RegionSize))); + offset.X = newConn.PosX - rootConn.PosX; + offset.Y = newConn.PosY - rootConn.PosY; Vector3 extents = Vector3.Zero; extents.Y = newConn.YEnd + rootConn.YEnd; @@ -589,10 +575,8 @@ namespace OpenSim.Region.RegionCombinerModule private bool DoWorkForOneRegionOverPlusXPlusY(RegionConnections rootConn, RegionConnections newConn, Scene scene) { Vector3 offset = Vector3.Zero; - offset.X = (((newConn.X * (int)Constants.RegionSize)) - - ((rootConn.X * (int)Constants.RegionSize))); - offset.Y = (((newConn.Y * (int)Constants.RegionSize)) - - ((rootConn.Y * (int)Constants.RegionSize))); + offset.X = newConn.PosX - rootConn.PosX; + offset.Y = newConn.PosY - rootConn.PosY; Vector3 extents = Vector3.Zero; @@ -622,7 +606,7 @@ namespace OpenSim.Region.RegionCombinerModule rootConn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); scene.PhysicsScene.Combine(rootConn.RegionScene.PhysicsScene, offset, Vector3.Zero); - + lock (rootConn.RegionScene.NorthBorders) { if (rootConn.RegionScene.NorthBorders.Count == 1)// && 2) -- cgit v1.1 From 5759313f7f3ff121d20e5eb44013e2bbb4bc2eee Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 May 2012 04:56:47 +0100 Subject: Add size of region to OAR control file. Megaregions (sw root OARs when saved) will have a size larger than 256x256 Not yet read. Do not rely on this information yet, it may change. --- .../RegionCombinerModule/RegionCombinerModule.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 81ed339..98becce 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -113,10 +113,25 @@ namespace OpenSim.Region.RegionCombinerModule } } - public bool IsRootForMegaregion(UUID sceneId) + public bool IsRootForMegaregion(UUID regionId) { lock (m_regions) - return m_regions.ContainsKey(sceneId); + return m_regions.ContainsKey(regionId); + } + + public Vector2 GetSizeOfMegaregion(UUID regionId) + { + lock (m_regions) + { + if (m_regions.ContainsKey(regionId)) + { + RegionConnections rootConn = m_regions[regionId]; + + return new Vector2((float)rootConn.XEnd, (float)rootConn.YEnd); + } + } + + throw new Exception(string.Format("Region with id {0} not found", regionId)); } private void NewPresence(ScenePresence presence) -- cgit v1.1 From 0db60eea85f16b0b428190590b8e8ca1392a2e35 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 May 2012 04:59:36 +0100 Subject: Improve locking of RegionCombinerModule.m_regions --- .../RegionCombinerModule/RegionCombinerModule.cs | 53 ++++++++++++---------- 1 file changed, 29 insertions(+), 24 deletions(-) (limited to 'OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 98becce..40daf13 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -59,6 +59,11 @@ namespace OpenSim.Region.RegionCombinerModule } /// + /// Is this module enabled? + /// + private bool enabledYN = false; + + /// /// This holds the root regions for the megaregions. /// /// @@ -67,11 +72,6 @@ namespace OpenSim.Region.RegionCombinerModule private Dictionary m_regions = new Dictionary(); /// - /// Is this module enabled? - /// - private bool enabledYN = false; - - /// /// The scenes that comprise the megaregion. /// private Dictionary m_startingScenes = new Dictionary(); @@ -717,16 +717,16 @@ namespace OpenSim.Region.RegionCombinerModule { ForwardPermissionRequests(rootConn, r.RegionScene); } - } - - // Create the root region's Client Event Forwarder - rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn); - - // Sets up the CoarseLocationUpdate forwarder for this root region - scene.EventManager.OnNewPresence += SetCourseLocationDelegate; - // Adds this root region to a dictionary of regions that are connectable - m_regions.Add(scene.RegionInfo.originRegionID, rootConn); + // Create the root region's Client Event Forwarder + rootConn.ClientEventForwarder = new RegionCombinerClientEventForwarder(rootConn); + + // Sets up the CoarseLocationUpdate forwarder for this root region + scene.EventManager.OnNewPresence += SetCourseLocationDelegate; + + // Adds this root region to a dictionary of regions that are connectable + m_regions.Add(scene.RegionInfo.originRegionID, rootConn); + } } private void SetCourseLocationDelegate(ScenePresence presence) @@ -983,6 +983,7 @@ namespace OpenSim.Region.RegionCombinerModule return true; } } + oborder = null; return false; } @@ -992,14 +993,19 @@ namespace OpenSim.Region.RegionCombinerModule pPosition = pPosition/(int) Constants.RegionSize; int OffsetX = (int) pPosition.X; int OffsetY = (int) pPosition.Y; - foreach (RegionConnections regConn in m_regions.Values) + + lock (m_regions) { - foreach (RegionData reg in regConn.ConnectedRegions) + foreach (RegionConnections regConn in m_regions.Values) { - if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY) - return reg; + foreach (RegionData reg in regConn.ConnectedRegions) + { + if (reg.Offset.X == OffsetX && reg.Offset.Y == OffsetY) + return reg; + } } } + return new RegionData(); } @@ -1055,18 +1061,17 @@ namespace OpenSim.Region.RegionCombinerModule } #region console commands + public void FixPhantoms(string module, string[] cmdparams) { - List scenes = new List(m_startingScenes.Values); + List scenes = new List(m_startingScenes.Values); + foreach (Scene s in scenes) { - s.ForEachSOG(delegate(SceneObjectGroup e) - { - e.AbsolutePosition = e.AbsolutePosition; - } - ); + s.ForEachSOG(so => so.AbsolutePosition = so.AbsolutePosition); } } + #endregion } } -- cgit v1.1 From 42179578fc5292d9bd12aeccc45948d908c42d1a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Jun 2012 01:33:58 +0100 Subject: Allow fix-phantoms command to appear even if CombineContiguousRegions = false, since this allows one to go back from a megaregion to normal regions. Adapted from a patch by Garmin Kawaguichi in http://opensimulator.org/mantis/view.php?id=6027 Garmin says that fix-phantoms allows one to reset objects when going back from megaregion to normal regions as well as the othe rway around. Thanks! --- .../RegionCombinerModule/RegionCombinerModule.cs | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 40daf13..3555028 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.RegionCombinerModule /// /// Is this module enabled? /// - private bool enabledYN = false; + private bool m_combineContiguousRegions = false; /// /// This holds the root regions for the megaregions. @@ -79,14 +79,12 @@ namespace OpenSim.Region.RegionCombinerModule public void Initialise(IConfigSource source) { IConfig myConfig = source.Configs["Startup"]; - enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false); + m_combineContiguousRegions = myConfig.GetBoolean("CombineContiguousRegions", false); - if (enabledYN) - { - MainConsole.Instance.Commands.AddCommand( - "RegionCombinerModule", false, "fix-phantoms", "fix-phantoms", - "Fixes phantom objects after an import to megaregions", FixPhantoms); - } + MainConsole.Instance.Commands.AddCommand( + "RegionCombinerModule", false, "fix-phantoms", "fix-phantoms", + "Fixes phantom objects after an import to a megaregion or a change from a megaregion back to normal regions", + FixPhantoms); } public void Close() @@ -95,7 +93,7 @@ namespace OpenSim.Region.RegionCombinerModule public void AddRegion(Scene scene) { - if (enabledYN) + if (m_combineContiguousRegions) scene.RegisterModuleInterface(this); } @@ -105,7 +103,10 @@ namespace OpenSim.Region.RegionCombinerModule public void RegionLoaded(Scene scene) { - if (enabledYN) + lock (m_startingScenes) + m_startingScenes.Add(scene.RegionInfo.originRegionID, scene); + + if (m_combineContiguousRegions) { RegionLoadedDoWork(scene); @@ -208,7 +209,6 @@ namespace OpenSim.Region.RegionCombinerModule { return; } - } } @@ -220,8 +220,6 @@ namespace OpenSim.Region.RegionCombinerModule return; // */ - lock (m_startingScenes) - m_startingScenes.Add(scene.RegionInfo.originRegionID, scene); // Give each region a standard set of non-infinite borders Border northBorder = new Border(); -- cgit v1.1 From a5410c2c19bfef9242d9cfcfc1b4fea67f470fd5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 5 Jun 2012 01:37:40 +0100 Subject: minor: Add user feedback when executing fix-phantoms --- OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 3555028..204c4ff 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -1066,6 +1066,8 @@ namespace OpenSim.Region.RegionCombinerModule foreach (Scene s in scenes) { + MainConsole.Instance.OutputFormat("Fixing phantoms for {0}", s.RegionInfo.RegionName); + s.ForEachSOG(so => so.AbsolutePosition = so.AbsolutePosition); } } -- cgit v1.1