diff options
author | Melanie | 2011-11-19 22:39:15 +0000 |
---|---|---|
committer | Melanie | 2011-11-19 22:39:15 +0000 |
commit | bdb5ac96d9432eb568ed3e3bb46b012365f884bc (patch) | |
tree | fe2ce2636be7e750b3f235a6c04b9f3a5cf2f8af /OpenSim/Region/CoreModules/World/Terrain | |
parent | Merge branch 'master' into bigmerge (diff) | |
parent | Remove the "[LOCAL SIMULATION CONNECTOR]: Did not find region {0} for SendCre... (diff) | |
download | opensim-SC-bdb5ac96d9432eb568ed3e3bb46b012365f884bc.zip opensim-SC-bdb5ac96d9432eb568ed3e3bb46b012365f884bc.tar.gz opensim-SC-bdb5ac96d9432eb568ed3e3bb46b012365f884bc.tar.bz2 opensim-SC-bdb5ac96d9432eb568ed3e3bb46b012365f884bc.tar.xz |
Merge branch 'master' into bigmerge
Conflicts:
OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Terrain')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index a93ffaa..4805ccb 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -86,6 +86,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
86 | private volatile bool m_tainted; | 86 | private volatile bool m_tainted; |
87 | private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5); | 87 | private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5); |
88 | 88 | ||
89 | /// <summary> | ||
90 | /// Human readable list of terrain file extensions that are supported. | ||
91 | /// </summary> | ||
92 | private string m_supportedFileExtensions = ""; | ||
93 | |||
89 | #region ICommandableModule Members | 94 | #region ICommandableModule Members |
90 | 95 | ||
91 | public ICommander CommandInterface | 96 | public ICommander CommandInterface |
@@ -135,6 +140,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
135 | 140 | ||
136 | InstallDefaultEffects(); | 141 | InstallDefaultEffects(); |
137 | LoadPlugins(); | 142 | LoadPlugins(); |
143 | |||
144 | // Generate user-readable extensions list | ||
145 | string supportedFilesSeparator = ""; | ||
146 | |||
147 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) | ||
148 | { | ||
149 | m_supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")"; | ||
150 | supportedFilesSeparator = ", "; | ||
151 | } | ||
138 | } | 152 | } |
139 | 153 | ||
140 | public void RegionLoaded(Scene scene) | 154 | public void RegionLoaded(Scene scene) |
@@ -251,20 +265,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
251 | if (filename.EndsWith(loader.Key)) | 265 | if (filename.EndsWith(loader.Key)) |
252 | { | 266 | { |
253 | loader.Value.SaveFile(filename, m_channel); | 267 | loader.Value.SaveFile(filename, m_channel); |
268 | m_log.InfoFormat("[TERRAIN]: Saved terrain from {0} to {1}", m_scene.RegionInfo.RegionName, filename); | ||
254 | return; | 269 | return; |
255 | } | 270 | } |
256 | } | 271 | } |
257 | } | 272 | } |
258 | catch (NotImplementedException) | ||
259 | { | ||
260 | m_log.Error("Unable to save to " + filename + ", saving of this file format has not been implemented."); | ||
261 | throw new TerrainException(String.Format("Unable to save heightmap: saving of this file format not implemented")); | ||
262 | } | ||
263 | catch (IOException ioe) | 273 | catch (IOException ioe) |
264 | { | 274 | { |
265 | m_log.Error(String.Format("[TERRAIN]: Unable to save to {0}, {1}", filename, ioe.Message)); | 275 | m_log.Error(String.Format("[TERRAIN]: Unable to save to {0}, {1}", filename, ioe.Message)); |
266 | throw new TerrainException(String.Format("Unable to save heightmap: {0}", ioe.Message)); | ||
267 | } | 276 | } |
277 | |||
278 | m_log.ErrorFormat( | ||
279 | "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}", | ||
280 | m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); | ||
268 | } | 281 | } |
269 | 282 | ||
270 | /// <summary> | 283 | /// <summary> |
@@ -345,6 +358,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
345 | float duration = 0.25f; | 358 | float duration = 0.25f; |
346 | if (action == 0) | 359 | if (action == 0) |
347 | duration = 4.0f; | 360 | duration = 4.0f; |
361 | |||
348 | client_OnModifyTerrain(user, (float)pos.Z, duration, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId); | 362 | client_OnModifyTerrain(user, (float)pos.Z, duration, size, action, pos.Y, pos.X, pos.Y, pos.X, agentId); |
349 | } | 363 | } |
350 | 364 | ||
@@ -534,6 +548,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
534 | m_channel = channel; | 548 | m_channel = channel; |
535 | UpdateRevertMap(); | 549 | UpdateRevertMap(); |
536 | } | 550 | } |
551 | |||
537 | return; | 552 | return; |
538 | } | 553 | } |
539 | } | 554 | } |
@@ -566,10 +581,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
566 | fileWidth, fileHeight, | 581 | fileWidth, fileHeight, |
567 | (int)Constants.RegionSize, | 582 | (int)Constants.RegionSize, |
568 | (int)Constants.RegionSize); | 583 | (int)Constants.RegionSize); |
584 | |||
585 | m_log.InfoFormat("[TERRAIN]: Saved terrain from {0} to {1}", m_scene.RegionInfo.RegionName, filename); | ||
569 | } | 586 | } |
587 | |||
570 | return; | 588 | return; |
571 | } | 589 | } |
572 | } | 590 | } |
591 | |||
592 | m_log.ErrorFormat( | ||
593 | "[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}", | ||
594 | m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions); | ||
573 | } | 595 | } |
574 | } | 596 | } |
575 | 597 | ||
@@ -1126,32 +1148,23 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1126 | 1148 | ||
1127 | private void InstallInterfaces() | 1149 | private void InstallInterfaces() |
1128 | { | 1150 | { |
1129 | // Load / Save | ||
1130 | string supportedFileExtensions = ""; | ||
1131 | string supportedFilesSeparator = ""; | ||
1132 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) | ||
1133 | { | ||
1134 | supportedFileExtensions += supportedFilesSeparator + loader.Key + " (" + loader.Value + ")"; | ||
1135 | supportedFilesSeparator = ", "; | ||
1136 | } | ||
1137 | |||
1138 | Command loadFromFileCommand = | 1151 | Command loadFromFileCommand = |
1139 | new Command("load", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadFile, "Loads a terrain from a specified file."); | 1152 | new Command("load", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadFile, "Loads a terrain from a specified file."); |
1140 | loadFromFileCommand.AddArgument("filename", | 1153 | loadFromFileCommand.AddArgument("filename", |
1141 | "The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " + | 1154 | "The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " + |
1142 | supportedFileExtensions, "String"); | 1155 | m_supportedFileExtensions, "String"); |
1143 | 1156 | ||
1144 | Command saveToFileCommand = | 1157 | Command saveToFileCommand = |
1145 | new Command("save", CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveFile, "Saves the current heightmap to a specified file."); | 1158 | new Command("save", CommandIntentions.COMMAND_NON_HAZARDOUS, InterfaceSaveFile, "Saves the current heightmap to a specified file."); |
1146 | saveToFileCommand.AddArgument("filename", | 1159 | saveToFileCommand.AddArgument("filename", |
1147 | "The destination filename for your heightmap, the file extension determines the format to save in. Supported extensions include: " + | 1160 | "The destination filename for your heightmap, the file extension determines the format to save in. Supported extensions include: " + |
1148 | supportedFileExtensions, "String"); | 1161 | m_supportedFileExtensions, "String"); |
1149 | 1162 | ||
1150 | Command loadFromTileCommand = | 1163 | Command loadFromTileCommand = |
1151 | new Command("load-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadTileFile, "Loads a terrain from a section of a larger file."); | 1164 | new Command("load-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceLoadTileFile, "Loads a terrain from a section of a larger file."); |
1152 | loadFromTileCommand.AddArgument("filename", | 1165 | loadFromTileCommand.AddArgument("filename", |
1153 | "The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " + | 1166 | "The file you wish to load from, the file extension determines the loader to be used. Supported extensions include: " + |
1154 | supportedFileExtensions, "String"); | 1167 | m_supportedFileExtensions, "String"); |
1155 | loadFromTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer"); | 1168 | loadFromTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer"); |
1156 | loadFromTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); | 1169 | loadFromTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); |
1157 | loadFromTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", | 1170 | loadFromTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", |
@@ -1163,7 +1176,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1163 | new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file."); | 1176 | new Command("save-tile", CommandIntentions.COMMAND_HAZARDOUS, InterfaceSaveTileFile, "Saves the current heightmap to the larger file."); |
1164 | saveToTileCommand.AddArgument("filename", | 1177 | saveToTileCommand.AddArgument("filename", |
1165 | "The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " + | 1178 | "The file you wish to save to, the file extension determines the loader to be used. Supported extensions include: " + |
1166 | supportedFileExtensions, "String"); | 1179 | m_supportedFileExtensions, "String"); |
1167 | saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer"); | 1180 | saveToTileCommand.AddArgument("file width", "The width of the file in tiles", "Integer"); |
1168 | saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); | 1181 | saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); |
1169 | saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", | 1182 | saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", |