diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs index 81d88e2871..66ea59e19f 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs @@ -83,5 +83,14 @@ namespace OpenSim.Region.Environment.Scenes.Tests Assert.That(retrievedPart, Is.Null); } + + /// + /// Test removing an object + /// + public void TestRemoveSceneObjectAsync() + { + TestScene scene = SceneTestUtils.SetupScene(); + SceneObjectPart part = SceneTestUtils.AddSceneObject(scene); + } } } \ No newline at end of file diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs index 1cdd32cf88..289bf873a0 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs @@ -63,7 +63,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests testScene.LandChannel = new TestLandChannel(); PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); - physicsPluginManager.LoadPlugins(); + physicsPluginManager.LoadPlugin("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource); return testScene; diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs index fc8f0628af..71fad02303 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs @@ -44,10 +44,27 @@ namespace OpenSim.Region.Physics.Manager private Dictionary _PhysPlugins = new Dictionary(); private Dictionary _MeshPlugins = new Dictionary(); + /// + /// Constructor. + /// public PhysicsPluginManager() { + // Load "plugins", that are hard coded and not existing in form of an external lib, and hence always + // available + IMeshingPlugin plugHard; + plugHard = new ZeroMesherPlugin(); + _MeshPlugins.Add(plugHard.GetName(), plugHard); + + m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName()); } + /// + /// Get a physics scene for the given physics engine and mesher. + /// + /// + /// + /// + /// public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config) { if (String.IsNullOrEmpty(physEngineName)) @@ -86,14 +103,11 @@ namespace OpenSim.Region.Physics.Manager } } + /// + /// Load all built-in 'plugins' and those in the bin/Physics diretory + /// public void LoadPlugins() { - // Load "plugins", that are hard coded and not existing in form of an external lib - IMeshingPlugin plugHard; - plugHard = new ZeroMesherPlugin(); - _MeshPlugins.Add(plugHard.GetName(), plugHard); - m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName()); - // And now walk all assemblies (DLLs effectively) and see if they are home // of a plugin that is of interest for us string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Physics"); @@ -101,11 +115,15 @@ namespace OpenSim.Region.Physics.Manager for (int i = 0; i < pluginFiles.Length; i++) { - AddPlugin(pluginFiles[i]); + LoadPlugin(pluginFiles[i]); } } - private void AddPlugin(string FileName) + /// + /// Load plugins from a dll at the given path + /// + /// + public void LoadPlugin(string dllPath) { // TODO / NOTE // The assembly named 'OpenSim.Region.Physics.BasicPhysicsPlugin' was loaded from @@ -120,11 +138,11 @@ namespace OpenSim.Region.Physics.Manager try { - pluginAssembly = Assembly.LoadFrom(FileName); + pluginAssembly = Assembly.LoadFrom(dllPath); } catch (Exception ex) { - m_log.Error("[PHYSICS]: Failed to load plugin from " + FileName, ex); + m_log.Error("[PHYSICS]: Failed to load plugin from " + dllPath, ex); } if (pluginAssembly != null) @@ -135,12 +153,12 @@ namespace OpenSim.Region.Physics.Manager } catch (ReflectionTypeLoadException ex) { - m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + FileName + ": " + + m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + dllPath + ": " + ex.LoaderExceptions[0].Message, ex); } catch (Exception ex) { - m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + FileName, ex); + m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + dllPath, ex); } if (types != null)