private void ButtonIMPORT_Click(object sender, RoutedEventArgs e) { ConsoleOutputDocument.Blocks.Clear(); var thread = new Thread(new ThreadStart(() => { try { Dispatcher.Invoke(() => { SaveConfig(); Importer = new FBX2FLVERImporter(); Importer.JOBCONFIG.MTDBNDPath = TextBoxMTDBNDPath.Text; Importer.JOBCONFIG.Preset = (FBX2FLVERImportJobConfig.FlverGamePreset)(ComboBoxGameSelect.SelectedItem); Importer.JOBCONFIG.FBXPath = TextBoxFBXPath.Text; Importer.JOBCONFIG.OutputFlverPath = TextBoxFLVEROutputMain.Text; Importer.JOBCONFIG.OutputTpfPath = TextBoxTPFOutputMain.Text; if (float.TryParse(TextBoxImportScalePercent.Text, out float scalePercent)) { Importer.JOBCONFIG.Scale = scalePercent / 100; } else { MessageBox.Show("Value for Import Scale Percent is not a number.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } Importer.JOBCONFIG.ImportSkeletonFromFLVER = TextBoxImportSkeletonFLVER.Text; Importer.InfoTextOutputted += Importer_InfoTextOutputted; Importer.WarningTextOutputted += Importer_WarningTextOutputted; Importer.ErrorTextOutputted += Importer_ErrorTextOutputted; Importer.ImportStarted += Importer_ImportStarted; Importer.ImportEnding += Importer_ImportEnding; }); Importer.Import(); //Dispatcher.Invoke(() => //{ // Importer.Import(); //}); } catch (Exception ex) { AddRunToConsole($"An error occurred while trying to import:\n\n{ex.ToString()}", Colors.Red, Colors.Black, isBold: true); } })); thread.IsBackground = true; thread.Start(); }
public static int GetTpfFormatFromDdsBytes(FBX2FLVERImporter importer, string texName, byte[] ddsBytes) { using (var ddsStream = new MemoryStream(ddsBytes)) { DXGIFormat format = DDSFile.Read(ddsStream).Format; switch (format) { //DSR: case DXGIFormat.BC1_UNorm: case DXGIFormat.BC1_UNorm_SRGB: return(0); case DXGIFormat.BC2_UNorm: case DXGIFormat.BC2_UNorm_SRGB: return(3); case DXGIFormat.BC3_UNorm: case DXGIFormat.BC3_UNorm_SRGB: return(5); case DXGIFormat.R16G16_Float: return(35); case DXGIFormat.BC5_UNorm: return(36); case DXGIFormat.BC6H_UF16: return(37); case DXGIFormat.BC7_UNorm: case DXGIFormat.BC7_UNorm_SRGB: return(38); //DS3: //case DXGIFormat.B5G5R5A1_UNorm: // return 6; //case DXGIFormat.B8G8R8A8_UNorm: //case DXGIFormat.B8G8R8A8_UNorm_SRGB: // return 9; //case DXGIFormat.B8G8R8X8_UNorm: //case DXGIFormat.B8G8R8X8_UNorm_SRGB: // return 10; //case DXGIFormat.R16G16B16A16_Float: // return 22; default: importer.PrintWarning($"Texture \"{texName}\" has an unrecognized" + $" DDS format type ({format.ToString()}) and will likely appear garbled ingame. " + $"For greatest compatibility, use DXT1 (aka BC1_UNorm) or DXT5 (aka BC3_UNorm) " + $"for your textures."); return(0); } } }
private void ButtonViewGamePresetInfo_Click(object sender, RoutedEventArgs e) { var checkImporter = new FBX2FLVERImporter(); checkImporter.JOBCONFIG.ChooseGamePreset((FBX2FLVERImportJobConfig.FlverGamePreset)(ComboBoxGameSelect.SelectedItem)); var sb = new StringBuilder(); sb.AppendLine($"Vertex Buffer Layout:\n{FBX2FLVERImportJobConfig.GetBufferLayoutStringFromStruct(checkImporter.JOBCONFIG.BufferLayout)}"); sb.AppendLine(); sb.AppendLine("FBX Material Channel Mapping:"); foreach (var kvp in checkImporter.JOBCONFIG.FBXMaterialChannelMap) { sb.AppendLine($" ['{kvp.Key}']: '{kvp.Value}'"); } sb.AppendLine(); sb.AppendLine("Hardcoded Texture Names:"); foreach (var kvp in checkImporter.JOBCONFIG.MTDHardcodedTextureChannels) { sb.AppendLine($" ['{kvp.Key}']: '{kvp.Value}'"); } sb.AppendLine(); sb.AppendLine("Misc. Settings:"); sb.AppendLine($" [FLVER Version]: 0x{checkImporter.JOBCONFIG.FlverVersion:X}"); sb.AppendLine($" [TPF Encoding]: {checkImporter.JOBCONFIG.TpfEncoding}"); sb.AppendLine($" [TPF Flag 2]: {checkImporter.JOBCONFIG.TpfFlag2}"); sb.AppendLine($" [Normal W-Field Value]: {checkImporter.JOBCONFIG.NormalWValue}"); sb.AppendLine($" [Placeholder Material Definition (MTD) Name]: '{checkImporter.JOBCONFIG.PlaceholderMaterialShaderName}.mtd'"); sb.AppendLine($" [Use Non-Relative Bone Indices]: {checkImporter.JOBCONFIG.UseDirectBoneIndices}"); sb.AppendLine($" [Unknown Value at 0x5C Offset in FLVER]: {checkImporter.JOBCONFIG.Unk0x5CValue}"); sb.AppendLine($" [Unknown Value at 0x68 Offset in FLVER]: {checkImporter.JOBCONFIG.Unk0x68Value}"); var infoWindow = new PresetInfoWindow(); infoWindow.Title = $"Details for {((FBX2FLVERImportJobConfig.FlverGamePreset)(ComboBoxGameSelect.SelectedItem))} Preset"; infoWindow.TextBlockDetails.Text = sb.ToString(); infoWindow.Owner = this; infoWindow.ShowDialog(); }
public static void NotMain(string[] args) { Console.ForegroundColor = ConsoleColor.White; var importer = new FBX2FLVERImporter(); importer.ErrorTextOutputted += Importer_ErrorTextOutputted; importer.WarningTextOutputted += Importer_WarningTextOutputted; //var flverTestLoad = SoulsFormats.FLVER.Read(@"C:\Program Files (x86)\Steam\steamapps\common\Dark Souls II Scholar of the First Sin\Game\model\parts\body\bd_6650_m-bnd\BD_6650_M.flv"); //flverTestLoad.Header.Version = 0x2000C; //flverTestLoad.Write(@"C:\Program Files (x86)\Steam\steamapps\common\Dark Souls II Scholar of the First Sin\Game\model\parts\body\bd_6650_m-bnd\BD_6650_M_ds1.flver"); //return; //DebugPrintBufferlayouts(SoulsFormats.FLVER.Read(@"C:\Program Files (x86)\Steam\steamapps\common\Dark Souls Prepare to Die Edition\DATA\chr\c4100-chrbnd\chr\c4100\c4100.flver")); //DebugPrintBufferlayouts(SoulsFormats.FLVER.Read(@"C:\Program Files (x86)\Steam\steamapps\common\Dark Souls Prepare to Die Edition\DATA\chr\c4100_bak-chrbnd\chr\c4100\c4100.flver")); //DebugPrintBufferlayouts(SoulsFormats.FLVER.Read(@"C:\Program Files (x86)\Steam\steamapps\common\Dark Souls II Scholar of the First Sin\Game\model\parts\body\bd_6650_m-bnd\BD_6650_M.flv")); //Console.WriteLine("\nPress any key to exit."); //Console.ReadKey(true); //return; //importer.JOBCONFIG.ChooseGamePreset(FBX2FLVERImportJobConfig.FlverGamePreset.DS2Static); //importer.JOBCONFIG.LoadMTDBND(@"C:\Program Files (x86)\Steam\steamapps\common\Dark Souls II Scholar of the First Sin\Game\material\allmaterialbnd.bnd", isBND4: true); //importer.JOBCONFIG.LoadFBX(@"D:\FRPG_MOD\FBX Import Test\changeling_ugs.FBX"); //importer.JOBCONFIG.OutputFlverPath = @"C:\Program Files (x86)\Steam\steamapps\common\Dark Souls II Scholar of the First Sin\Game\model\parts\weapon\wp_1800_m-bnd\WP_1800_M.flv"; //importer.JOBCONFIG.OutputTpfPath = @"C:\Program Files (x86)\Steam\steamapps\common\Dark Souls II Scholar of the First Sin\Game\model\parts\weapon\wp_1800_m-bnd\WP_1800_M.tpf"; //importer.Import(); importer.JOBCONFIG.Preset = FBX2FLVERImportJobConfig.FlverGamePreset.DS2Skinned; importer.JOBCONFIG.MTDBNDPath = @"C:\Program Files (x86)\Steam\steamapps\common\Dark Souls II Scholar of the First Sin\Game\material\allmaterialbnd.bnd"; importer.JOBCONFIG.FBXPath = @"D:\FRPG_MOD\FBX Import Test\CJDS2TEST.FBX"; importer.JOBCONFIG.Scale = 6.45f; //importer.JOBCONFIG.SkeletonRotation = new Microsoft.Xna.Framework.Vector3(0,gi 0, -Microsoft.Xna.Framework.MathHelper.PiOver2); //importer.JOBCONFIG.ImportSkeletonFromFLVER = @"C:\Program Files (x86)\Steam\steamapps\common\Dark Souls II Scholar of the First Sin\Game\model\parts\body\bd_6650_m-bnd\BD_6650_M.flv"; importer.JOBCONFIG.OutputFlverPath = @"C:\Program Files (x86)\Steam\steamapps\common\Dark Souls II Scholar of the First Sin\Game\model\parts\body\bd_6750_m-bnd\BD_6750_M.flv"; importer.JOBCONFIG.OutputTpfPath = @"C:\Program Files (x86)\Steam\steamapps\common\Dark Souls II Scholar of the First Sin\Game\model\parts\body\bd_6750_m-bnd\BD_6750_M.tpf"; importer.JOBCONFIG.BeforeSaveAction = (f, t) => { foreach (var mat in f.Materials) { //0b00000000_00000000_00000000_10000000 no apparent effect //0b00000000_00000000_00000001_00000000 crashes //0b00000000_00000000_00000010_00000000 crashes mat.Flags = -1; } }; importer.Import(); //importer.JOBCONFIG.ChooseGamePreset(FBX2FLVERImportJobConfig.FlverGamePreset.DS1Skinned); //importer.JOBCONFIG.LoadMTDBND(@"C:\Program Files (x86)\Steam\steamapps\common\Dark Souls Prepare to Die Edition\DATA\mtd\Mtd.mtdbnd", isBND4: false); //importer.JOBCONFIG.LoadFBX(@"D:\FRPG_MOD\FBX Import Test\ArtoriasSkeletonTest.fbx"); ////importer.JOBCONFIG.UseAbsoluteVertPositions = false; //importer.JOBCONFIG.ScalePercent = 39.37f; //importer.JOBCONFIG.OutputFlverPath = @"C:\Program Files (x86)\Steam\steamapps\common\Dark Souls Prepare to Die Edition\DATA\chr\c4100-chrbnd\chr\c4100\c4100.flver"; //importer.JOBCONFIG.OutputTpfPath = @"C:\Program Files (x86)\Steam\steamapps\common\Dark Souls Prepare to Die Edition\DATA\chr\c4100-chrbnd\chr\c4100\c4100.tpf"; //importer.JOBCONFIG.GenerateLodAndMotionBlur = true; //importer.Import(); //importer.JOBCONFIG.ChooseGamePreset(FBX2FLVERImportJobConfig.FlverGamePreset.DS3Static); //importer.JOBCONFIG.LoadMTDBND(@"C:\Program Files (x86)\Steam\steamapps\common\DARK SOULS III\Game\mtd\allmaterialbnd.mtdbnd.dcx", isBND4: true); //importer.JOBCONFIG.LoadFBX(@"D:\FRPG_MOD\FBX Import Test\darklordsword3.fbx"); ////importer.JOBCONFIG.UseAbsoluteVertPositions = false; //importer.JOBCONFIG.ScalePercent = 200; //importer.JOBCONFIG.SceneRotation = new Microsoft.Xna.Framework.Vector3(0, 0, -Microsoft.Xna.Framework.MathHelper.PiOver2); //importer.JOBCONFIG.OutputFlverPath = @"C:\Program Files (x86)\Steam\steamapps\common\DARK SOULS III\Game\parts\wp_a_0201-partsbnd-dcx\parts\Weapon\WP_A_0201\WP_A_0201.flver"; //importer.JOBCONFIG.OutputTpfPath = @"C:\Program Files (x86)\Steam\steamapps\common\DARK SOULS III\Game\parts\wp_a_0201-partsbnd-dcx\parts\Weapon\WP_A_0201\WP_A_0201_bad.tpf"; //importer.JOBCONFIG.GenerateLodAndMotionBlur = true; //importer.JOBCONFIG.ChooseGamePreset(FBX2FLVERImportJobConfig.FlverGamePreset.DS3Static); //importer.JOBCONFIG.LoadMTDBND(@"C:\Program Files (x86)\Steam\steamapps\common\DARK SOULS III\Game\mtd\allmaterialbnd.mtdbnd.dcx", isBND4: true); //importer.JOBCONFIG.LoadFBX(@"D:\FRPG_MOD\FBX Import Test\darklordsword3.fbx"); ////importer.JOBCONFIG.UseAbsoluteVertPositions = false; //importer.JOBCONFIG.ScalePercent = 10; //importer.JOBCONFIG.SceneRotation = new Microsoft.Xna.Framework.Vector3(0, 0, -Microsoft.Xna.Framework.MathHelper.PiOver2); //importer.JOBCONFIG.OutputFlverPath = @"C:\Program Files (x86)\Steam\steamapps\common\DARK SOULS III\Game\parts\wp_a_0827-partsbnd-dcx\parts\Weapon\WP_A_0827\WP_A_0827.flver"; //importer.JOBCONFIG.OutputTpfPath = @"C:\Program Files (x86)\Steam\steamapps\common\DARK SOULS III\Game\parts\wp_a_0827-partsbnd-dcx\parts\Weapon\WP_A_0827\WP_A_0827_bad.tpf"; //importer.JOBCONFIG.GenerateLodAndMotionBlur = true; //importer.JOBCONFIG.BeforeSaveAction = (flver, tpf) => //{ // var dmy120 = flver.Dummies.First(d => d.ReferenceID == 120); // var dmy100 = flver.Dummies.First(d => d.ReferenceID == 100); // dmy120.ReferenceID = 300; // dmy100.ReferenceID = 301; // //flver.Dummies.Clear(); // //flver.Dummies.Add(dmy120); // //flver.Dummies.Add(dmy100); //}; //importer.Import(); //importer.JOBCONFIG.ChooseGamePreset(FBX2FLVERImportJobConfig.FlverGamePreset.DS3Skinned); //importer.JOBCONFIG.LoadMTDBND(@"C:\Program Files (x86)\Steam\steamapps\common\DARK SOULS III\Game\mtd\allmaterialbnd.mtdbnd.dcx", isBND4: true); //importer.JOBCONFIG.LoadFBX(@"D:\FRPG_MOD\FBX Import Test\CJ_DS3.fbx"); ////importer.JOBCONFIG.ScalePercent = 39.37f; //importer.JOBCONFIG.SceneRotation = new Microsoft.Xna.Framework.Vector3(0, 0, -Microsoft.Xna.Framework.MathHelper.PiOver2); //importer.JOBCONFIG.OutputFlverPath = @"C:\Program Files (x86)\Steam\steamapps\common\DARK SOULS III\Game\parts\bd_m_1950-partsbnd-dcx\parts\FullBody\BD_M_1950\BD_M_1950.flver"; //importer.JOBCONFIG.OutputTpfPath = @"C:\Program Files (x86)\Steam\steamapps\common\DARK SOULS III\Game\parts\bd_m_1950-partsbnd-dcx\parts\FullBody\BD_M_1950\BD_M_1950.tpf"; //importer.JOBCONFIG.GenerateLodAndMotionBlur = true; //importer.Import(); Console.WriteLine("\nPress any key to exit."); Console.ReadKey(true); }
public OrientationSolver(FBX2FLVERImporter Importer) { this.Importer = Importer; }
public BoundingBoxSolver(FBX2FLVERImporter Importer) { this.Importer = Importer; }
public BoneSolver(FBX2FLVERImporter Importer) { this.Importer = Importer; }
public TangentSolver(FBX2FLVERImporter Importer) { this.Importer = Importer; }
public NormalSolver(FBX2FLVERImporter Importer) { this.Importer = Importer; }