public async Task<IHttpActionResult> DownloadWT(WTModel model) { try { if (!ModelState.IsValid) return BadRequest(ModelState); using (WillTestament repo = new WillTestament()) { await repo.DownloadWTForm(model); } return Ok(); } catch (Exception ex) { Helper.ErrorLogging.LogError(ex); return InternalServerError(ex); } }
static void Main(string[] args) { Console.Title = "WildTangent MDL/SCN Converter"; //deal with args if (args.Length == 0 || args.Contains("-help")) { Help(); return; } string inFilePath = args[0]; if (!System.IO.File.Exists(inFilePath)) { Console.WriteLine($"Error: input file '{System.IO.Path.GetFileName(inFilePath)}' doesn't exist."); Console.Read(); return; } bool exportAsDae = true; bool exportAsObj = args.Contains("-obj"); exportAsDae = !exportAsObj; bool stopAtEnd = args.Contains("-dontquit"); bool useAbsolutePaths = args.Contains("-abspaths") || args.Contains("-absolutepaths"); float scale = 0.01f; for (int i = 0; i < args.Length - 1; i++) { if (args[i] == "-scale") { string scaleArg = args[i + 1]; float.TryParse(scaleArg, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out scale); } } //load model var model = WTModel.ReadBinary(inFilePath); foreach (var mtl in model.Materials) { Console.WriteLine(mtl.Value.Name); mtl.Value.ListSlots(model); } //process string outFileName = System.IO.Path.GetFileNameWithoutExtension(inFilePath); string sourcePath = System.IO.Path.GetDirectoryName(inFilePath); Console.WriteLine($"Converting {outFileName}..."); if (exportAsDae) { var converter = new DAEExporter(model, useAbsolutePaths) { SourcePath = sourcePath, Scale = Vector3.One * scale }; converter.Scale.X *= -1f; converter.Export($"{outFileName}.dae"); } else if (exportAsObj) { var converter = new OBJExporter(model, useAbsolutePaths, args.Contains("-uv2")) { SourcePath = sourcePath, Scale = Vector3.One * scale }; converter.Export($"{outFileName}.obj"); } Console.WriteLine("Conversion complete!"); if (stopAtEnd) { Console.Read(); } }
public OBJExporter(WTModel model, bool useAbsolutePaths, bool onlyExportUv2) { this.onlyExportSecondUv = onlyExportUv2; this.model = model; this.useAbsolutePaths = useAbsolutePaths; }
public DAEExporter(WTModel model, bool useAbsolutePaths) { this.model = model; this.useAbsolutePaths = useAbsolutePaths; }