public static async void run_arguments_imports(List <string> filenames) { int count = 0; Action <string> onCompletedF = (filename) => { count++; }; CCStatus.BeginOperation("reading"); foreach (string filename in filenames) { if (filename.Length > 0 && File.Exists(filename)) { MeshImporter importer = new MeshImporter(); await importer.ImportInteractive(filename, onCompletedF); } } CCStatus.EndOperation("reading"); if (count > 0) { // discard history CC.ActiveScene.History.Clear(); } else { // show an error message or something... } }
public static async void DoFileOpen(string sFilename, bool bInteractive, Action <string> onCompletedF = null) { if (string.IsNullOrEmpty(sFilename)) { return; } if (File.Exists(sFilename) == false) { CotangentUI.ShowModalMessageDialog("File Does Not Exist", "File " + sFilename + " does not exist", "Ok", null, null); return; } HaveOpenedOrImportedFile = true; if (sFilename.EndsWith(".cota", StringComparison.OrdinalIgnoreCase)) { // [TODO] make this multi threaded? OpenSceneFile(sFilename); FPlatform.SetPrefsString("LastImportPath", sFilename); } else { ClearScene(); MeshImporter importer = new MeshImporter(); CCStatus.BeginOperation("reading"); await importer.ImportInteractive(sFilename, onCompletedF); CCStatus.EndOperation("reading"); } }
public static async void DoDragDropImport(List <string> filenames) { List <string> meshFiles, sceneFiles; get_valid_filenames(filenames, out meshFiles, out sceneFiles); if (sceneFiles.Count > 0) { HaveOpenedOrImportedFile = true; DoDragDropOpen(sceneFiles); } int count = 0; Action <string> onCompletedF = (filename) => { count++; }; if (CurrentSceneIsStartupScene) { ClearScene(); } HaveOpenedOrImportedFile = true; CC.Slicer.InvalidateSlicing(); CCStatus.BeginOperation("reading"); foreach (string filename in filenames) { if (filename.Length > 0 && File.Exists(filename)) { MeshImporter importer = new MeshImporter(); await importer.ImportInteractive(filename, onCompletedF); } } CCStatus.EndOperation("reading"); if (count > 0) { CC.ActiveScene.History.PushInteractionCheckpoint(); CCActions.UpdateViewClippingBounds(); } else { // show an error message or something... } }