//Processes the next job private void proccessJobs() { toggleButtons(false); while (jobs.Count > 0) { Settings.stream.WriteLine(); String currentJob = jobs.Dequeue(); Settings.stream.WriteLine("Starting next job ({0}):", currentJob); String extention = Path.GetExtension(currentJob); if (extention == ".gff" || extention == ".msh" || extention == ".mmh" || extention == ".tmsh") { GFF file = ResourceManager.findFile <GFF>(currentJob); if (file != null) { Settings.stream.WriteLine("This is a GFF file, printing struct definitions:"); Settings.stream.WriteText(ResourceManager.getGFFLayout(file)); } else { Settings.stream.WriteLine("Couldn't find {0}, skipping this job.", currentJob); } } else { //Run lightmapping! try { Scene currentScene; Settings.stream.WriteText("Loading . . . "); Stopwatch watch = Stopwatch.StartNew(); switch (Path.GetExtension(currentJob)) { case ".xml": currentScene = new XMLScene(currentJob); break; case ".lvl": currentScene = new LevelScene(currentJob); break; default: throw new LightmappingAbortedException("The scene \"" + currentJob + "\" is not a valid file format. Valid file formats are .xml and .lvl."); } watch.Stop(); Settings.stream.WriteLine("Done ({0}ms)", watch.ElapsedMilliseconds); List <LightMap> maps = Lightmapper.runLightmaps(currentScene.lightmapModels, currentScene.lights); currentScene.exportLightmaps(maps); } catch (LightmappingAbortedException e) { Settings.stream.WriteLine("Error: " + e.Message); } } } Settings.stream.WriteLine("Finished all jobs."); toggleButtons(true); }
//Processes the next job private void proccessJobs() { toggleButtons(false); while (jobs.Count > 0) { Settings.stream.WriteLine(); String currentJob = jobs.Dequeue(); Settings.stream.WriteLine("Starting next job ({0}):", currentJob); String extention = Path.GetExtension(currentJob); if (extention == ".gff" || extention == ".msh" || extention == ".mmh" || extention == ".tmsh") { GFF file = ResourceManager.findFile<GFF>(currentJob); if (file != null) { Settings.stream.WriteLine("This is a GFF file, printing struct definitions:"); Settings.stream.WriteText(ResourceManager.getGFFLayout(file)); } else { Settings.stream.WriteLine("Couldn't find {0}, skipping this job.", currentJob); } } else { //Run lightmapping! try { Scene currentScene; Settings.stream.WriteText("Loading . . . "); Stopwatch watch = Stopwatch.StartNew(); switch (Path.GetExtension(currentJob)) { case ".xml": currentScene = new XMLScene(currentJob); break; case ".lvl": currentScene = new LevelScene(currentJob); break; default: throw new LightmappingAbortedException("The scene \"" + currentJob + "\" is not a valid file format. Valid file formats are .xml and .lvl."); } watch.Stop(); Settings.stream.WriteLine("Done ({0}ms)", watch.ElapsedMilliseconds); List<LightMap> maps = Lightmapper.runLightmaps(currentScene.lightmapModels, currentScene.lights); currentScene.exportLightmaps(maps); } catch (LightmappingAbortedException e) { Settings.stream.WriteLine("Error: " + e.Message); } } } Settings.stream.WriteLine("Finished all jobs."); toggleButtons(true); }