public async Task <BScene> ConvertOarToScene(IAssetService assetService, AssetManager assetManager) { // Assemble all the parameters that loadoar takes and uses Dictionary <string, object> options = new Dictionary <string, object> { // options.Add("merge", false); { "displacement", _params.P <OMV.Vector3>("Displacement") } }; string optRotation = _params.P <string>("Rotation"); if (optRotation != null) { options.Add("rotation", float.Parse(optRotation, System.Threading.Thread.CurrentThread.CurrentCulture)); } // options.Add("default-user", OMV.UUID.Random()); // if (optSkipAssets != null) options.Add('skipAssets', true); // if (optForceTerrain != null) options.Add("force-terrain", true); // if (optNoObjects != null) options.Add("no-objects", true); string optSubRegion = _params.P <string>("SubRegion"); if (optSubRegion != null) { List <float> bounds = optSubRegion.Split(',').Select <string, float>(x => { return(float.Parse(x)); }).ToList(); options.Add("bounding-origin", new OMV.Vector3(bounds[0], bounds[1], bounds[2])); options.Add("bounding-size", new OMV.Vector3(bounds[3] - bounds[0], bounds[4] - bounds[1], bounds[5] - bounds[2])); } // Create an OpenSimulator region and scene to load the OAR into string regionName = "convoar"; if (String.IsNullOrEmpty(_params.P <String>("RegionName"))) { // Try to build the region name from the OAR filesname regionName = Path.GetFileNameWithoutExtension(_params.P <string>("InputOAR")); } else { regionName = _params.P <string>("RegionName"); } Scene scene = CreateScene(assetService, regionName); // Load the archive into our scene ArchiveReadRequest archive = new ArchiveReadRequest(scene, _params.P <string>("InputOAR"), Guid.Empty, options); archive.DearchiveRegion(false); return(await _converter.ConvertRegionToBScene(scene, assetManager)); }
// Given a filename, return the URI that would reference that file in the asset system private string CreateFileURI(string pFilename, IParameters pParams) { return(PersistRules.ReferenceURL(pParams.P <string>("URIBase"), pFilename)); }