diff options
Merge commit 'a1f05a289dd845edb7e3d163b84ceecc85374427' into bigmerge
Diffstat (limited to 'OpenSim/ApplicationPlugins')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 62 |
1 files changed, 41 insertions, 21 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 0c4012c..468eeb4 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -413,28 +413,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
413 | 413 | ||
414 | responseData["accepted"] = true; | 414 | responseData["accepted"] = true; |
415 | 415 | ||
416 | Scene region = null; | 416 | LoadHeightmap(file, regionID); |
417 | 417 | ||
418 | if (!m_application.SceneManager.TryGetScene(regionID, out region)) | ||
419 | throw new Exception("1: unable to get a scene with that name"); | ||
420 | |||
421 | ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); | ||
422 | if (null == terrainModule) throw new Exception("terrain module not available"); | ||
423 | if (Uri.IsWellFormedUriString(file, UriKind.Absolute)) | ||
424 | { | ||
425 | m_log.Info("[RADMIN]: Terrain path is URL"); | ||
426 | Uri result; | ||
427 | if (Uri.TryCreate(file, UriKind.RelativeOrAbsolute, out result)) | ||
428 | { | ||
429 | // the url is valid | ||
430 | string fileType = file.Substring(file.LastIndexOf('/') + 1); | ||
431 | terrainModule.LoadFromStream(fileType, result); | ||
432 | } | ||
433 | } | ||
434 | else | ||
435 | { | ||
436 | terrainModule.LoadFromFile(file); | ||
437 | } | ||
438 | responseData["success"] = false; | 418 | responseData["success"] = false; |
439 | 419 | ||
440 | response.Value = responseData; | 420 | response.Value = responseData; |
@@ -897,6 +877,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
897 | } | 877 | } |
898 | } | 878 | } |
899 | 879 | ||
880 | //Load Heightmap if specified to new region | ||
881 | if (requestData.Contains("heightmap_file")) | ||
882 | { | ||
883 | LoadHeightmap((string)requestData["heightmap_file"], region.RegionID); | ||
884 | } | ||
885 | |||
900 | responseData["success"] = true; | 886 | responseData["success"] = true; |
901 | responseData["region_name"] = region.RegionName; | 887 | responseData["region_name"] = region.RegionName; |
902 | responseData["region_uuid"] = region.RegionID.ToString(); | 888 | responseData["region_uuid"] = region.RegionID.ToString(); |
@@ -3266,5 +3252,39 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
3266 | return false; | 3252 | return false; |
3267 | } | 3253 | } |
3268 | } | 3254 | } |
3255 | private bool LoadHeightmap(string file, UUID regionID) | ||
3256 | { | ||
3257 | m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file); | ||
3258 | |||
3259 | Scene region = null; | ||
3260 | |||
3261 | if (!m_application.SceneManager.TryGetScene(regionID, out region)) | ||
3262 | { | ||
3263 | m_log.InfoFormat("[RADMIN]: unable to get a scene with that name: {0}", regionID.ToString()); | ||
3264 | return false; | ||
3265 | } | ||
3266 | |||
3267 | ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); | ||
3268 | if (null == terrainModule) throw new Exception("terrain module not available"); | ||
3269 | if (Uri.IsWellFormedUriString(file, UriKind.Absolute)) | ||
3270 | { | ||
3271 | m_log.Info("[RADMIN]: Terrain path is URL"); | ||
3272 | Uri result; | ||
3273 | if (Uri.TryCreate(file, UriKind.RelativeOrAbsolute, out result)) | ||
3274 | { | ||
3275 | // the url is valid | ||
3276 | string fileType = file.Substring(file.LastIndexOf('/') + 1); | ||
3277 | terrainModule.LoadFromStream(fileType, result); | ||
3278 | } | ||
3279 | } | ||
3280 | else | ||
3281 | { | ||
3282 | terrainModule.LoadFromFile(file); | ||
3283 | } | ||
3284 | |||
3285 | m_log.Info("[RADMIN]: Load height maps request complete"); | ||
3286 | |||
3287 | return true; | ||
3288 | } | ||
3269 | } | 3289 | } |
3270 | } | 3290 | } |