From e1a8125b4fadc76baba73712843aee57edd2936f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 9 Sep 2015 17:55:46 +0100 Subject: found core hack to fix modules interdependencies RegionLoaded is not that obvius --- OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs | 9 ++++ OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs | 52 ++++++++++++---------- 2 files changed, 37 insertions(+), 24 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs b/OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs index 7c3c688..8be7c7c 100644 --- a/OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs +++ b/OpenSim/Region/PhysicsModules/UbitOde/ODEModule.cs @@ -78,10 +78,19 @@ namespace OpenSim.Region.PhysicsModule.UbitOde public void RemoveRegion(Scene scene) { + if (!m_Enabled || m_scene == null) + return; + + m_scene.Dispose(); + m_scene = null; } public void RegionLoaded(Scene scene) { + if (!m_Enabled || m_scene == null) + return; + + m_scene.RegionLoaded(); } #endregion } diff --git a/OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs b/OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs index 58eb4b5..bd0e372 100644 --- a/OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs @@ -312,19 +312,21 @@ namespace OpenSim.Region.PhysicsModule.UbitOde private ODERayCastRequestManager m_rayCastManager; public ODEMeshWorker m_meshWorker; -/* maybe needed if ode uses tls - private void checkThread() - { + /* maybe needed if ode uses tls + private void checkThread() + { + + int th = Thread.CurrentThread.ManagedThreadId; + if(th != threadid) + { + threadid = th; + d.AllocateODEDataForThread(~0U); + } + } + */ + + IConfig physicsconfig = null; - int th = Thread.CurrentThread.ManagedThreadId; - if(th != threadid) - { - threadid = th; - d.AllocateODEDataForThread(~0U); - } - } - */ - public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, bool podeUbitLib) { OdeLock = new Object(); @@ -336,25 +338,29 @@ namespace OpenSim.Region.PhysicsModule.UbitOde m_odeUbitLib = podeUbitLib; m_frameWorkScene = pscene; - mesher = m_frameWorkScene.RequestModuleInterface(); - if (mesher == null) - { - m_log.WarnFormat("[UbitODE] No mesher. module disabled"); - return; - } - m_frameWorkScene.RegisterModuleInterface(this); Initialization(); base.Initialise(m_frameWorkScene.PhysicsRequestAsset, (m_frameWorkScene.Heightmap != null ? m_frameWorkScene.Heightmap.GetFloatsSerialised() : new float[m_frameWorkScene.RegionInfo.RegionSizeX * m_frameWorkScene.RegionInfo.RegionSizeY]), - (float)m_frameWorkScene.RegionInfo.RegionSettings.WaterHeight); + (float)m_frameWorkScene.RegionInfo.RegionSettings.WaterHeight); + } + // core hack this just means all modules where loaded + // so now we can look for dependencies + public void RegionLoaded() + { + mesher = m_frameWorkScene.RequestModuleInterface(); + if (mesher == null) + { + m_log.WarnFormat("[UbitODE] No mesher. module disabled"); + return; + } + m_meshWorker = new ODEMeshWorker(this, m_log, mesher, physicsconfig); m_frameWorkScene.PhysicsEnabled = true; } - /// /// Initiailizes the scene /// Sets many properties that ODE requires to be stable @@ -454,7 +460,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde int contactsPerCollision = 80; - IConfig physicsconfig = null; + physicsconfig = null; if (m_config != null) { @@ -505,8 +511,6 @@ namespace OpenSim.Region.PhysicsModule.UbitOde d.WorldSetContactSurfaceLayer(world, contactsurfacelayer); d.WorldSetContactMaxCorrectingVel(world, 60.0f); - m_meshWorker = new ODEMeshWorker(this, m_log, mesher, physicsconfig); - HalfOdeStep = ODE_STEPSIZE * 0.5f; odetimestepMS = (int)(1000.0f * ODE_STEPSIZE + 0.5f); -- cgit v1.1