* Added new InstallPlugin interface to ITerrainModule.
* This is to allow other region modules to install Terrain Effects.0.6.0-stable
parent
1487699045
commit
7a77a069dd
|
@ -31,5 +31,6 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
|
||||||
{
|
{
|
||||||
void LoadFromFile(string filename);
|
void LoadFromFile(string filename);
|
||||||
void SaveToFile(string filename);
|
void SaveToFile(string filename);
|
||||||
|
void InstallPlugin(string name, ITerrainEffect plug);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,24 +242,19 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
|
||||||
if (pluginType.IsAbstract || pluginType.IsNotPublic)
|
if (pluginType.IsAbstract || pluginType.IsNotPublic)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
string typeName = pluginType.Name;
|
||||||
|
|
||||||
if (pluginType.GetInterface("ITerrainEffect", false) != null)
|
if (pluginType.GetInterface("ITerrainEffect", false) != null)
|
||||||
{
|
{
|
||||||
ITerrainEffect terEffect = (ITerrainEffect) Activator.CreateInstance(library.GetType(pluginType.ToString()));
|
ITerrainEffect terEffect = (ITerrainEffect) Activator.CreateInstance(library.GetType(pluginType.ToString()));
|
||||||
if (!m_plugineffects.ContainsKey(pluginType.Name))
|
|
||||||
{
|
InstallPlugin(typeName, terEffect);
|
||||||
m_plugineffects.Add(pluginType.Name, terEffect);
|
|
||||||
m_log.Info("E ... " + pluginType.Name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.Warn("E ... " + pluginType.Name + " (Already added)");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (pluginType.GetInterface("ITerrainLoader", false) != null)
|
else if (pluginType.GetInterface("ITerrainLoader", false) != null)
|
||||||
{
|
{
|
||||||
ITerrainLoader terLoader = (ITerrainLoader) Activator.CreateInstance(library.GetType(pluginType.ToString()));
|
ITerrainLoader terLoader = (ITerrainLoader) Activator.CreateInstance(library.GetType(pluginType.ToString()));
|
||||||
m_loaders[terLoader.FileExtension] = terLoader;
|
m_loaders[terLoader.FileExtension] = terLoader;
|
||||||
m_log.Info("L ... " + pluginType.Name);
|
m_log.Info("L ... " + typeName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (AmbiguousMatchException)
|
catch (AmbiguousMatchException)
|
||||||
|
@ -273,6 +268,22 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InstallPlugin(string pluginName, ITerrainEffect effect)
|
||||||
|
{
|
||||||
|
lock (m_plugineffects)
|
||||||
|
{
|
||||||
|
if (!m_plugineffects.ContainsKey(pluginName))
|
||||||
|
{
|
||||||
|
m_plugineffects.Add(pluginName, effect);
|
||||||
|
m_log.Info("E ... " + pluginName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Warn("E ... " + pluginName + " (Skipping)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in New Issue