Exemplo n.º 1
0
 public PreExportProcess(ExportParameters _exportParameters, ILoggingProvider _logger)
 {
     exportParameters = _exportParameters;
     logger           = _logger;
 }
Exemplo n.º 2
0
        public static string TryWriteImage(string outputFolder, string sourcePath, string textureName, ILoggingProvider logger, ExportParameters exportParameters)
        {
            if (sourcePath == null || sourcePath == "")
            {
                logger?.RaiseWarning("Texture path is missing.", 3);
                return(null);
            }

            var validImageFormat = GetGltfValidImageFormat(Path.GetExtension(sourcePath));

            if (validImageFormat == null)
            {
                // Image format is not supported by the exporter
                logger?.RaiseWarning(string.Format("Format of texture {0} is not supported by the exporter. Consider using a standard image format like jpg or png.", Path.GetFileName(sourcePath)), 3);
                return(null);
            }

            // Copy texture to output
            var destPath = Path.Combine(outputFolder, textureName);

            destPath = Path.ChangeExtension(destPath, validImageFormat);
            CopyGltfTexture(sourcePath, destPath, logger, exportParameters);

            return(validImageFormat);
        }
Exemplo n.º 3
0
 public bool ExportBabylonExtension <T>(T babylonObject, ExportParameters parameters, ref BabylonScene babylonScene, ILoggingProvider logger)
 {
     // just skip this extension is ment only for GLTF
     return(false);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Export to file
        /// </summary>
        /// <param name="outputDirectory">The directory to store the generated files</param>
        /// <param name="outputFileName">The filename to use for the generated files</param>
        /// <param name="outputFormat">The format to use for the generated files</param>
        /// <param name="generateManifest">Specifies if a manifest file should be generated</param>
        /// <param name="onlySelected">Specifies if only the selected objects should be exported</param>
        /// <param name="autoSaveMayaFile">Specifies if the Maya scene should be auto-saved</param>
        /// <param name="exportHiddenObjects">Specifies if hidden objects should be exported</param>
        /// <param name="copyTexturesToOutput">Specifies if textures should be copied to the output directory</param>
        /// <param name="optimizeVertices">Specifies if vertices should be optimized on export</param>
        /// <param name="exportTangents">Specifies if tangents should be exported</param>
        /// <param name="scaleFactor">Scales the scene by this factor</param>
        /// <param name="exportSkin">Specifies if skins should be exported</param>
        /// <param name="quality">The texture quality</param>
        /// <param name="dracoCompression">Specifies if draco compression should be used</param>
        /// <param name="exportMorphNormal">Specifies if normals should be exported for morph targets</param>
        /// <param name="exportMorphTangent">Specifies if tangents should be exported for morph targets</param>
        /// <param name="exportKHRLightsPunctual">Specifies if the KHR_lights_punctual extension should be enabled</param>
        /// <param name="exportKHRTextureTransform">Specifies if the KHR_texture_transform extension should be enabled</param>
        /// <param name="bakeAnimationFrames">Specifies if animations should be exporting keyframes directly or should manually bake out animations frame by frame</param>
        public void Export(ExportParameters exportParameters)
        {
            this.exportParameters = exportParameters;

            // Check if the animation is running
            MGlobal.executeCommand("play -q - state", out int isPlayed);
            if (isPlayed == 1)
            {
                RaiseError("Stop the animation before exporting.");
                return;
            }

            RaiseMessage("Export started", Color.Blue);
            var progression = 0.0f;

            ReportProgressChanged(progression);

            // In Maya, system unit does not influence model size
            // Ex: 1 meter is converted to 100 cm: the scene is not shrinked
            // All values are retreived from API as centimeters regardless of current unit
            scaleFactorToMeters = 0.01f;

            // Store export options
            this.isBabylonExported = exportParameters.outputFormat == "babylon" || exportParameters.outputFormat == "binary babylon";

            var outputBabylonDirectory = Path.GetDirectoryName(exportParameters.outputPath);

            // Check directory exists
            if (!Directory.Exists(outputBabylonDirectory))
            {
                RaiseError("Export stopped: Output folder does not exist");
                ReportProgressChanged(100);
                return;
            }

            var watch = new Stopwatch();

            watch.Start();


            var babylonScene = new BabylonScene(outputBabylonDirectory);

            // Save scene
            if (exportParameters.autoSaveSceneFile)
            {
                RaiseMessage("Saving Maya file");

                // Query expand file name
                string fileName = MGlobal.executeCommandStringResult($@"file -q -exn;");

                // If scene has already been saved previously
                if (fileName.EndsWith(".ma") || fileName.EndsWith(".mb"))
                {
                    // Name is already specified and this line will not fail
                    MFileIO.save();
                }
                else
                {
                    // Open SaveAs dialog window
                    MGlobal.executeCommand($@"fileDialog2;");
                }
            }

            // Force output file extension to be babylon
            var outputFileName = Path.ChangeExtension(Path.GetFileName(exportParameters.outputPath), "babylon");

            // Store selected nodes
            MSelectionList selectedNodes = new MSelectionList();

            MGlobal.getActiveSelectionList(selectedNodes);
            selectedNodeFullPaths = new List <string>();
            MItSelectionList mItSelectionList = new MItSelectionList(selectedNodes);

            while (!mItSelectionList.isDone)
            {
                MDagPath mDagPath = new MDagPath();
                try
                {
                    mItSelectionList.getDagPath(mDagPath);
                    selectedNodeFullPaths.Add(mDagPath.fullPathName);
                } catch
                {
                    // selected object is not a DAG object
                    // fail silently
                }

                mItSelectionList.next();
            }
            if (selectedNodeFullPaths.Count > 0)
            {
                RaiseMessage("Selected nodes full path");
                foreach (string selectedNodeFullPath in selectedNodeFullPaths)
                {
                    RaiseMessage(selectedNodeFullPath, 1);
                }
            }

            // Producer
            babylonScene.producer = new BabylonProducer
            {
                name             = "Maya",
                version          = "2018",
                exporter_version = exporterVersion,
                file             = outputFileName
            };

            // Global
            babylonScene.autoClear = true;
            // TODO - Retreive colors from Maya
            //babylonScene.clearColor = Loader.Core.GetBackGround(0, Tools.Forever).ToArray();
            //babylonScene.ambientColor = Loader.Core.GetAmbient(0, Tools.Forever).ToArray();

            babylonScene.TimelineStartFrame      = Loader.GetMinTime();
            babylonScene.TimelineEndFrame        = Loader.GetMaxTime();
            babylonScene.TimelineFramesPerSecond = Loader.GetFPS();

            // TODO - Add custom properties
            _exportQuaternionsInsteadOfEulers = true;

            PrintDAG(true);
            PrintDAG(false);

            // Store the current frame. It can be change to find a proper one for the node/bone export
            double currentTime = Loader.GetCurrentTime();

            // --------------------
            // ------ Nodes -------
            // --------------------
            RaiseMessage("Exporting nodes");

            // It makes each morph target manager export starts from id = 0.
            BabylonMorphTargetManager.Reset();

            // Clear materials
            referencedMaterials.Clear();
            multiMaterials.Clear();

            // Get all nodes
            var             dagIterator = new MItDag(MItDag.TraversalType.kDepthFirst, MFn.Type.kTransform);
            List <MDagPath> nodes       = new List <MDagPath>();

            while (!dagIterator.isDone)
            {
                MDagPath mDagPath = new MDagPath();
                dagIterator.getPath(mDagPath);

                // Check if one of its descendant (direct or not) is a mesh/camera/light/locator
                if (isNodeRelevantToExportRec(mDagPath)
                    // Ensure it's not one of the default cameras used as viewports in Maya
                    && defaultCameraNames.Contains(mDagPath.partialPathName) == false)
                {
                    nodes.Add(mDagPath);
                }
                else
                {
                    // Skip descendants
                    dagIterator.prune();
                }

                dagIterator.next();
            }
            // Export all nodes
            var progressionStep = 100.0f / nodes.Count;

            foreach (MDagPath mDagPath in nodes)
            {
                BabylonNode babylonNode = null;

                try
                {
                    if (exportParameters.exportAnimationsOnly == false)
                    {
                        switch (getApiTypeOfDirectDescendants(mDagPath))
                        {
                        case MFn.Type.kMesh:
                            babylonNode = ExportMesh(mDagPath, babylonScene);
                            break;

                        case MFn.Type.kCamera:
                            babylonNode = ExportCamera(mDagPath, babylonScene);
                            break;

                        case MFn.Type.kLight:     // Lights api type are actually kPointLight, kSpotLight...
                            babylonNode = ExportLight(mDagPath, babylonScene);
                            break;

                        case MFn.Type.kLocator:     // Camera target
                            babylonNode = ExportDummy(mDagPath, babylonScene);
                            break;
                        }
                    }
                    else
                    {
                        switch (getApiTypeOfDirectDescendants(mDagPath))
                        {
                        case MFn.Type.kMesh:
                            babylonNode = ExportMesh(mDagPath, babylonScene);
                            break;

                        case MFn.Type.kCamera:
                        case MFn.Type.kLight:     // Lights api type are actually kPointLight, kSpotLight...
                        case MFn.Type.kLocator:   // Camera target
                            babylonNode = ExportDummy(mDagPath, babylonScene);
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    this.RaiseWarning(String.Format("Exception raised during export. Node will be exported as dummy node. \r\nMessage: \r\n{0} \r\n{1}", e.Message, e.InnerException), 2);
                }

                // If node is not exported successfully
                if (babylonNode == null)
                {
                    // Create a dummy (empty mesh)
                    babylonNode = ExportDummy(mDagPath, babylonScene);
                }
                ;

                // Update progress bar
                progression += progressionStep;
                ReportProgressChanged(progression);

                CheckCancelled();
            }
            RaiseMessage(string.Format("Total meshes: {0}", babylonScene.MeshesList.Count), Color.Gray, 1);


            // if nothing is enlightened, exclude all meshes
            foreach (BabylonLight light in babylonScene.LightsList)
            {
                if (light.includedOnlyMeshesIds.Length == 0)
                {
                    light.excludedMeshesIds = babylonScene.MeshesList.Select(m => m.id).ToArray();
                }
            }

            /*
             * Switch coordinate system at global level
             *
             * Add a root node with negative scaling
             * Pros - It's safer to use a root node
             * Cons - It's cleaner to switch at object level (as it is done now)
             * Use root node method when you want to be 100% sure of the output
             * Don't forget to also inverse winding order of mesh indices
             */
            //// Switch from right to left handed coordinate system
            //MUuid mUuid = new MUuid();
            //mUuid.generate();
            //var rootNode = new BabylonMesh
            //{
            //    name = "root",
            //    id = mUuid.asString(),
            //    scaling = new float[] { 1, 1, -1 }
            //};
            //foreach(var babylonMesh in babylonScene.MeshesList)
            //{
            //    // Add root meshes as child to root node
            //    if (babylonMesh.parentId == null)
            //    {
            //        babylonMesh.parentId = rootNode.id;
            //    }
            //}
            //babylonScene.MeshesList.Add(rootNode);

            // Main camera
            BabylonCamera babylonMainCamera = null;

            if (babylonScene.CamerasList.Count > 0)
            {
                // Set first camera as main one
                babylonMainCamera           = babylonScene.CamerasList[0];
                babylonScene.activeCameraID = babylonMainCamera.id;
                RaiseMessage("Active camera set to " + babylonMainCamera.name, Color.Green, 1, true);
            }

            if (babylonMainCamera == null)
            {
                RaiseWarning("No camera defined", 1);
            }
            else
            {
                RaiseMessage(string.Format("Total cameras: {0}", babylonScene.CamerasList.Count), Color.Gray, 1);
            }

            if (exportParameters.exportAnimationsOnly == false)
            {
                // Default light
                if (!exportParameters.pbrNoLight && babylonScene.LightsList.Count == 0)
                {
                    RaiseWarning("No light defined", 1);
                    RaiseWarning("A default ambient light was added for your convenience", 1);
                    ExportDefaultLight(babylonScene);
                }
                else
                {
                    RaiseMessage(string.Format("Total lights: {0}", babylonScene.LightsList.Count), Color.Gray, 1);
                }
            }

            var sceneScaleFactor = exportParameters.scaleFactor;

            if (sceneScaleFactor != 1.0f)
            {
                RaiseMessage(String.Format("A root node is added to globally scale the scene by {0}", sceneScaleFactor), 1);

                // Create root node for scaling
                BabylonMesh rootNode = new BabylonMesh {
                    name = "root", id = Tools.GenerateUUID()
                };
                rootNode.isDummy = true;
                float rootNodeScale = sceneScaleFactor;
                rootNode.scaling = new float[3] {
                    rootNodeScale, rootNodeScale, rootNodeScale
                };

                if (ExportQuaternionsInsteadOfEulers)
                {
                    rootNode.rotationQuaternion = new float[] { 0, 0, 0, 1 };
                }
                else
                {
                    rootNode.rotation = new float[] { 0, 0, 0 };
                }

                // Update all top nodes
                var babylonNodes = new List <BabylonNode>();
                babylonNodes.AddRange(babylonScene.MeshesList);
                babylonNodes.AddRange(babylonScene.CamerasList);
                babylonNodes.AddRange(babylonScene.LightsList);
                foreach (BabylonNode babylonNode in babylonNodes)
                {
                    if (babylonNode.parentId == null)
                    {
                        babylonNode.parentId = rootNode.id;
                    }
                }

                // Store root node
                babylonScene.MeshesList.Add(rootNode);
            }

            // --------------------
            // ----- Materials ----
            // --------------------
            if (exportParameters.exportAnimationsOnly == false && exportParameters.exportMaterials == true)
            {
                RaiseMessage("Exporting materials");
                GenerateMaterialDuplicationDatas(babylonScene);
                foreach (var mat in referencedMaterials)
                {
                    ExportMaterial(mat, babylonScene, exportParameters.pbrFull);
                    CheckCancelled();
                }
                foreach (var mat in multiMaterials)
                {
                    ExportMultiMaterial(mat.Key, mat.Value, babylonScene, exportParameters.pbrFull);
                    CheckCancelled();
                }
                UpdateMeshesMaterialId(babylonScene);
                RaiseMessage(string.Format("Total: {0}", babylonScene.MaterialsList.Count + babylonScene.MultiMaterialsList.Count), Color.Gray, 1);
            }

            // Export skeletons
            if (exportParameters.exportSkins && skins.Count > 0)
            {
                progressSkin     = 0;
                progressSkinStep = 100 / skins.Count;
                ReportProgressChanged(progressSkin);
                RaiseMessage("Exporting skeletons");
                foreach (var skin in skins)
                {
                    ExportSkin(skin, babylonScene);
                }
            }

            // set back the frame
            Loader.SetCurrentTime(currentTime);

            // ----------------------------
            // ----- Animation groups -----
            // ----------------------------
            if (exportParameters.exportAnimations)
            {
                RaiseMessage("Export animation groups");
                // add animation groups to the scene
                babylonScene.animationGroups = ExportAnimationGroups(babylonScene);
            }


            if (isBabylonExported)
            {
                // if we are exporting to .Babylon then remove animations from nodes if there are animation groups.
                if (babylonScene.animationGroups != null && babylonScene.animationGroups.Count > 0)
                {
                    // add animations of each nodes in the animGroup
                    List <BabylonNode> babylonNodes = new List <BabylonNode>();
                    babylonNodes.AddRange(babylonScene.MeshesList);
                    babylonNodes.AddRange(babylonScene.CamerasList);
                    babylonNodes.AddRange(babylonScene.LightsList);

                    foreach (BabylonNode node in babylonNodes)
                    {
                        node.animations = null;
                    }
                    foreach (BabylonSkeleton skel in babylonScene.SkeletonsList)
                    {
                        foreach (BabylonBone bone in skel.bones)
                        {
                            bone.animation = null;
                        }
                    }
                }

                if (exportParameters.exportAnimationsOnly == false)
                {
                    // setup a default skybox for the scene for .Babylon export.
                    var sourcePath = exportParameters.pbrEnvironment;
                    if (!string.IsNullOrEmpty(sourcePath))
                    {
                        babylonScene.createDefaultSkybox = exportParameters.createDefaultSkybox;
                        var fileName = Path.GetFileName(sourcePath);

                        // Allow only dds file format
                        if (!fileName.EndsWith(".dds"))
                        {
                            RaiseWarning("Failed to export defauenvironment texture: only .dds format is supported.");
                        }
                        else
                        {
                            RaiseMessage($"texture id = Max_Babylon_Default_Environment");
                            babylonScene.environmentTexture = fileName;

                            if (exportParameters.writeTextures)
                            {
                                try
                                {
                                    var destPath = Path.Combine(babylonScene.OutputPath, fileName);
                                    if (File.Exists(sourcePath) && sourcePath != destPath)
                                    {
                                        File.Copy(sourcePath, destPath, true);
                                    }
                                }
                                catch
                                {
                                    // silently fails
                                    RaiseMessage($"Fail to export the default env texture", 3);
                                }
                            }
                        }
                    }
                }
            }

            // Output
            babylonScene.Prepare(false, false);

            if (isBabylonExported)
            {
                Write(babylonScene, outputBabylonDirectory, outputFileName, exportParameters.outputFormat, exportParameters.generateManifest);
            }

            ReportProgressChanged(100);

            // Export glTF
            if (exportParameters.outputFormat == "gltf" || exportParameters.outputFormat == "glb")
            {
                bool generateBinary = exportParameters.outputFormat == "glb";

                GLTFExporter gltfExporter = new GLTFExporter();
                gltfExporter.ExportGltf(this.exportParameters, babylonScene, outputBabylonDirectory, outputFileName, generateBinary, this);
            }

            watch.Stop();
            RaiseMessage(string.Format("Export done in {0:0.00}s", watch.ElapsedMilliseconds / 1000.0), Color.Blue);
        }
Exemplo n.º 5
0
        private void CreateFiles(ClaimsPrincipal user,
                                 ExportParameters exportParameters,
                                 SparseProjectInfo sparseProject,
                                 string directoryPath,
                                 CancellationToken cancellationToken)
        {
            var channelDescriptionSet = sparseProject.ToChannelDescriptions();
            var singleFile            = exportParameters.FileGranularity == FileGranularity.SingleFile;

            TimeSpan filePeriod;

            if (singleFile)
            {
                filePeriod = exportParameters.End - exportParameters.Begin;
            }
            else
            {
                filePeriod = TimeSpan.FromSeconds((int)exportParameters.FileGranularity);
            }

            DataWriterExtensionSettingsBase settings;
            DataWriterExtensionLogicBase    dataWriter;

            switch (exportParameters.FileFormat)
            {
            case FileFormat.CSV:

                settings = new CsvSettings()
                {
                    FilePeriod         = filePeriod,
                    SingleFile         = singleFile,
                    RowIndexFormat     = exportParameters.CsvRowIndexFormat,
                    SignificantFigures = exportParameters.CsvSignificantFigures,
                };

                dataWriter = new CsvWriter((CsvSettings)settings, NullLogger.Instance);

                break;

            case FileFormat.FAMOS:

                settings = new FamosSettings()
                {
                    FilePeriod = filePeriod,
                    SingleFile = singleFile,
                };

                dataWriter = new FamosWriter((FamosSettings)settings, NullLogger.Instance);

                break;

            case FileFormat.MAT73:

                settings = new Mat73Settings()
                {
                    FilePeriod = filePeriod,
                    SingleFile = singleFile,
                };

                dataWriter = new Mat73Writer((Mat73Settings)settings, NullLogger.Instance);

                break;

            default:
                throw new NotImplementedException();
            }

            // create custom meta data
            var customMetadataEntrySet = new List <CustomMetadataEntry>();

            //customMetadataEntrySet.Add(new CustomMetadataEntry("system_name", "Nexus Explorer", CustomMetadataEntryLevel.File));

            if (!string.IsNullOrWhiteSpace(sparseProject.License.FileMessage))
            {
                customMetadataEntrySet.Add(new CustomMetadataEntry("license", sparseProject.License.FileMessage, CustomMetadataEntryLevel.Project));
            }

            // initialize data writer
            var projectName_splitted = sparseProject.Id.Split('/');
            var dataWriterContext    = new DataWriterContext("Nexus Explorer", directoryPath, new NexusProjectDescription(Guid.Empty, 0, projectName_splitted[1], projectName_splitted[2], projectName_splitted[3]), customMetadataEntrySet);

            dataWriter.Configure(dataWriterContext, channelDescriptionSet);

            try
            {
                // create temp files
                this.CreateFiles(user, dataWriter, exportParameters, sparseProject, cancellationToken);
                dataWriter.Dispose();
            }
            finally
            {
                dataWriter.Dispose();
            }
        }
Exemplo n.º 6
0
        public Task <string> ExportDataAsync(ExportParameters exportParameters,
                                             List <DatasetInfo> datasets,
                                             CancellationToken cancellationToken)
        {
            if (!datasets.Any() || exportParameters.Begin == exportParameters.End)
            {
                return(Task.FromResult(string.Empty));
            }

            var username = _userIdService.GetUserId();

            // find sample rate
            var sampleRates = datasets.Select(dataset => dataset.GetSampleRate());

            if (sampleRates.Select(sampleRate => sampleRate.SamplesPerSecond).Distinct().Count() > 1)
            {
                throw new ValidationException("Channels with different sample rates have been requested.");
            }

            return(Task.Run(() =>
            {
                var sampleRate = sampleRates.First();

                // log
                var message = $"User '{username}' exports data: {exportParameters.Begin.ToISO8601()} to {exportParameters.End.ToISO8601()} ... ";
                _logger.LogInformation(message);

                try
                {
                    // convert datasets into projects
                    var projectIds = datasets.Select(dataset => dataset.Parent.Parent.Id).Distinct();
                    var projectContainers = _databaseManager.Database.ProjectContainers
                                            .Where(projectContainer => projectIds.Contains(projectContainer.Id));

                    var sparseProjects = projectContainers.Select(projectContainer =>
                    {
                        var currentDatasets = datasets.Where(dataset => dataset.Parent.Parent.Id == projectContainer.Id).ToList();
                        return projectContainer.ToSparseProject(currentDatasets);
                    });

                    // start
                    var zipFilePath = Path.Combine(_options.ExportDirectoryPath, $"Nexus_{exportParameters.Begin.ToString("yyyy-MM-ddTHH-mm")}_{sampleRate.ToUnitString(underscore: true)}_{Guid.NewGuid().ToString().Substring(0, 8)}.zip");
                    using var zipArchive = ZipFile.Open(zipFilePath, ZipArchiveMode.Create);

                    // create tmp/target directory
                    var directoryPath = exportParameters.ExportMode switch
                    {
                        ExportMode.Web => Path.Combine(Path.GetTempPath(), "Nexus", Guid.NewGuid().ToString()),
                        ExportMode.Local => Path.Combine(_options.ExportDirectoryPath, $"Nexus_{exportParameters.Begin.ToString("yyyy-MM-ddTHH-mm")}_{sampleRate.ToUnitString(underscore: true)}_{Guid.NewGuid().ToString().Substring(0, 8)}"),
                        _ => throw new Exception("Unsupported export mode.")
                    };

                    Directory.CreateDirectory(directoryPath);

                    foreach (var sparseProject in sparseProjects)
                    {
                        this.CreateFiles(_userIdService.User, exportParameters, sparseProject, directoryPath, cancellationToken);
                    }

                    switch (exportParameters.ExportMode)
                    {
                    case ExportMode.Web:
                        this.WriteZipArchiveEntries(zipArchive, directoryPath, cancellationToken);
                        break;

                    case ExportMode.Local:
                        break;

                    default:
                        break;
                    }

                    _logger.LogInformation($"{message} Done.");

                    return $"export/{Path.GetFileName(zipFilePath)}";
                }
                catch (Exception ex)
                {
                    _logger.LogError($"{message} Fail. Reason: {ex.GetFullMessage()}");
                    throw;
                }
            }, cancellationToken));
        }
Exemplo n.º 7
0
 public World()
 {
     ExportParameters = new ExportParameters();
     Parameters       = new WorldParameters();
     BaseField        = new FieldObjects.BaseField();
 }
 /// <summary>
 /// Have a dummy export manager - we just need the DLLs to be exported
 /// </summary>
 /// <param name="exportParameters"></param>
 /// <returns></returns>
 public override ExportManager GenerateExportManager(ExportParameters exportParameters)
 {
     return(new SiteLicenseExportManager(exportParameters));
 }
Exemplo n.º 9
0
 public void RunExport(ExportParameters parameters)
 {
     ExportStrings(parameters);
 }
        public void ParseXml()
        {
            XmlDocument xmlDoc     = XmlReaderWriterHelper.ParseXmlDocument(m_ConfigurationFilePath, false, false);
            XmlNode     importNode = XmlDocumentHelper.GetFirstChildElementOrSelfWithName(xmlDoc.DocumentElement, true, "import", xmlDoc.DocumentElement.NamespaceURI);

            foreach (XmlNode n in importNode.ChildNodes)
            {
                string innerText = n.InnerText;

                if (n.LocalName == "obiprojectdirectory")
                {
                    m_ObiProjectDirectoryPath = innerText.Trim();
                }
                else if (n.LocalName == "audiosamplerate")
                {
                    string strSampleRate = innerText.Trim();
                    m_ImportSampleRate     = int.Parse(strSampleRate);
                    m_ImportSampleRateEnum = strSampleRate == "44100" ? AudioLib.SampleRate.Hz44100 :
                                             strSampleRate == "22050" ? AudioLib.SampleRate.Hz22050
                        : AudioLib.SampleRate.Hz11025;
                }
                else if (n.LocalName == "audiochannels")
                {
                    string strChannels = innerText.Trim();
                    m_ImportChannels = int.Parse(strChannels.Trim());
                }
            }

            foreach (XmlNode exportNode in XmlDocumentHelper.GetChildrenElementsOrSelfWithName(xmlDoc.DocumentElement, true, "export", xmlDoc.DocumentElement.NamespaceURI, false))
            {
                ExportFormat exportStandards                      = ExportFormat.DAISY3_0;
                string       exportDirectory                      = null;
                bool         encodeExportedAudioFiles             = false;
                AudioLib.AudioFileFormats encodingAudioFileFormat = AudioLib.AudioFileFormats.WAV;
                AudioLib.SampleRate       exportSampleRate        = AudioLib.SampleRate.Hz44100;
                int    exportChannels        = 1;
                double exportEncodingBitrate = 64;
                foreach (XmlNode n in exportNode.ChildNodes)
                {
                    if (n.LocalName == "directory")
                    {
                        exportDirectory = n.InnerText.Trim();
                    }
                    else if (n.LocalName == "standard")
                    {
                        string strStandard = n.InnerText.Trim();
                        exportStandards = strStandard == "daisy2.02" ? ExportFormat.DAISY2_02 :
                                          strStandard == "daisy3" ? ExportFormat.DAISY3_0 :
                                          ExportFormat.EPUB3;
                    }
                    else if (n.LocalName == "audioencoding")
                    {
                        string strEncoding = n.InnerText.Trim();
                        encodeExportedAudioFiles = strEncoding.ToLower() != "wav";

                        if (encodeExportedAudioFiles)
                        {
                            encodingAudioFileFormat = (strEncoding.ToLower() == "mp4" || strEncoding.ToLower() == "m4a") ? AudioLib.AudioFileFormats.MP4 :
                                                      AudioLib.AudioFileFormats.MP3;
                        }
                    }
                    else if (n.LocalName == "bitrate")
                    {
                        string strBitrate = n.InnerText.Trim();
                        exportEncodingBitrate = int.Parse(strBitrate);
                    }
                    else if (n.LocalName == "audiosamplerate")
                    {
                        string strSampleRate = n.InnerText;
                        exportSampleRate = strSampleRate == "44100" ? AudioLib.SampleRate.Hz44100 :
                                           strSampleRate == "22050" ? AudioLib.SampleRate.Hz22050
                            : AudioLib.SampleRate.Hz11025;
                    }
                    else if (n.LocalName == "audiochannels")
                    {
                        string strChannels = n.InnerText;
                        exportChannels = int.Parse(strChannels.Trim());
                    }
                }
                ExportParameters exportObject = new ExportParameters(exportStandards,
                                                                     exportDirectory,
                                                                     encodeExportedAudioFiles,
                                                                     encodingAudioFileFormat,
                                                                     exportSampleRate,
                                                                     exportChannels,
                                                                     exportEncodingBitrate);

                // assign export parameters to respective properties
                if (exportObject.ExportStandards == ExportFormat.DAISY3_0)
                {
                    m_DAISY3ExportParameters = exportObject;
                }
                else if (exportObject.ExportStandards == ExportFormat.DAISY2_02)
                {
                    m_DAISY202ExportParameters = exportObject;
                }
                else if (exportObject.ExportStandards == ExportFormat.EPUB3)
                {
                    m_EPUB3ExportParameters = exportObject;
                }

                Console.WriteLine("Config file export parameters: " + exportObject.ExportStandards);
                Console.WriteLine("export channels: " + exportObject.ExportChannels + ", directory:" + exportObject.ExportDirectory);
                Console.WriteLine("encoding: " + exportObject.EncodeExportedAudioFiles + " " + exportObject.EncodingAudioFileFormat + ", bit rate:" + exportObject.ExportEncodingBitrate + ", sample rate:" + exportObject.ExportSampleRate);
            }
            xmlDoc = null;
        }
Exemplo n.º 11
0
 /// <summary>
 /// Have a dummy export manager - we just need the DLLs to be exported
 /// </summary>
 /// <param name="exportParameters"></param>
 /// <returns></returns>
 public override ExportManager GenerateExportManager(ExportParameters exportParameters)
 {
     return(new TimelineViewItemExportManager(exportParameters));
 }
Exemplo n.º 12
0
        public ActionResult <ExportJob> CreateExportJob(ExportParameters parameters)
        {
            if (_databaseManager.Database == null)
            {
                return(this.StatusCode(503, "The database has not been loaded yet."));
            }

            parameters.Begin = parameters.Begin.ToUniversalTime();
            parameters.End   = parameters.End.ToUniversalTime();

            // translate channel paths to datasets
            List <DatasetInfo> datasets;

            try
            {
                datasets = parameters.ChannelPaths.Select(channelPath =>
                {
                    if (!_databaseManager.Database.TryFindDataset(channelPath, out var dataset))
                    {
                        throw new ValidationException($"Could not find the channel with path '{channelPath}'.");
                    }

                    return(dataset);
                }).ToList();
            }
            catch (ValidationException ex)
            {
                return(this.UnprocessableEntity(ex.GetFullMessage(includeStackTrace: false)));
            }

            // check that there is anything to export
            if (!datasets.Any())
            {
                return(this.BadRequest("The list of channel paths is empty."));
            }

            // security check
            var projectIds = datasets.Select(dataset => dataset.Parent.Parent.Id).Distinct();

            foreach (var projectId in projectIds)
            {
                if (!Utilities.IsProjectAccessible(this.HttpContext.User, projectId, _databaseManager.Database))
                {
                    return(this.Unauthorized($"The current user is not authorized to access project '{projectId}'."));
                }
            }

            //
            var job = new ExportJob()
            {
                Owner      = this.User.Identity.Name,
                Parameters = parameters
            };

            var dataService = _serviceProvider.GetRequiredService <DataService>();

            try
            {
                var jobControl = _exportJobService.AddJob(job, dataService.Progress, (jobControl, cts) =>
                {
                    var userIdService = _serviceProvider.GetRequiredService <UserIdService>();
                    var task          = dataService.ExportDataAsync(parameters, datasets, cts.Token);

                    return(task);
                });

                return(this.Accepted($"{this.GetBasePath()}{this.Request.Path}/{jobControl.Job.Id}/status", jobControl.Job));
            }
            catch (ValidationException ex)
            {
                return(this.UnprocessableEntity(ex.GetFullMessage(includeStackTrace: false)));
            }
        }
Exemplo n.º 13
0
 public TimelineViewItemExportManager(ExportParameters exportParameters)
     : base(exportParameters)
 {
 }
Exemplo n.º 14
0
 private static void CopyGltfTexture(string sourcePath, string destPath, ILoggingProvider logger, ExportParameters exportParameters)
 {
     TextureUtilities.CopyTexture(sourcePath, destPath, exportParameters.txtQuality, logger);
 }
Exemplo n.º 15
0
        private async Task <bool> DoExport()
        {
            Loader.SetBoolProperty(chkCopyTexturesProperty, chkCopyTextures.Checked);
            Loader.SetBoolProperty(chkHiddenProperty, chkHidden.Checked);
            Loader.SetBoolProperty(chkOnlySelectedProperty, chkOnlySelected.Checked);
            Loader.SetBoolProperty(chkManifestProperty, chkManifest.Checked);
            Loader.SetBoolProperty(chkAutoSaveProperty, chkAutoSave.Checked);
            Loader.SetBoolProperty(chkOptimizeVerticesProperty, chkOptimizeVertices.Checked);
            Loader.SetBoolProperty(chkExportTangentsProperty, chkExportTangents.Checked);
            Loader.SetBoolProperty(chkDracoCompressionProperty, chkDracoCompression.Checked);
            Loader.SetBoolProperty(chkExportSkinProperty, chkExportSkin.Checked);
            Loader.SetBoolProperty(chkExportMorphNormalProperty, chkExportMorphNormal.Checked);
            Loader.SetBoolProperty(chkExportMorphTangentProperty, chkExportMorphTangent.Checked);
            Loader.SetBoolProperty(chkExportKHRLightsPunctualProperty, chkExportKHRLightsPunctual.Checked);
            Loader.SetBoolProperty(chkExportKHRTextureTransformProperty, chkExportKHRTextureTransform.Checked);
            Loader.SetBoolProperty(chkExportKHRMaterialsUnlitProperty, chkExportKHRMaterialsUnlit.Checked);
            Loader.SetBoolProperty(chkBakeAnimationFramesProperty, chkBakeAnimationFrames.Checked);
            Loader.SetBoolProperty(chkExportAnimationsProperty, chkExportAnimations.Checked);
            Loader.SetBoolProperty(chkExportAnimationsOnlyProperty, chkExportAnimationsOnly.Checked);
            Loader.SetBoolProperty(chkExportMaterialsProperty, chkExportMaterials.Checked);
            Loader.SetBoolProperty(chkExportTexturesProperty, chkExportTextures.Checked);

            Loader.SetBoolProperty(PBRFullPropertyName, chkFullPBR.Checked);
            Loader.SetBoolProperty(PBRNoLightPropertyName, chkNoAutoLight.Checked);
            Loader.SetBoolProperty(PBRDefaultSkyboxName, chkDefaultSkybox.Checked);

            /*Tools.UpdateComboBox(comboOutputFormat, Loader.Core.RootNode, "babylonjs_outputFormat");
             *
             * Loader.Core.RootNode.SetLocalData(txtFilename.Text);*/

            exporter = new BabylonExporter();

            treeView.Nodes.Clear();

            exporter.OnExportProgressChanged += progress =>
            {
                progressBar.Value = progress;
                Application.DoEvents();
            };

            exporter.OnWarning += (warning, rank) =>
            {
                try
                {
                    currentNode = CreateTreeNode(rank, warning, Color.DarkOrange);
                    currentNode.EnsureVisible();
                }
                catch
                {
                }
                Application.DoEvents();
            };

            exporter.OnError += (error, rank) =>
            {
                try
                {
                    currentNode = CreateTreeNode(rank, error, Color.Red);
                    currentNode.EnsureVisible();
                }
                catch
                {
                }
                Application.DoEvents();
            };

            exporter.OnMessage += (message, color, rank, emphasis) =>
            {
                try
                {
                    currentNode = CreateTreeNode(rank, message, color);

                    if (emphasis)
                    {
                        currentNode.EnsureVisible();
                    }
                }
                catch
                {
                }
                Application.DoEvents();
            };

            exporter.OnVerbose += (message, color, rank, emphasis) =>
            {
                try
                {
                    currentNode = CreateTreeNode(rank, message, color);

                    if (emphasis)
                    {
                        currentNode.EnsureVisible();
                    }
                }
                catch
                {
                }
                Application.DoEvents();
            };

            butExport.Enabled       = false;
            butExportAndRun.Enabled = false;
            butCancel.Enabled       = true;

            bool success = true;

            try
            {
                var scaleFactorParsed    = 1.0f;
                var textureQualityParsed = 100L;
                try
                {
                    scaleFactorParsed = float.Parse(txtScaleFactor.Text);
                }
                catch (Exception e)
                {
                    throw new InvalidDataException(String.Format("Invalid Scale Factor value: {0}", txtScaleFactor.Text));
                }
                try
                {
                    textureQualityParsed = long.Parse(txtQuality.Text);
                }
                catch (Exception e)
                {
                    throw new InvalidDataException(String.Format("Invalid Texture Quality value: {0}", txtScaleFactor.Text));
                }

                var exportParameters = new ExportParameters
                {
                    outputPath                = txtFilename.Text,
                    outputFormat              = comboOutputFormat.SelectedItem.ToString(),
                    generateManifest          = chkManifest.Checked,
                    exportOnlySelected        = chkOnlySelected.Checked,
                    autoSaveSceneFile         = chkAutoSave.Checked,
                    exportHiddenObjects       = chkHidden.Checked,
                    writeTextures             = chkCopyTextures.Checked,
                    overwriteTextures         = chkCopyTextures.Checked,
                    optimizeVertices          = chkOptimizeVertices.Checked,
                    exportTangents            = chkExportTangents.Checked,
                    scaleFactor               = scaleFactorParsed,
                    exportSkins               = chkExportSkin.Checked,
                    txtQuality                = textureQualityParsed,
                    dracoCompression          = chkDracoCompression.Checked,
                    exportMaterials           = chkExportMaterials.Checked,
                    exportMorphNormals        = chkExportMorphNormal.Checked,
                    exportMorphTangents       = chkExportMorphTangent.Checked,
                    exportTextures            = chkExportTextures.Checked,
                    enableKHRLightsPunctual   = chkExportKHRLightsPunctual.Checked,
                    enableKHRTextureTransform = chkExportKHRTextureTransform.Checked,
                    enableKHRMaterialsUnlit   = chkExportKHRMaterialsUnlit.Checked,
                    bakeAnimationFrames       = chkBakeAnimationFrames.Checked,
                    exportAnimations          = chkExportAnimations.Checked,
                    exportAnimationsOnly      = chkExportAnimationsOnly.Checked,
                    pbrFull             = chkFullPBR.Checked,
                    pbrNoLight          = chkNoAutoLight.Checked,
                    createDefaultSkybox = chkDefaultSkybox.Checked,
                    pbrEnvironment      = txtEnvironmentName.Text
                };
                exporter.Export(exportParameters);
            }
            catch (OperationCanceledException)
            {
                progressBar.Value = 0;
                success           = false;
            }
            catch (Exception ex)
            {
                currentNode = CreateTreeNode(0, "Export cancelled: " + ex.Message, Color.Red);
                currentNode = CreateTreeNode(1, ex.ToString(), Color.Red);
                currentNode.EnsureVisible();

                progressBar.Value = 0;
                success           = false;
            }

            butCancel.Enabled       = false;
            butExport.Enabled       = true;
            butExportAndRun.Enabled = WebServer.IsSupported;

            BringToFront();

            return(success);
        }
Exemplo n.º 16
0
        public void ExportGltf(ExportParameters exportParameters, BabylonScene babylonScene, string outputDirectory, string outputFileName, bool generateBinary, ILoggingProvider logger)
        {
            this.exportParameters = exportParameters;
            this.logger           = logger;

            logger.RaiseMessage("GLTFExporter | Exportation started", Color.Blue);
#if DEBUG
            var watch = new Stopwatch();
            watch.Start();
#endif
            this.babylonScene = babylonScene;

            // Force output file extension to be gltf
            outputFileName = Path.ChangeExtension(outputFileName, "gltf");

            // Update path of output .gltf file to include subdirectory
            var outputFile = Path.Combine(outputDirectory, outputFileName);

            float progressionStep;
            var   progression = 0.0f;
            logger.ReportProgressChanged((int)progression);

            babylonMaterialsToExport = new List <BabylonMaterial>();

            var gltf = new GLTF(outputFile);

            // Asset
            gltf.asset = new GLTFAsset
            {
                version = "2.0"
                          // no minVersion
            };

            var softwarePackageName = babylonScene.producer != null ? babylonScene.producer.name : "";
            var softwareVersion     = babylonScene.producer != null ? babylonScene.producer.version : "";
            var exporterVersion     = babylonScene.producer != null ? babylonScene.producer.exporter_version : "";

            gltf.asset.generator = $"babylon.js glTF exporter for {softwarePackageName} {softwareVersion} v{exporterVersion}";

            // Scene
            gltf.scene = 0;

            // Scenes
            GLTFScene scene = new GLTFScene();
            ExportGLTFExtension(babylonScene, ref scene, gltf);
            GLTFScene[] scenes = { scene };
            gltf.scenes = scenes;

            // Initialization
            initBabylonNodes(babylonScene, gltf);


            // Root nodes
            logger.RaiseMessage("GLTFExporter | Exporting nodes");
            progression = 30.0f;
            logger.ReportProgressChanged((int)progression);
            List <BabylonNode> babylonRootNodes = babylonNodes.FindAll(node => node.parentId == null);
            progressionStep          = 30.0f / babylonRootNodes.Count;
            alreadyExportedSkeletons = new Dictionary <BabylonSkeleton, BabylonSkeletonExportData>();
            nodeToGltfNodeMap        = new Dictionary <BabylonNode, GLTFNode>();
            NbNodesByName            = new Dictionary <string, int>();
            babylonRootNodes.ForEach(babylonNode =>
            {
                exportNodeRec(babylonNode, gltf, babylonScene);
                progression += progressionStep;
                logger.ReportProgressChanged((int)progression);
                logger.CheckCancelled();
            });


            // Meshes
            logger.RaiseMessage("GLTFExporter | Exporting meshes");
            progression = 10.0f;
            logger.ReportProgressChanged((int)progression);
            progressionStep = 40.0f / babylonScene.meshes.Length;
            foreach (var babylonMesh in babylonScene.meshes)
            {
                ExportMesh(babylonMesh, gltf, babylonScene);
                progression += progressionStep;
                logger.ReportProgressChanged((int)progression);
                logger.CheckCancelled();
            }
#if DEBUG
            var meshesExportTime = watch.ElapsedMilliseconds / 1000.0;
            logger.RaiseMessage(string.Format("GLTFMeshes exported in {0:0.00}s", meshesExportTime), Color.Blue);
#endif

            //Mesh Skins, light and Cameras
            logger.RaiseMessage("GLTFExporter | Exporting skins, lights and cameras");
            progression = 50.0f;
            logger.ReportProgressChanged((int)progression);
            progressionStep = 50.0f / babylonRootNodes.Count;
            babylonRootNodes.ForEach(babylonNode =>
            {
                exportNodeTypeRec(babylonNode, gltf, babylonScene);
                progression += progressionStep;
                logger.ReportProgressChanged((int)progression);
                logger.CheckCancelled();
            });
#if DEBUG
            var nodesExportTime = watch.ElapsedMilliseconds / 1000.0 - meshesExportTime;
            logger.RaiseMessage(string.Format("GLTFNodes exported in {0:0.00}s", nodesExportTime), Color.Blue);
#endif
            // Materials
            progression = 70.0f;
            logger.ReportProgressChanged((int)progression);
            logger.RaiseMessage("GLTFExporter | Exporting materials");
            foreach (var babylonMaterial in babylonMaterialsToExport)
            {
                ExportMaterial(babylonMaterial, gltf);
                logger.CheckCancelled();
            }
            ;
            logger.RaiseMessage(string.Format("GLTFExporter | Nb materials exported: {0}", gltf.MaterialsList.Count), Color.Gray, 1);
#if DEBUG
            var materialsExportTime = watch.ElapsedMilliseconds / 1000.0 - nodesExportTime;
            logger.RaiseMessage(string.Format("GLTFMaterials exported in {0:0.00}s", materialsExportTime), Color.Blue);
#endif
            // Animations
            progression = 90.0f;
            logger.ReportProgressChanged((int)progression);
            logger.RaiseMessage("GLTFExporter | Exporting Animations");
            ExportAnimationGroups(gltf, babylonScene);
#if DEBUG
            var animationGroupsExportTime = watch.ElapsedMilliseconds / 1000.0 - materialsExportTime;
            logger.RaiseMessage(string.Format("GLTFAnimations exported in {0:0.00}s", animationGroupsExportTime), Color.Blue);
#endif
            // Prepare buffers
            gltf.BuffersList.ForEach(buffer =>
            {
                buffer.BufferViews.ForEach(bufferView =>
                {
                    bufferView.Accessors.ForEach(accessor =>
                    {
                        // Chunk must be padded with trailing zeros (0x00) to satisfy alignment requirements
                        accessor.bytesList = new List <byte>(padChunk(accessor.bytesList.ToArray(), 4, 0x00));

                        // Update byte properties
                        accessor.byteOffset    = bufferView.byteLength;
                        bufferView.byteLength += accessor.bytesList.Count;
                        // Merge bytes
                        bufferView.bytesList.AddRange(accessor.bytesList);
                    });
                    // Update byte properties
                    bufferView.byteOffset = buffer.byteLength;
                    buffer.byteLength    += bufferView.bytesList.Count;
                    // Merge bytes
                    buffer.bytesList.AddRange(bufferView.bytesList);
                });
            });

            // Cast lists to arrays
            gltf.Prepare();

            // Output
            logger.RaiseMessage("GLTFExporter | Saving to output file");
            if (!generateBinary)
            {
                // Write .gltf file
                string outputGltfFile = Path.ChangeExtension(outputFile, "gltf");
                File.WriteAllText(outputGltfFile, gltfToJson(gltf));

                // Write .bin file
                string outputBinaryFile = Path.ChangeExtension(outputFile, "bin");
                using (BinaryWriter writer = new BinaryWriter(File.Open(outputBinaryFile, FileMode.Create)))
                {
                    gltf.BuffersList.ForEach(buffer =>
                    {
                        buffer.bytesList.ForEach(b => writer.Write(b));
                    });
                }
            }
            else
            {
                // Export glTF data to binary format .glb

                // Header
                UInt32 magic   = 0x46546C67; // ASCII code for glTF
                UInt32 version = 2;
                UInt32 length  = 12;         // Header length

                // --- JSON chunk ---
                UInt32 chunkTypeJson = 0x4E4F534A; // ASCII code for JSON
                // Remove buffers uri
                foreach (GLTFBuffer gltfBuffer in gltf.BuffersList)
                {
                    gltfBuffer.uri = null;
                }
                // Switch images to binary
                var imageBufferViews = SwitchImagesFromUriToBinary(gltf);
                imageBufferViews.ForEach(imageBufferView =>
                {
                    imageBufferView.Buffer.bytesList.AddRange(imageBufferView.bytesList);
                });
                gltf.Prepare();
                // Serialize gltf data to JSON string then convert it to bytes
                byte[] chunkDataJson = Encoding.ASCII.GetBytes(gltfToJson(gltf));
                // JSON chunk must be padded with trailing Space chars (0x20) to satisfy alignment requirements
                chunkDataJson = padChunk(chunkDataJson, 4, 0x20);
                UInt32 chunkLengthJson = (UInt32)chunkDataJson.Length;
                length += chunkLengthJson + 8; // 8 = JSON chunk header length

                // bin chunk
                UInt32 chunkTypeBin   = 0x004E4942; // ASCII code for BIN
                UInt32 chunkLengthBin = 0;
                if (gltf.BuffersList.Count > 0)
                {
                    foreach (GLTFBuffer gltfBuffer in gltf.BuffersList)
                    {
                        chunkLengthBin += (uint)gltfBuffer.byteLength;
                    }
                    length += chunkLengthBin + 8; // 8 = bin chunk header length
                }

                // Write binary file
                string outputGlbFile = Path.ChangeExtension(outputFile, "glb");
                using (BinaryWriter writer = new BinaryWriter(File.Open(outputGlbFile, FileMode.Create)))
                {
                    // Header
                    writer.Write(magic);
                    writer.Write(version);
                    writer.Write(length);

                    // JSON chunk
                    writer.Write(chunkLengthJson);
                    writer.Write(chunkTypeJson);
                    writer.Write(chunkDataJson);

                    // bin chunk
                    if (gltf.BuffersList.Count > 0)
                    {
                        writer.Write(chunkLengthBin);
                        writer.Write(chunkTypeBin);
                        gltf.BuffersList[0].bytesList.ForEach(b => writer.Write(b));
                    }
                };
            }

            // Draco compression
            if (exportParameters.dracoCompression)
            {
                logger.RaiseMessage("GLTFExporter | Draco compression");

                try
                {
                    Process gltfPipeline = new Process();

                    // Hide the cmd window that show the gltf-pipeline result
                    //gltfPipeline.StartInfo.UseShellExecute = false;
                    //gltfPipeline.StartInfo.CreateNoWindow = true;
                    gltfPipeline.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

                    string arg;
                    if (generateBinary)
                    {
                        string outputGlbFile = Path.ChangeExtension(outputFile, "glb");
                        arg = $" -i {outputGlbFile} -o {outputGlbFile} -d";
                    }
                    else
                    {
                        string outputGltfFile = Path.ChangeExtension(outputFile, "gltf");
                        arg = $" -i {outputGltfFile} -o {outputGltfFile} -d -s";
                    }
                    gltfPipeline.StartInfo.FileName  = "gltf-pipeline.cmd";
                    gltfPipeline.StartInfo.Arguments = arg;

                    gltfPipeline.Start();
                    gltfPipeline.WaitForExit();
                }
                catch
                {
                    logger.RaiseError("gltf-pipeline module not found.", 1);
                    logger.RaiseError("The exported file wasn't compressed.");
                }
            }

            logger.ReportProgressChanged(100);
        }
Exemplo n.º 17
0
 public Exporter(MainModel model, ExportParameters parameters)
 {
     this.Data = new ExportData(model, parameters);
 }