diff --git a/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs b/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs index f7634462a8..a67f55d526 100644 --- a/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs +++ b/Common/OpenGrid.Framework.Communications.OGS1/OGS1GridServices.cs @@ -124,6 +124,15 @@ namespace OpenGrid.Framework.Communications.OGS1 return neighbours; } + /// + /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates + /// + /// REDUNDANT - OGS1 is to be phased out in favour of OGS2 + /// Minimum X value + /// Minimum Y value + /// Maximum X value + /// Maximum Y value + /// Hashtable of hashtables containing map data elements private Hashtable MapBlockQuery(int minX, int minY, int maxX, int maxY) { Hashtable param = new Hashtable(); diff --git a/Common/OpenGrid.Framework.Communications/IGridServices.cs b/Common/OpenGrid.Framework.Communications/IGridServices.cs index 469cf80355..d3b7c07185 100644 --- a/Common/OpenGrid.Framework.Communications/IGridServices.cs +++ b/Common/OpenGrid.Framework.Communications/IGridServices.cs @@ -36,7 +36,7 @@ namespace OpenGrid.Framework.Communications { public class GridInfo { - public string GridServerURI = "http://grid:8001/"; + public string GridServerURI = "http://grid.deepgrid.com:8001/"; // Temporarily hardcoded. public string GridServerSendKey = "badger"; public string GridServerRecvKey = "badger"; } diff --git a/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj b/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj index 694521b86e..419880eab2 100644 --- a/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj +++ b/OpenSim/OpenSim.Terrain.BasicTerrain/OpenSim.Terrain.BasicTerrain.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {2270B8FE-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenSim.Terrain.BasicTerrain @@ -15,9 +16,11 @@ IE50 false Library - + + OpenSim.Terrain.BasicTerrain - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,30 +61,32 @@ False False 4 - + + - + ..\..\bin\libTerrain-BSD.dll False - + + ..\..\bin\openjpegnet.dll False - + System.dll False - + System.Data.dll False - + System.Drawing.dll False - + System.Xml.dll False @@ -92,6 +100,7 @@ Code + @@ -100,4 +109,4 @@ - + \ No newline at end of file diff --git a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs index d1d54adf22..2bda5ba4e2 100644 --- a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs @@ -47,6 +47,11 @@ namespace OpenSim.Terrain public class TerrainEngine { + /// + /// Plugin library for scripts + /// + public FilterHost customFilters = new FilterHost(); + /// /// A [normally] 256x256 heightmap /// @@ -193,8 +198,10 @@ namespace OpenSim.Terrain resultText += "terrain erode aerobic \n"; resultText += "terrain erode thermal \n"; resultText += "terrain multiply - multiplies a terrain by \n"; - resultText += "terrain revert - reverts the terrain to the stored original"; - resultText += "terrain bake - saves the current terrain into the revert map"; + resultText += "terrain revert - reverts the terrain to the stored original\n"; + resultText += "terrain bake - saves the current terrain into the revert map\n"; + resultText += "terrain csfilter - loads a new filter from the specified .cs file\n"; + resultText += "terrain jsfilter - loads a new filter from the specified .js file\n"; return false; case "revert": @@ -285,9 +292,25 @@ namespace OpenSim.Terrain } break; + case "csfilter": + customFilters.LoadFilterCSharp(args[1]); + break; + case "jsfilter": + customFilters.LoadFilterJScript(args[1]); + break; + default: - resultText = "Unknown terrain command"; - return false; + // Run any custom registered filters + if (customFilters.filters.ContainsKey(command)) + { + customFilters.filters[command].Filter(heightmap, args); + break; + } + else + { + resultText = "Unknown terrain command"; + return false; + } } return true; } diff --git a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainFilter.cs b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainFilter.cs new file mode 100644 index 0000000000..6a83c8a738 --- /dev/null +++ b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainFilter.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using System.CodeDom.Compiler; +using System.CodeDom; +using Microsoft.CSharp; +using Microsoft.JScript; + +using libTerrain; + +namespace OpenSim.Terrain +{ + public interface ITerrainFilter + { + void Filter(Channel heightmap, string[] args); + string Register(); + } + + public class TestFilter : ITerrainFilter + { + public void Filter(Channel heightmap, string[] args) + { + Console.WriteLine("Hello world"); + } + + public string Register() + { + return "demofilter"; + } + } + + public class FilterHost + { + public Dictionary filters = new Dictionary(); + + private void LoadFilter(ICodeCompiler compiler, string filename) + { + CompilerParameters compilerParams = new CompilerParameters(); + CompilerResults compilerResults; + compilerParams.GenerateExecutable = false; + compilerParams.GenerateInMemory = true; + compilerParams.IncludeDebugInformation = false; + compilerParams.ReferencedAssemblies.Add("libTerrain-BSD.dll"); + compilerParams.ReferencedAssemblies.Add("OpenSim.Terrain.BasicTerrain.dll"); + compilerParams.ReferencedAssemblies.Add("System.dll"); + + compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename); + + if (compilerResults.Errors.Count > 0) + { + Console.WriteLine("Compile errors:"); + foreach (CompilerError error in compilerResults.Errors) + { + Console.WriteLine(error.Line.ToString() + ": " + error.ErrorText.ToString()); + } + } + else + { + foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes()) + { + Type testInterface = pluginType.GetInterface("ITerrainFilter",true); + + if (testInterface != null) + { + ITerrainFilter filter = (ITerrainFilter)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString()); + + string filterName = filter.Register(); + Console.WriteLine("Plugin: " + filterName + " loaded."); + + if (!filters.ContainsKey(filterName)) + { + filters.Add(filterName, filter); + } + else + { + filters[filterName] = filter; + } + } + } + } + + } + + public void LoadFilterCSharp(string filename) + { + CSharpCodeProvider compiler = new CSharpCodeProvider(); + LoadFilter(compiler.CreateCompiler(), filename); + } + + public void LoadFilterJScript(string filename) + { + JScriptCodeProvider compiler = new JScriptCodeProvider(); + LoadFilter(compiler.CreateCompiler(), filename); + } + } +} diff --git a/OpenSim/OpenSim/OpenSimMain.cs b/OpenSim/OpenSim/OpenSimMain.cs index ef4aa62b49..a6ad15db34 100644 --- a/OpenSim/OpenSim/OpenSimMain.cs +++ b/OpenSim/OpenSim/OpenSimMain.cs @@ -434,11 +434,14 @@ namespace OpenSim break; case "terrain": - //string result = ""; - /* if (!((World)m_localWorld).Terrain.RunTerrainCmd(cmdparams, ref result)) - { - m_log.Error( result); - }*/ + string result = ""; + for (int i = 0; i < m_localWorld.Count; i++) + { + if (!((Scene)m_localWorld[i]).Terrain.RunTerrainCmd(cmdparams, ref result)) + { + m_log.Error(result); + } + } break; case "shutdown":