static public int ProOptimizeMesh() { int count = 0; // Run entire code block with try/catch to help determine errors try { // read input parameters from JSON file InputParams inputParams = JsonConvert.DeserializeObject <InputParams>(File.ReadAllText("params.json")); /*InputParams inputParams = new InputParams * { * VertexPercents = new List<float> { 0.225F, 0.426F, 0.752F, 0.895F }, * KeepNormals = false, * CollapseStack = false * };*/ List <string> solution_files = new List <string> { }; foreach (float n in inputParams.VertexPercents) { string status = ParameterChanger.UpdateNodes(n, inputParams.KeepNormals, inputParams.CollapseStack); if (status != null) { count += 1; // number of solutions successfully created as new scene files. // add MAX files solution_files.Add(status); // add FBX files status = status.Replace(".max", ".fbx"); solution_files.Add(status); } } if (solution_files.Count > 0) { string zipName = @".\output.zip"; using (ZipArchive newZipFile = ZipFile.Open(zipName, ZipArchiveMode.Create)) { foreach (string file in solution_files) { newZipFile.CreateEntryFromFile(file, System.IO.Path.GetFileName(file)); } } } } catch (Exception e) { LogTrace("Exception Error: " + e.Message); return(-1); //fail } LogTrace("Changed {0} scenes.", count); return(count); // 0+ means success, and how many objects were changed. }
static public int ModifyWindowWidthHeight() { int count = 0; // Run entire code block with try/catch to help determine errors try { // read input parameters from JSON file InputParams inputParams = JsonConvert.DeserializeObject <InputParams>(File.ReadAllText("params.json")); count = ParameterChanger.UpdateWindowNodes(inputParams.Width, inputParams.Height); } catch (Exception e) { LogTrace("Exception Error: " + e.Message); return(-1); //fail } LogTrace("Changed {0} window objects.", count); return(count); // 0+ means success, and how many objects were changed. }