private static async Task Export(string part, IItemModel item, XivRace desiredRace) { if (item == null) { return; } MainWin.LockProgress.Report($"Exporting {part}: {item.Name}"); Mdl _mdl = new Mdl(GameDirectory, item.DataFile); TTModel model = await _mdl.GetModel(item, desiredRace); XivRace modelRace = desiredRace; if (model == null) { List <XivRace> priority = desiredRace.GetModelPriorityList(); foreach (XivRace newRace in priority) { model = await _mdl.GetModel(item, newRace); modelRace = newRace; if (model != null) { break; } } } if (model == null) { throw new Exception($"Failed to get model for item: {item}"); } if (!Directory.Exists($"/{name}/{part}/")) { Directory.CreateDirectory($"/{name}/{part}/"); } string path = $"/{name}/{part}/{item.Name}.fbx"; if (desiredRace != modelRace) { ApplyDeformers(model, modelRace, desiredRace); } await _mdl.ExportModel(model, path); MainWin.LockProgress.Report($"Converting Normals {part}: {item.Name}"); string[] normalMaps = Directory.GetFiles(Path.GetDirectoryName(path), "*_n.png"); foreach (string normalMap in normalMaps) { string disMap = normalMap.Replace("_n.png", "_dis.png"); ProcessStartInfo processStartInfo = new ProcessStartInfo(); processStartInfo.FileName = "NormalToHeight.exe"; processStartInfo.Arguments = $"{normalMap} {disMap} -normalise"; processStartInfo.CreateNoWindow = true; processStartInfo.WindowStyle = ProcessWindowStyle.Hidden; Process proc = Process.Start(processStartInfo); while (!proc.HasExited) { await Task.Delay(100); } } }