diff options
author | Teravus Ovares | 2008-09-06 07:52:41 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-09-06 07:52:41 +0000 |
commit | 7d89e122930be39e84a6d174548fa2d12ac0484a (patch) | |
tree | e5aa5752f988a9aba2a969f49e5e208985eda80c /OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs | |
parent | * minor: speculatively try a change to bamboo.build to see if this generates ... (diff) | |
download | opensim-SC_OLD-7d89e122930be39e84a6d174548fa2d12ac0484a.zip opensim-SC_OLD-7d89e122930be39e84a6d174548fa2d12ac0484a.tar.gz opensim-SC_OLD-7d89e122930be39e84a6d174548fa2d12ac0484a.tar.bz2 opensim-SC_OLD-7d89e122930be39e84a6d174548fa2d12ac0484a.tar.xz |
* This is the fabled LibOMV update with all of the libOMV types from JHurliman
* This is a HUGE OMG update and will definitely have unknown side effects.. so this is really only for the strong hearted at this point. Regular people should let the dust settle.
* This has been tested to work with most basic functions. However.. make sure you back up 'everything' before using this. It's that big!
* Essentially we're back at square 1 in the testing phase.. so lets identify things that broke.
Diffstat (limited to 'OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs')
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs | 88 |
1 files changed, 59 insertions, 29 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs index 3d9207f..db41251 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs | |||
@@ -115,43 +115,73 @@ namespace OpenSim.Region.Physics.Manager | |||
115 | // that the LoadFrom context be avoided. This can be done by installing assemblies in the | 115 | // that the LoadFrom context be avoided. This can be done by installing assemblies in the |
116 | // Global Assembly Cache or in the ApplicationBase directory and using Assembly. | 116 | // Global Assembly Cache or in the ApplicationBase directory and using Assembly. |
117 | // Load when explicitly loading assemblies. | 117 | // Load when explicitly loading assemblies. |
118 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 118 | Assembly pluginAssembly = null; |
119 | Type[] types = null; | ||
119 | 120 | ||
120 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 121 | try |
121 | { | 122 | { |
122 | if (pluginType.IsPublic) | 123 | pluginAssembly = Assembly.LoadFrom(FileName); |
123 | { | 124 | } |
124 | if (!pluginType.IsAbstract) | 125 | catch (Exception ex) |
125 | { | 126 | { |
126 | Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin", true); | 127 | m_log.Error("Failed to load plugin from " + FileName, ex); |
127 | 128 | } | |
128 | if (physTypeInterface != null) | ||
129 | { | ||
130 | IPhysicsPlugin plug = | ||
131 | (IPhysicsPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
132 | plug.Init(); | ||
133 | if (!_PhysPlugins.ContainsKey(plug.GetName())) | ||
134 | { | ||
135 | _PhysPlugins.Add(plug.GetName(), plug); | ||
136 | m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName()); | ||
137 | } | ||
138 | } | ||
139 | 129 | ||
140 | Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin", true); | 130 | if (pluginAssembly != null) |
131 | { | ||
132 | try | ||
133 | { | ||
134 | types = pluginAssembly.GetTypes(); | ||
135 | } | ||
136 | catch (ReflectionTypeLoadException ex) | ||
137 | { | ||
138 | m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + FileName + ": " + | ||
139 | ex.LoaderExceptions[0].Message, ex); | ||
140 | } | ||
141 | catch (Exception ex) | ||
142 | { | ||
143 | m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + FileName, ex); | ||
144 | } | ||
141 | 145 | ||
142 | if (meshTypeInterface != null) | 146 | if (types != null) |
147 | { | ||
148 | foreach (Type pluginType in types) | ||
149 | { | ||
150 | if (pluginType.IsPublic) | ||
143 | { | 151 | { |
144 | IMeshingPlugin plug = | 152 | if (!pluginType.IsAbstract) |
145 | (IMeshingPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
146 | if (!_MeshPlugins.ContainsKey(plug.GetName())) | ||
147 | { | 153 | { |
148 | _MeshPlugins.Add(plug.GetName(), plug); | 154 | Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin", true); |
149 | m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName()); | 155 | |
156 | if (physTypeInterface != null) | ||
157 | { | ||
158 | IPhysicsPlugin plug = | ||
159 | (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
160 | plug.Init(); | ||
161 | if (!_PhysPlugins.ContainsKey(plug.GetName())) | ||
162 | { | ||
163 | _PhysPlugins.Add(plug.GetName(), plug); | ||
164 | m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName()); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin", true); | ||
169 | |||
170 | if (meshTypeInterface != null) | ||
171 | { | ||
172 | IMeshingPlugin plug = | ||
173 | (IMeshingPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
174 | if (!_MeshPlugins.ContainsKey(plug.GetName())) | ||
175 | { | ||
176 | _MeshPlugins.Add(plug.GetName(), plug); | ||
177 | m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName()); | ||
178 | } | ||
179 | } | ||
180 | |||
181 | physTypeInterface = null; | ||
182 | meshTypeInterface = null; | ||
150 | } | 183 | } |
151 | } | 184 | } |
152 | |||
153 | physTypeInterface = null; | ||
154 | meshTypeInterface = null; | ||
155 | } | 185 | } |
156 | } | 186 | } |
157 | } | 187 | } |