diff options
author | Michelle Argus | 2011-10-21 23:12:01 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-10-21 23:12:01 +0100 |
commit | a1f05a289dd845edb7e3d163b84ceecc85374427 (patch) | |
tree | 4ba6085486d9c2076c57ce570a56dafce4a60728 | |
parent | very minor removal of old commented out line of code in OdeScene (diff) | |
download | opensim-SC_OLD-a1f05a289dd845edb7e3d163b84ceecc85374427.zip opensim-SC_OLD-a1f05a289dd845edb7e3d163b84ceecc85374427.tar.gz opensim-SC_OLD-a1f05a289dd845edb7e3d163b84ceecc85374427.tar.bz2 opensim-SC_OLD-a1f05a289dd845edb7e3d163b84ceecc85374427.tar.xz |
RemoteAdmin - Added optional terrain loading on region create using parameter heightmap_file to specify the terrain file to be loaded
Diffstat (limited to '')
-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 4319fa0..a634f1c 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -329,28 +329,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
329 | 329 | ||
330 | responseData["accepted"] = true; | 330 | responseData["accepted"] = true; |
331 | 331 | ||
332 | Scene region = null; | 332 | LoadHeightmap(file, regionID); |
333 | 333 | ||
334 | if (!m_application.SceneManager.TryGetScene(regionID, out region)) | ||
335 | throw new Exception("1: unable to get a scene with that name"); | ||
336 | |||
337 | ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); | ||
338 | if (null == terrainModule) throw new Exception("terrain module not available"); | ||
339 | if (Uri.IsWellFormedUriString(file, UriKind.Absolute)) | ||
340 | { | ||
341 | m_log.Info("[RADMIN]: Terrain path is URL"); | ||
342 | Uri result; | ||
343 | if (Uri.TryCreate(file, UriKind.RelativeOrAbsolute, out result)) | ||
344 | { | ||
345 | // the url is valid | ||
346 | string fileType = file.Substring(file.LastIndexOf('/') + 1); | ||
347 | terrainModule.LoadFromStream(fileType, result); | ||
348 | } | ||
349 | } | ||
350 | else | ||
351 | { | ||
352 | terrainModule.LoadFromFile(file); | ||
353 | } | ||
354 | responseData["success"] = false; | 334 | responseData["success"] = false; |
355 | 335 | ||
356 | response.Value = responseData; | 336 | response.Value = responseData; |
@@ -793,6 +773,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
793 | } | 773 | } |
794 | } | 774 | } |
795 | 775 | ||
776 | //Load Heightmap if specified to new region | ||
777 | if (requestData.Contains("heightmap_file")) | ||
778 | { | ||
779 | LoadHeightmap((string)requestData["heightmap_file"], region.RegionID); | ||
780 | } | ||
781 | |||
796 | responseData["success"] = true; | 782 | responseData["success"] = true; |
797 | responseData["region_name"] = region.RegionName; | 783 | responseData["region_name"] = region.RegionName; |
798 | responseData["region_uuid"] = region.RegionID.ToString(); | 784 | responseData["region_uuid"] = region.RegionID.ToString(); |
@@ -3158,5 +3144,39 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
3158 | return false; | 3144 | return false; |
3159 | } | 3145 | } |
3160 | } | 3146 | } |
3147 | private bool LoadHeightmap(string file, UUID regionID) | ||
3148 | { | ||
3149 | m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file); | ||
3150 | |||
3151 | Scene region = null; | ||
3152 | |||
3153 | if (!m_application.SceneManager.TryGetScene(regionID, out region)) | ||
3154 | { | ||
3155 | m_log.InfoFormat("[RADMIN]: unable to get a scene with that name: {0}", regionID.ToString()); | ||
3156 | return false; | ||
3157 | } | ||
3158 | |||
3159 | ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); | ||
3160 | if (null == terrainModule) throw new Exception("terrain module not available"); | ||
3161 | if (Uri.IsWellFormedUriString(file, UriKind.Absolute)) | ||
3162 | { | ||
3163 | m_log.Info("[RADMIN]: Terrain path is URL"); | ||
3164 | Uri result; | ||
3165 | if (Uri.TryCreate(file, UriKind.RelativeOrAbsolute, out result)) | ||
3166 | { | ||
3167 | // the url is valid | ||
3168 | string fileType = file.Substring(file.LastIndexOf('/') + 1); | ||
3169 | terrainModule.LoadFromStream(fileType, result); | ||
3170 | } | ||
3171 | } | ||
3172 | else | ||
3173 | { | ||
3174 | terrainModule.LoadFromFile(file); | ||
3175 | } | ||
3176 | |||
3177 | m_log.Info("[RADMIN]: Load height maps request complete"); | ||
3178 | |||
3179 | return true; | ||
3180 | } | ||
3161 | } | 3181 | } |
3162 | } \ No newline at end of file | 3182 | } \ No newline at end of file |