found core hack to fix modules interdependencies RegionLoaded is not that obvius

avinationmerge
UbitUmarov 2015-09-09 17:55:46 +01:00
parent 8571736ff3
commit e1a8125b4f
2 changed files with 38 additions and 25 deletions

View File

@ -78,10 +78,19 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
{ {
if (!m_Enabled || m_scene == null)
return;
m_scene.Dispose();
m_scene = null;
} }
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
{ {
if (!m_Enabled || m_scene == null)
return;
m_scene.RegionLoaded();
} }
#endregion #endregion
} }

View File

@ -312,18 +312,20 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
private ODERayCastRequestManager m_rayCastManager; private ODERayCastRequestManager m_rayCastManager;
public ODEMeshWorker m_meshWorker; public ODEMeshWorker m_meshWorker;
/* maybe needed if ode uses tls /* maybe needed if ode uses tls
private void checkThread() private void checkThread()
{ {
int th = Thread.CurrentThread.ManagedThreadId; int th = Thread.CurrentThread.ManagedThreadId;
if(th != threadid) if(th != threadid)
{ {
threadid = th; threadid = th;
d.AllocateODEDataForThread(~0U); d.AllocateODEDataForThread(~0U);
} }
} }
*/ */
IConfig physicsconfig = null;
public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, bool podeUbitLib) public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, bool podeUbitLib)
{ {
@ -336,13 +338,6 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
m_odeUbitLib = podeUbitLib; m_odeUbitLib = podeUbitLib;
m_frameWorkScene = pscene; m_frameWorkScene = pscene;
mesher = m_frameWorkScene.RequestModuleInterface<IMesher>();
if (mesher == null)
{
m_log.WarnFormat("[UbitODE] No mesher. module disabled");
return;
}
m_frameWorkScene.RegisterModuleInterface<PhysicsScene>(this); m_frameWorkScene.RegisterModuleInterface<PhysicsScene>(this);
Initialization(); Initialization();
@ -350,11 +345,22 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
base.Initialise(m_frameWorkScene.PhysicsRequestAsset, base.Initialise(m_frameWorkScene.PhysicsRequestAsset,
(m_frameWorkScene.Heightmap != null ? m_frameWorkScene.Heightmap.GetFloatsSerialised() : new float[m_frameWorkScene.RegionInfo.RegionSizeX * m_frameWorkScene.RegionInfo.RegionSizeY]), (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);
m_frameWorkScene.PhysicsEnabled = true;
} }
// core hack this just means all modules where loaded
// so now we can look for dependencies
public void RegionLoaded()
{
mesher = m_frameWorkScene.RequestModuleInterface<IMesher>();
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;
}
/// <summary> /// <summary>
/// Initiailizes the scene /// Initiailizes the scene
/// Sets many properties that ODE requires to be stable /// Sets many properties that ODE requires to be stable
@ -454,7 +460,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
int contactsPerCollision = 80; int contactsPerCollision = 80;
IConfig physicsconfig = null; physicsconfig = null;
if (m_config != null) if (m_config != null)
{ {
@ -505,8 +511,6 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
d.WorldSetContactSurfaceLayer(world, contactsurfacelayer); d.WorldSetContactSurfaceLayer(world, contactsurfacelayer);
d.WorldSetContactMaxCorrectingVel(world, 60.0f); d.WorldSetContactMaxCorrectingVel(world, 60.0f);
m_meshWorker = new ODEMeshWorker(this, m_log, mesher, physicsconfig);
HalfOdeStep = ODE_STEPSIZE * 0.5f; HalfOdeStep = ODE_STEPSIZE * 0.5f;
odetimestepMS = (int)(1000.0f * ODE_STEPSIZE + 0.5f); odetimestepMS = (int)(1000.0f * ODE_STEPSIZE + 0.5f);