aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs')
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs42
1 files changed, 30 insertions, 12 deletions
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)