diff options
author | Mic Bowman | 2012-03-24 22:45:17 -0700 |
---|---|---|
committer | Mic Bowman | 2012-03-24 22:45:17 -0700 |
commit | a07fa0395f8d476608bef91e337250fd98503873 (patch) | |
tree | 7bead4b890b8f1ee7e74b70122754471b259c518 /OpenSim | |
parent | Add support for key, vector, rotation and list types for both (diff) | |
parent | Allow the user to enter help topics in upper or lowercase. (diff) | |
download | opensim-SC-a07fa0395f8d476608bef91e337250fd98503873.zip opensim-SC-a07fa0395f8d476608bef91e337250fd98503873.tar.gz opensim-SC-a07fa0395f8d476608bef91e337250fd98503873.tar.bz2 opensim-SC-a07fa0395f8d476608bef91e337250fd98503873.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to '')
6 files changed, 85 insertions, 48 deletions
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs index 2bb7de1..c5d6b78 100644 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs | |||
@@ -188,19 +188,21 @@ namespace OpenSim.Framework.Console | |||
188 | { | 188 | { |
189 | lock (m_modulesCommands) | 189 | lock (m_modulesCommands) |
190 | { | 190 | { |
191 | if (m_modulesCommands.ContainsKey(moduleName)) | 191 | foreach (string key in m_modulesCommands.Keys) |
192 | { | 192 | { |
193 | List<CommandInfo> commands = m_modulesCommands[moduleName]; | 193 | // Allow topic help requests to succeed whether they are upper or lowercase. |
194 | var ourHelpText = commands.ConvertAll(c => string.Format("{0} - {1}", c.help_text, c.long_help)); | 194 | if (moduleName.ToLower() == key.ToLower()) |
195 | ourHelpText.Sort(); | 195 | { |
196 | helpText.AddRange(ourHelpText); | 196 | List<CommandInfo> commands = m_modulesCommands[key]; |
197 | var ourHelpText = commands.ConvertAll(c => string.Format("{0} - {1}", c.help_text, c.long_help)); | ||
198 | ourHelpText.Sort(); | ||
199 | helpText.AddRange(ourHelpText); | ||
197 | 200 | ||
198 | return true; | 201 | return true; |
199 | } | 202 | } |
200 | else | ||
201 | { | ||
202 | return false; | ||
203 | } | 203 | } |
204 | |||
205 | return false; | ||
204 | } | 206 | } |
205 | } | 207 | } |
206 | 208 | ||
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 5ba3863..a505524 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -421,12 +421,18 @@ namespace OpenSim.Framework | |||
421 | set { m_internalEndPoint = value; } | 421 | set { m_internalEndPoint = value; } |
422 | } | 422 | } |
423 | 423 | ||
424 | /// <summary> | ||
425 | /// The x co-ordinate of this region in map tiles (e.g. 1000). | ||
426 | /// </summary> | ||
424 | public uint RegionLocX | 427 | public uint RegionLocX |
425 | { | 428 | { |
426 | get { return m_regionLocX.Value; } | 429 | get { return m_regionLocX.Value; } |
427 | set { m_regionLocX = value; } | 430 | set { m_regionLocX = value; } |
428 | } | 431 | } |
429 | 432 | ||
433 | /// <summary> | ||
434 | /// The y co-ordinate of this region in map tiles (e.g. 1000). | ||
435 | /// </summary> | ||
430 | public uint RegionLocY | 436 | public uint RegionLocY |
431 | { | 437 | { |
432 | get { return m_regionLocY.Value; } | 438 | get { return m_regionLocY.Value; } |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 484159c..5de3f25 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -248,15 +248,16 @@ namespace OpenSim | |||
248 | { | 248 | { |
249 | string capitalizedTopic = char.ToUpper(topic[0]) + topic.Substring(1); | 249 | string capitalizedTopic = char.ToUpper(topic[0]) + topic.Substring(1); |
250 | 250 | ||
251 | // This is a hack to allow the user to enter the help command in upper or lowercase. This will go | ||
252 | // away at some point. | ||
253 | m_console.Commands.AddCommand(capitalizedTopic, false, "help " + topic, | ||
254 | "help " + capitalizedTopic, | ||
255 | "Get help on plugin command '" + topic + "'", | ||
256 | HandleCommanderHelp); | ||
251 | m_console.Commands.AddCommand(capitalizedTopic, false, "help " + capitalizedTopic, | 257 | m_console.Commands.AddCommand(capitalizedTopic, false, "help " + capitalizedTopic, |
252 | "help " + capitalizedTopic, | 258 | "help " + capitalizedTopic, |
253 | "Get help on plugin command '" + topic + "'", | 259 | "Get help on plugin command '" + topic + "'", |
254 | HandleCommanderHelp); | 260 | HandleCommanderHelp); |
255 | // | ||
256 | // m_console.Commands.AddCommand("General", false, topic, | ||
257 | // topic, | ||
258 | // "Execute subcommand for plugin '" + topic + "'", | ||
259 | // null); | ||
260 | 261 | ||
261 | ICommander commander = null; | 262 | ICommander commander = null; |
262 | 263 | ||
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs index 21a9999..58925fd 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs | |||
@@ -132,13 +132,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
132 | { | 132 | { |
133 | // We need to do this because: | 133 | // We need to do this because: |
134 | // "Saving the image to the same file it was constructed from is not allowed and throws an exception." | 134 | // "Saving the image to the same file it was constructed from is not allowed and throws an exception." |
135 | string tempName = offsetX + "_ " + offsetY + "_" + filename; | 135 | string tempName = Path.GetTempFileName(); |
136 | 136 | ||
137 | Bitmap entireBitmap = null; | 137 | Bitmap entireBitmap = null; |
138 | Bitmap thisBitmap = null; | 138 | Bitmap thisBitmap = null; |
139 | if (File.Exists(filename)) | 139 | if (File.Exists(filename)) |
140 | { | 140 | { |
141 | File.Copy(filename, tempName); | 141 | File.Copy(filename, tempName, true); |
142 | entireBitmap = new Bitmap(tempName); | 142 | entireBitmap = new Bitmap(tempName); |
143 | if (entireBitmap.Width != fileWidth * regionSizeX || entireBitmap.Height != fileHeight * regionSizeY) | 143 | if (entireBitmap.Width != fileWidth * regionSizeX || entireBitmap.Height != fileHeight * regionSizeY) |
144 | { | 144 | { |
@@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
152 | } | 152 | } |
153 | 153 | ||
154 | thisBitmap = CreateGrayscaleBitmapFromMap(m_channel); | 154 | thisBitmap = CreateGrayscaleBitmapFromMap(m_channel); |
155 | Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY); | 155 | // Console.WriteLine("offsetX=" + offsetX + " offsetY=" + offsetY); |
156 | for (int x = 0; x < regionSizeX; x++) | 156 | for (int x = 0; x < regionSizeX; x++) |
157 | for (int y = 0; y < regionSizeY; y++) | 157 | for (int y = 0; y < regionSizeY; y++) |
158 | entireBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y)); | 158 | entireBitmap.SetPixel(x + offsetX * regionSizeX, y + (fileHeight - 1 - offsetY) * regionSizeY, thisBitmap.GetPixel(x, y)); |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs b/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs index 7237f90..d407617 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/ITerrainLoader.cs | |||
@@ -38,6 +38,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
38 | ITerrainChannel LoadStream(Stream stream); | 38 | ITerrainChannel LoadStream(Stream stream); |
39 | void SaveFile(string filename, ITerrainChannel map); | 39 | void SaveFile(string filename, ITerrainChannel map); |
40 | void SaveStream(Stream stream, ITerrainChannel map); | 40 | void SaveStream(Stream stream, ITerrainChannel map); |
41 | |||
42 | /// <summary> | ||
43 | /// Save a number of map tiles to a single big image file. | ||
44 | /// </summary> | ||
45 | /// <remarks> | ||
46 | /// If the image file already exists then the tiles saved will replace those already in the file - other tiles | ||
47 | /// will be untouched. | ||
48 | /// </remarks> | ||
49 | /// <param name="filename">The terrain file to save</param> | ||
50 | /// <param name="offsetX">The map x co-ordinate at which to begin the save.</param> | ||
51 | /// <param name="offsetY">The may y co-ordinate at which to begin the save.</param> | ||
52 | /// <param name="fileWidth">The number of tiles to save along the X axis.</param> | ||
53 | /// <param name="fileHeight">The number of tiles to save along the Y axis.</param> | ||
54 | /// <param name="regionSizeX">The width of a map tile.</param> | ||
55 | /// <param name="regionSizeY">The height of a map tile.</param> | ||
41 | void SaveFile(ITerrainChannel map, string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int regionSizeX, int regionSizeY); | 56 | void SaveFile(ITerrainChannel map, string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int regionSizeX, int regionSizeY); |
42 | } | 57 | } |
43 | } \ No newline at end of file | 58 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 9cd8f2b..17e9737 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -561,49 +561,56 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
561 | } | 561 | } |
562 | 562 | ||
563 | /// <summary> | 563 | /// <summary> |
564 | /// Saves the terrain to a larger terrain file. | 564 | /// Save a number of map tiles to a single big image file. |
565 | /// </summary> | 565 | /// </summary> |
566 | /// <remarks> | ||
567 | /// If the image file already exists then the tiles saved will replace those already in the file - other tiles | ||
568 | /// will be untouched. | ||
569 | /// </remarks> | ||
566 | /// <param name="filename">The terrain file to save</param> | 570 | /// <param name="filename">The terrain file to save</param> |
567 | /// <param name="fileWidth">The width of the file in units</param> | 571 | /// <param name="fileWidth">The number of tiles to save along the X axis.</param> |
568 | /// <param name="fileHeight">The height of the file in units</param> | 572 | /// <param name="fileHeight">The number of tiles to save along the Y axis.</param> |
569 | /// <param name="fileStartX">Where to begin our slice</param> | 573 | /// <param name="fileStartX">The map x co-ordinate at which to begin the save.</param> |
570 | /// <param name="fileStartY">Where to begin our slice</param> | 574 | /// <param name="fileStartY">The may y co-ordinate at which to begin the save.</param> |
571 | public void SaveToFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY) | 575 | public void SaveToFile(string filename, int fileWidth, int fileHeight, int fileStartX, int fileStartY) |
572 | { | 576 | { |
573 | int offsetX = (int)m_scene.RegionInfo.RegionLocX - fileStartX; | 577 | int offsetX = (int)m_scene.RegionInfo.RegionLocX - fileStartX; |
574 | int offsetY = (int)m_scene.RegionInfo.RegionLocY - fileStartY; | 578 | int offsetY = (int)m_scene.RegionInfo.RegionLocY - fileStartY; |
575 | 579 | ||
576 | if (offsetX >= 0 && offsetX < fileWidth && offsetY >= 0 && offsetY < fileHeight) | 580 | if (offsetX < 0 || offsetX >= fileWidth || offsetY < 0 || offsetY >= fileHeight) |
577 | { | 581 | { |
578 | // this region is included in the tile request | 582 | MainConsole.Instance.OutputFormat( |
579 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) | 583 | "ERROR: file width + minimum X tile and file height + minimum Y tile must incorporate the current region at ({0},{1}). File width {2} from {3} and file height {4} from {5} does not.", |
584 | m_scene.RegionInfo.RegionLocX, m_scene.RegionInfo.RegionLocY, fileWidth, fileStartX, fileHeight, fileStartY); | ||
585 | |||
586 | return; | ||
587 | } | ||
588 | |||
589 | // this region is included in the tile request | ||
590 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) | ||
591 | { | ||
592 | if (filename.EndsWith(loader.Key)) | ||
580 | { | 593 | { |
581 | if (filename.EndsWith(loader.Key)) | 594 | lock (m_scene) |
582 | { | 595 | { |
583 | lock (m_scene) | 596 | loader.Value.SaveFile(m_channel, filename, offsetX, offsetY, |
584 | { | 597 | fileWidth, fileHeight, |
585 | loader.Value.SaveFile(m_channel, filename, offsetX, offsetY, | 598 | (int)Constants.RegionSize, |
586 | fileWidth, fileHeight, | 599 | (int)Constants.RegionSize); |
587 | (int)Constants.RegionSize, | 600 | |
588 | (int)Constants.RegionSize); | 601 | MainConsole.Instance.OutputFormat( |
589 | 602 | "Saved terrain from ({0},{1}) to ({2},{3}) from {4} to {5}", | |
590 | m_log.InfoFormat("[TERRAIN]: Saved terrain from {0} to {1}", m_scene.RegionInfo.RegionName, filename); | 603 | fileStartX, fileStartY, fileStartX + fileWidth - 1, fileStartY + fileHeight - 1, |
591 | } | 604 | m_scene.RegionInfo.RegionName, filename); |
592 | |||
593 | return; | ||
594 | } | 605 | } |
606 | |||
607 | return; | ||
595 | } | 608 | } |
596 | |||
597 | m_log.ErrorFormat( | ||
598 | "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}", | ||
599 | m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); | ||
600 | } | 609 | } |
601 | // else | 610 | |
602 | // { | 611 | MainConsole.Instance.OutputFormat( |
603 | // m_log.ErrorFormat( | 612 | "ERROR: Could not save terrain from {0} to {1}. Valid file extensions are {2}", |
604 | // "[TERRAIN]: Could not save terrain from {0} to {1}. {2} {3} {4} {5} {6} {7}", | 613 | m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); |
605 | // m_scene.RegionInfo.RegionName, filename, fileWidth, fileHeight, fileStartX, fileStartY, offsetX, offsetY); | ||
606 | // } | ||
607 | } | 614 | } |
608 | 615 | ||
609 | /// <summary> | 616 | /// <summary> |
@@ -1192,6 +1199,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1192 | "Integer"); | 1199 | "Integer"); |
1193 | saveToTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first section on the file", | 1200 | saveToTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first section on the file", |
1194 | "Integer"); | 1201 | "Integer"); |
1202 | saveToTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first tile on the file\n" | ||
1203 | + "= Example =\n" | ||
1204 | + "To save a PNG file for a set of map tiles 2 regions wide and 3 regions high from map co-ordinate (9910,10234)\n" | ||
1205 | + " # terrain save-tile ST06.png 2 3 9910 10234\n", | ||
1206 | "Integer"); | ||
1207 | |||
1195 | // Terrain adjustments | 1208 | // Terrain adjustments |
1196 | Command fillRegionCommand = | 1209 | Command fillRegionCommand = |
1197 | new Command("fill", CommandIntentions.COMMAND_HAZARDOUS, InterfaceFillTerrain, "Fills the current heightmap with a specified value."); | 1210 | new Command("fill", CommandIntentions.COMMAND_HAZARDOUS, InterfaceFillTerrain, "Fills the current heightmap with a specified value."); |