Merge commit 'a1f05a289dd845edb7e3d163b84ceecc85374427' into bigmerge
commit
1ae36695ba
|
@ -413,28 +413,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
responseData["accepted"] = true;
|
responseData["accepted"] = true;
|
||||||
|
|
||||||
Scene region = null;
|
LoadHeightmap(file, regionID);
|
||||||
|
|
||||||
if (!m_application.SceneManager.TryGetScene(regionID, out region))
|
|
||||||
throw new Exception("1: unable to get a scene with that name");
|
|
||||||
|
|
||||||
ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>();
|
|
||||||
if (null == terrainModule) throw new Exception("terrain module not available");
|
|
||||||
if (Uri.IsWellFormedUriString(file, UriKind.Absolute))
|
|
||||||
{
|
|
||||||
m_log.Info("[RADMIN]: Terrain path is URL");
|
|
||||||
Uri result;
|
|
||||||
if (Uri.TryCreate(file, UriKind.RelativeOrAbsolute, out result))
|
|
||||||
{
|
|
||||||
// the url is valid
|
|
||||||
string fileType = file.Substring(file.LastIndexOf('/') + 1);
|
|
||||||
terrainModule.LoadFromStream(fileType, result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
terrainModule.LoadFromFile(file);
|
|
||||||
}
|
|
||||||
responseData["success"] = false;
|
responseData["success"] = false;
|
||||||
|
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
|
@ -897,6 +877,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Load Heightmap if specified to new region
|
||||||
|
if (requestData.Contains("heightmap_file"))
|
||||||
|
{
|
||||||
|
LoadHeightmap((string)requestData["heightmap_file"], region.RegionID);
|
||||||
|
}
|
||||||
|
|
||||||
responseData["success"] = true;
|
responseData["success"] = true;
|
||||||
responseData["region_name"] = region.RegionName;
|
responseData["region_name"] = region.RegionName;
|
||||||
responseData["region_uuid"] = region.RegionID.ToString();
|
responseData["region_uuid"] = region.RegionID.ToString();
|
||||||
|
@ -3266,5 +3252,39 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private bool LoadHeightmap(string file, UUID regionID)
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file);
|
||||||
|
|
||||||
|
Scene region = null;
|
||||||
|
|
||||||
|
if (!m_application.SceneManager.TryGetScene(regionID, out region))
|
||||||
|
{
|
||||||
|
m_log.InfoFormat("[RADMIN]: unable to get a scene with that name: {0}", regionID.ToString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>();
|
||||||
|
if (null == terrainModule) throw new Exception("terrain module not available");
|
||||||
|
if (Uri.IsWellFormedUriString(file, UriKind.Absolute))
|
||||||
|
{
|
||||||
|
m_log.Info("[RADMIN]: Terrain path is URL");
|
||||||
|
Uri result;
|
||||||
|
if (Uri.TryCreate(file, UriKind.RelativeOrAbsolute, out result))
|
||||||
|
{
|
||||||
|
// the url is valid
|
||||||
|
string fileType = file.Substring(file.LastIndexOf('/') + 1);
|
||||||
|
terrainModule.LoadFromStream(fileType, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
terrainModule.LoadFromFile(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.Info("[RADMIN]: Load height maps request complete");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue