Esempio n. 1
0
 public static void SaveModel(Root model, string outputPath, Exporter exporter)
 {
     exporter.Options.InputPath = null;
     exporter.Options.Input = model;
     exporter.Options.OutputPath = outputPath;
     exporter.Export();
 }
Esempio n. 2
0
        private void gr2BatchConvertBtn_Click(object sender, EventArgs e)
        {
            gr2BatchConvertBtn.Enabled = false;
            var exporter = new Exporter();
            UpdateCommonExporterSettings(exporter.Options);

            if (gr2BatchInputFormat.SelectedIndex == 0)
                exporter.Options.InputFormat = ExportFormat.GR2;
            else
                exporter.Options.InputFormat = ExportFormat.DAE;

            if (gr2BatchOutputFormat.SelectedIndex == 0)
                exporter.Options.OutputFormat = ExportFormat.GR2;
            else
                exporter.Options.OutputFormat = ExportFormat.DAE;

            var batchConverter = new GR2Utils();
            batchConverter.progressUpdate = GR2ProgressUpdate;
            batchConverter.conversionError = GR2ConversionError;
            batchConverter.ConvertModels(gr2BatchInputDir.Text, gr2BatchOutputDir.Text, exporter);
            gr2BatchConvertBtn.Enabled = true;
            MessageBox.Show("Batch export completed.");
        }
Esempio n. 3
0
 private void saveOutputBtn_Click(object sender, EventArgs e)
 {
     var exporter = new Exporter();
     UpdateExporterSettings(exporter.Options);
     try
     {
         exporter.Export();
         MessageBox.Show("Export completed successfully.");
     }
     catch (Exception exc)
     {
         GR2ConversionError(exporter.Options.InputPath, exporter.Options.OutputPath, exc);
     }
 }
Esempio n. 4
0
        public void ConvertModels(string inputDir, string outputDir, Exporter exporter)
        {
            this.progressUpdate("Enumerating files ...", 0, 1);
            var paths = new List<string>();
            EnumerateFiles(paths, inputDir, inputDir, "." + exporter.Options.InputFormat.ToString().ToLower());

            this.progressUpdate("Converting resources ...", 0, 1);
            for (var i = 0; i < paths.Count; i++)
            {
                var path = paths[i];
                var inPath = inputDir + "/" + path;
                var outPath = outputDir + "/" + Path.ChangeExtension(path, exporter.Options.OutputFormat.ToString().ToLower());
                var dirName = Path.GetDirectoryName(outPath);
                if (!Directory.Exists(dirName))
                {
                    Directory.CreateDirectory(dirName);
                }

                this.progressUpdate("Converting: " + inPath, i, paths.Count);
                try
                {
                    var model = LoadModel(inPath, exporter.Options.InputFormat);
                    SaveModel(model, outPath, exporter);
                }
                catch (Exception exc)
                {
                    conversionError(inPath, outPath, exc);
                }
            }
        }