public void Render(string graphPath, string exportPath, int type) { Graph g = graph = LoadGraph(graphPath); Exporter exporter = null; if (g == null) { return; } switch (type) { case 0: exporter = new SeparateExporter(g); break; case 1: exporter = new Unity5Exporter(g); break; case 2: exporter = new Unreal4Exporter(g); break; default: exporter = new SeparateExporter(g); break; } exporter.ExportSync(exportPath); }
protected void ExportTextures(string path, ExportTypes type) { if (graph.Graph.OutputNodes.Count == 0) { MessageBox.Show("No image output nodes to export"); return; } ProgressView.Visibility = Visibility.Visible; Task.Delay(10).ContinueWith(t => { App.Current.Dispatcher.Invoke(() => { Exporter exporter = null; switch (type) { case ExportTypes.SeparateFiles: exporter = new SeparateExporter(graph.Graph); break; case ExportTypes.Unity5: exporter = new Unity5Exporter(graph.Graph); break; case ExportTypes.UnrealEngine4: exporter = new Unreal4Exporter(graph.Graph); break; } if (exporter == null) { DialogResult = false; return; } exporter.OnProgress += Exporter_OnProgress; Task extask = exporter.Export(path); Task.Run(async() => { await extask; App.Current.Dispatcher.Invoke(() => { DialogResult = true; }); }); }); }); }