* refactor: change some method names and doc in the physics plugin manager
* move the directory choice for plugins outside into RegionApplicationBase0.6.1-post-fixes
parent
d625095959
commit
b9c07730f5
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
@ -102,7 +103,8 @@ namespace OpenSim.Region.ClientStack
|
||||||
{
|
{
|
||||||
PhysicsPluginManager physicsPluginManager;
|
PhysicsPluginManager physicsPluginManager;
|
||||||
physicsPluginManager = new PhysicsPluginManager();
|
physicsPluginManager = new PhysicsPluginManager();
|
||||||
physicsPluginManager.LoadPlugins();
|
physicsPluginManager.LoadPluginsFromAssemblies("Physics");
|
||||||
|
|
||||||
return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config);
|
return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
|
||||||
testScene.LandChannel = new TestLandChannel();
|
testScene.LandChannel = new TestLandChannel();
|
||||||
|
|
||||||
PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
|
PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
|
||||||
physicsPluginManager.LoadPlugin("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
|
physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
|
||||||
testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource);
|
testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource);
|
||||||
|
|
||||||
return testScene;
|
return testScene;
|
||||||
|
|
|
@ -104,26 +104,26 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load all built-in 'plugins' and those in the bin/Physics diretory
|
/// Load all plugins in assemblies at the given path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void LoadPlugins()
|
/// <param name="pluginsPath"></param>
|
||||||
|
public void LoadPluginsFromAssemblies(string assembliesPath)
|
||||||
{
|
{
|
||||||
// And now walk all assemblies (DLLs effectively) and see if they are home
|
// Walk all assemblies (DLLs effectively) and see if they are home
|
||||||
// of a plugin that is of interest for us
|
// of a plugin that is of interest for us
|
||||||
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Physics");
|
string[] pluginFiles = Directory.GetFiles(assembliesPath, "*.dll");
|
||||||
string[] pluginFiles = Directory.GetFiles(path, "*.dll");
|
|
||||||
|
|
||||||
for (int i = 0; i < pluginFiles.Length; i++)
|
for (int i = 0; i < pluginFiles.Length; i++)
|
||||||
{
|
{
|
||||||
LoadPlugin(pluginFiles[i]);
|
LoadPluginsFromAssembly(pluginFiles[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load plugins from a dll at the given path
|
/// Load plugins from an assembly at the given path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dllPath"></param>
|
/// <param name="assemblyPath"></param>
|
||||||
public void LoadPlugin(string dllPath)
|
public void LoadPluginsFromAssembly(string assemblyPath)
|
||||||
{
|
{
|
||||||
// TODO / NOTE
|
// TODO / NOTE
|
||||||
// The assembly named 'OpenSim.Region.Physics.BasicPhysicsPlugin' was loaded from
|
// The assembly named 'OpenSim.Region.Physics.BasicPhysicsPlugin' was loaded from
|
||||||
|
@ -138,11 +138,11 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pluginAssembly = Assembly.LoadFrom(dllPath);
|
pluginAssembly = Assembly.LoadFrom(assemblyPath);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
m_log.Error("[PHYSICS]: Failed to load plugin from " + dllPath, ex);
|
m_log.Error("[PHYSICS]: Failed to load plugin from " + assemblyPath, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pluginAssembly != null)
|
if (pluginAssembly != null)
|
||||||
|
@ -153,12 +153,12 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
}
|
}
|
||||||
catch (ReflectionTypeLoadException ex)
|
catch (ReflectionTypeLoadException ex)
|
||||||
{
|
{
|
||||||
m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + dllPath + ": " +
|
m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath + ": " +
|
||||||
ex.LoaderExceptions[0].Message, ex);
|
ex.LoaderExceptions[0].Message, ex);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + dllPath, ex);
|
m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (types != null)
|
if (types != null)
|
||||||
|
|
Loading…
Reference in New Issue