aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-11-20 18:28:30 +0000
committerJustin Clarke Casey2008-11-20 18:28:30 +0000
commitd6250959597fceec30f1df6355970f385cfd4742 (patch)
tree562313ca0024c40e5266ac00d23a7360d476abfb /OpenSim
parent* Temporarily check in a test log4net config file to see if that reveals why ... (diff)
downloadopensim-SC_OLD-d6250959597fceec30f1df6355970f385cfd4742.zip
opensim-SC_OLD-d6250959597fceec30f1df6355970f385cfd4742.tar.gz
opensim-SC_OLD-d6250959597fceec30f1df6355970f385cfd4742.tar.bz2
opensim-SC_OLD-d6250959597fceec30f1df6355970f385cfd4742.tar.xz
* Allow physics dlls to be loaded separately, rather than just the contents of bin/Physics
* This is primarily to see if not loading ODE in the unit tests will allow them to proceed, though the option of separate loading is probably a good thing in itself
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs9
-rw-r--r--OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs42
3 files changed, 40 insertions, 13 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs
index 81d88e2..66ea59e 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
83 83
84 Assert.That(retrievedPart, Is.Null); 84 Assert.That(retrievedPart, Is.Null);
85 } 85 }
86
87 /// <summary>
88 /// Test removing an object
89 /// </summary>
90 public void TestRemoveSceneObjectAsync()
91 {
92 TestScene scene = SceneTestUtils.SetupScene();
93 SceneObjectPart part = SceneTestUtils.AddSceneObject(scene);
94 }
86 } 95 }
87} \ No newline at end of file 96} \ 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 1cdd32c..289bf87 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
63 testScene.LandChannel = new TestLandChannel(); 63 testScene.LandChannel = new TestLandChannel();
64 64
65 PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); 65 PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
66 physicsPluginManager.LoadPlugins(); 66 physicsPluginManager.LoadPlugin("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
67 testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource); 67 testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource);
68 68
69 return testScene; 69 return testScene;
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
index fc8f062..71fad02 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
@@ -44,10 +44,27 @@ namespace OpenSim.Region.Physics.Manager
44 private Dictionary<string, IPhysicsPlugin> _PhysPlugins = new Dictionary<string, IPhysicsPlugin>(); 44 private Dictionary<string, IPhysicsPlugin> _PhysPlugins = new Dictionary<string, IPhysicsPlugin>();
45 private Dictionary<string, IMeshingPlugin> _MeshPlugins = new Dictionary<string, IMeshingPlugin>(); 45 private Dictionary<string, IMeshingPlugin> _MeshPlugins = new Dictionary<string, IMeshingPlugin>();
46 46
47 /// <summary>
48 /// Constructor.
49 /// </summary>
47 public PhysicsPluginManager() 50 public PhysicsPluginManager()
48 { 51 {
52 // Load "plugins", that are hard coded and not existing in form of an external lib, and hence always
53 // available
54 IMeshingPlugin plugHard;
55 plugHard = new ZeroMesherPlugin();
56 _MeshPlugins.Add(plugHard.GetName(), plugHard);
57
58 m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName());
49 } 59 }
50 60
61 /// <summary>
62 /// Get a physics scene for the given physics engine and mesher.
63 /// </summary>
64 /// <param name="physEngineName"></param>
65 /// <param name="meshEngineName"></param>
66 /// <param name="config"></param>
67 /// <returns></returns>
51 public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config) 68 public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config)
52 { 69 {
53 if (String.IsNullOrEmpty(physEngineName)) 70 if (String.IsNullOrEmpty(physEngineName))
@@ -86,14 +103,11 @@ namespace OpenSim.Region.Physics.Manager
86 } 103 }
87 } 104 }
88 105
106 /// <summary>
107 /// Load all built-in 'plugins' and those in the bin/Physics diretory
108 /// </summary>
89 public void LoadPlugins() 109 public void LoadPlugins()
90 { 110 {
91 // Load "plugins", that are hard coded and not existing in form of an external lib
92 IMeshingPlugin plugHard;
93 plugHard = new ZeroMesherPlugin();
94 _MeshPlugins.Add(plugHard.GetName(), plugHard);
95 m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName());
96
97 // And now walk all assemblies (DLLs effectively) and see if they are home 111 // And now walk all assemblies (DLLs effectively) and see if they are home
98 // of a plugin that is of interest for us 112 // of a plugin that is of interest for us
99 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Physics"); 113 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Physics");
@@ -101,11 +115,15 @@ namespace OpenSim.Region.Physics.Manager
101 115
102 for (int i = 0; i < pluginFiles.Length; i++) 116 for (int i = 0; i < pluginFiles.Length; i++)
103 { 117 {
104 AddPlugin(pluginFiles[i]); 118 LoadPlugin(pluginFiles[i]);
105 } 119 }
106 } 120 }
107 121
108 private void AddPlugin(string FileName) 122 /// <summary>
123 /// Load plugins from a dll at the given path
124 /// </summary>
125 /// <param name="dllPath"></param>
126 public void LoadPlugin(string dllPath)
109 { 127 {
110 // TODO / NOTE 128 // TODO / NOTE
111 // The assembly named 'OpenSim.Region.Physics.BasicPhysicsPlugin' was loaded from 129 // The assembly named 'OpenSim.Region.Physics.BasicPhysicsPlugin' was loaded from
@@ -120,11 +138,11 @@ namespace OpenSim.Region.Physics.Manager
120 138
121 try 139 try
122 { 140 {
123 pluginAssembly = Assembly.LoadFrom(FileName); 141 pluginAssembly = Assembly.LoadFrom(dllPath);
124 } 142 }
125 catch (Exception ex) 143 catch (Exception ex)
126 { 144 {
127 m_log.Error("[PHYSICS]: Failed to load plugin from " + FileName, ex); 145 m_log.Error("[PHYSICS]: Failed to load plugin from " + dllPath, ex);
128 } 146 }
129 147
130 if (pluginAssembly != null) 148 if (pluginAssembly != null)
@@ -135,12 +153,12 @@ namespace OpenSim.Region.Physics.Manager
135 } 153 }
136 catch (ReflectionTypeLoadException ex) 154 catch (ReflectionTypeLoadException ex)
137 { 155 {
138 m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + FileName + ": " + 156 m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + dllPath + ": " +
139 ex.LoaderExceptions[0].Message, ex); 157 ex.LoaderExceptions[0].Message, ex);
140 } 158 }
141 catch (Exception ex) 159 catch (Exception ex)
142 { 160 {
143 m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + FileName, ex); 161 m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + dllPath, ex);
144 } 162 }
145 163
146 if (types != null) 164 if (types != null)