From b57abc789d7b651914329dcfb08af55b6f5ed7cc Mon Sep 17 00:00:00 2001 From: Lunaretic Date: Tue, 23 Jul 2024 21:29:53 -0400 Subject: [PATCH 01/11] Use unique temp folder for import only mode to avoid possible collisions. --- FFXIV_TexTools/MainWindow.xaml.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/FFXIV_TexTools/MainWindow.xaml.cs b/FFXIV_TexTools/MainWindow.xaml.cs index 4933a5e0..ac501c16 100644 --- a/FFXIV_TexTools/MainWindow.xaml.cs +++ b/FFXIV_TexTools/MainWindow.xaml.cs @@ -414,8 +414,19 @@ private async Task HandleArgs(string[] args) FlexibleMessageBox.Show("An error occurred while initializing:\n\n" + ex.Message, "Init Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } - ImportOnlyWindow.ShowImportDialog(args[0]); - Application.Current.Shutdown(); + // Set a unique temp path. + var tempDir = IOUtil.GetUniqueSubfolder(Path.GetTempPath(), "tt_io"); + XivCache.FrameworkSettings.TempDirectory = tempDir; + + try + { + ImportOnlyWindow.ShowImportDialog(args[0]); + } + finally + { + IOUtil.ClearTempFolder(); + Application.Current.Shutdown(); + } } private void OnKeyDown(object sender, System.Windows.Input.KeyEventArgs e) From fda79081c87471e08cd1cf729d6dc07b14869065 Mon Sep 17 00:00:00 2001 From: Lunaretic Date: Tue, 23 Jul 2024 21:36:43 -0400 Subject: [PATCH 02/11] Add Penumbra import buttons to main UI. --- FFXIV_TexTools/MainWindow.xaml | 1 + FFXIV_TexTools/MainWindow.xaml.cs | 45 +++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/FFXIV_TexTools/MainWindow.xaml b/FFXIV_TexTools/MainWindow.xaml index 0651b025..87510808 100644 --- a/FFXIV_TexTools/MainWindow.xaml +++ b/FFXIV_TexTools/MainWindow.xaml @@ -73,6 +73,7 @@ + diff --git a/FFXIV_TexTools/MainWindow.xaml.cs b/FFXIV_TexTools/MainWindow.xaml.cs index ac501c16..c2071110 100644 --- a/FFXIV_TexTools/MainWindow.xaml.cs +++ b/FFXIV_TexTools/MainWindow.xaml.cs @@ -2144,5 +2144,50 @@ private void ViewBGPart_Click(object sender, RoutedEventArgs e) { _ = SimpleItemViewWindow.ShowModel(null, this); } + + private async void Menu_ImportModpackPenumbra_Click(object sender, RoutedEventArgs e) + { + var ofd = new OpenFileDialog(); + ofd.Filter = ViewHelpers.LoadModpackFilter; + ofd.Title = "Import Modpack to Penumbra..."; + if(ofd.ShowDialog() != System.Windows.Forms.DialogResult.OK) + { + return; + } + + var success = false; + await LockUi("Upgrading and Importing Modpack to Penumbra", "Please wait..."); + try + { + var modpack = ofd.FileName; + var info = await TTMP.GetModpackInfo(modpack); + var fname = IOUtil.MakePathSafe(info.ModPack.Name); + var dir = PenumbraAPI.GetPenumbraDirectory(); + + if (string.IsNullOrWhiteSpace(dir)) + { + throw new Exception("Penumbra is not installed or the library directory could not be found."); + } + var newPath = IOUtil.GetUniqueSubfolder(dir, fname, true); + + var newName = System.IO.Path.GetFileName(newPath); + + await ModpackUpgrader.UpgradeModpack(modpack, newPath, true, true); + await PenumbraAPI.ReloadMod(newName); + success = true; + } catch (Exception ex) + { + this.ShowError("Import Error", "An error occurred while upgrading or importing the modpack: " + ex.Message); + } + finally + { + await UnlockUi(); + } + + if (success) + { + await this.ShowMessageAsync("Penumbra Import Complete", "The modpack was imported successfully."); + } + } } } From 302dcc65486359ca75b2141972c5f3a2a15c05a4 Mon Sep 17 00:00:00 2001 From: Lunaretic Date: Wed, 24 Jul 2024 01:24:57 -0400 Subject: [PATCH 03/11] Misc small bugs and verbiage - HDR Settings Bug - Default Penumbra lib for project selection - Owner settings for file dialogs --- FFXIV_TexTools/Views/Controls/RawFloatValueDisplay.xaml.cs | 5 ++++- FFXIV_TexTools/Views/FileControls/FileViewControl.cs | 4 ++-- FFXIV_TexTools/Views/Models/ImportModelEditView.xaml | 4 ++-- FFXIV_TexTools/Views/Projects/ProjectWindow.xaml.cs | 1 + .../Views/Transactions/TransactionStatusWindow.xaml.cs | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/FFXIV_TexTools/Views/Controls/RawFloatValueDisplay.xaml.cs b/FFXIV_TexTools/Views/Controls/RawFloatValueDisplay.xaml.cs index 2ff3870d..f84fb1ee 100644 --- a/FFXIV_TexTools/Views/Controls/RawFloatValueDisplay.xaml.cs +++ b/FFXIV_TexTools/Views/Controls/RawFloatValueDisplay.xaml.cs @@ -64,7 +64,10 @@ private void SaveButton_Click(object sender, RoutedEventArgs e) Red = float.Parse(RedBox.Text); Green = float.Parse(GreenBox.Text); Blue = float.Parse(BlueBox.Text); - Alpha = float.Parse(AlphaBox.Text); + if (!string.IsNullOrWhiteSpace(AlphaBox.Text)) + { + Alpha = float.Parse(AlphaBox.Text); + } DialogResult = true; } catch diff --git a/FFXIV_TexTools/Views/FileControls/FileViewControl.cs b/FFXIV_TexTools/Views/FileControls/FileViewControl.cs index 3ac04878..5e353dcb 100644 --- a/FFXIV_TexTools/Views/FileControls/FileViewControl.cs +++ b/FFXIV_TexTools/Views/FileControls/FileViewControl.cs @@ -853,7 +853,7 @@ public async Task LoadFileByDialog(string internalFilePath = null, IItem r } var ofd = GetOpenDialog(); - var res = ofd.ShowDialog(); + var res = ofd.ShowDialog(ViewHelpers.GetWin32Window(this)); if(res != DialogResult.OK) { return false; @@ -1061,7 +1061,7 @@ public async Task SaveAsByDialog(string extension = null) _SaveDialog.Filter = ext.Value + " Files|*" + ext.Key; } - var res = _SaveDialog.ShowDialog(); + var res = _SaveDialog.ShowDialog(ViewHelpers.GetWin32Window(this)); if (res != DialogResult.OK) { return false; diff --git a/FFXIV_TexTools/Views/Models/ImportModelEditView.xaml b/FFXIV_TexTools/Views/Models/ImportModelEditView.xaml index 28de6031..e5248895 100644 --- a/FFXIV_TexTools/Views/Models/ImportModelEditView.xaml +++ b/FFXIV_TexTools/Views/Models/ImportModelEditView.xaml @@ -71,9 +71,9 @@ Determines if hair materials should show anisotropic specular highlights. - This will make the hair 'shinier', and the specular highlights will be skewed based on UV orientation. + This will make the hair 'shinier', and the specular highlights will be skewed based on UV orientation and Flow Data Settings. - Hair strand UVs should be laid out from Top-Left to Bottom-Right for correct lighting effects with this on. + Flow Data may be auto-generated based on UV Layout via the Modify Vertices menus. Turning this off on a hair which is already using it will make the lighting significantly more matte. diff --git a/FFXIV_TexTools/Views/Projects/ProjectWindow.xaml.cs b/FFXIV_TexTools/Views/Projects/ProjectWindow.xaml.cs index bfea8f17..c2c787e4 100644 --- a/FFXIV_TexTools/Views/Projects/ProjectWindow.xaml.cs +++ b/FFXIV_TexTools/Views/Projects/ProjectWindow.xaml.cs @@ -218,6 +218,7 @@ private async void NewPenumbra_Click(object sender, RoutedEventArgs e) } } var sfd = new BetterFolderBrowser(); + sfd.RootFolder = PenumbraAPI.GetPenumbraDirectory(); if (sfd.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; diff --git a/FFXIV_TexTools/Views/Transactions/TransactionStatusWindow.xaml.cs b/FFXIV_TexTools/Views/Transactions/TransactionStatusWindow.xaml.cs index bd4d06ac..45f232ed 100644 --- a/FFXIV_TexTools/Views/Transactions/TransactionStatusWindow.xaml.cs +++ b/FFXIV_TexTools/Views/Transactions/TransactionStatusWindow.xaml.cs @@ -489,7 +489,7 @@ private async void Commit_Click(object sender, RoutedEventArgs e) if(!XivCache.GameWriteEnabled && MainWindow.UserTransaction.Settings.Target == ETransactionTarget.GameFiles) { var res = FlexibleMessageBox.Show(ViewHelpers.GetWin32Window(Window.GetWindow(this)), - "You are committing to the live FFXIV game files while SAFE mode is enabled.\n\nAre you SURE this is what you meant to do?", "Safe Mode Write Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); + "You are committing to the live FFXIV game files while SAFE mode is enabled.\n\nThis will alter your real, live FFXIV Game Files.\n\nAre you SURE this is what you meant to do?", "Safe Mode Write Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); if(res != System.Windows.Forms.DialogResult.OK) { return; From 5793319f6477fe261da9eaefb9ce297f6a672557 Mon Sep 17 00:00:00 2001 From: Lunaretic Date: Wed, 24 Jul 2024 14:24:05 -0400 Subject: [PATCH 04/11] Recalculate binormals after racial conversion. Remove excess calculations in renderers. --- FFXIV_TexTools/ViewModels/FullModelViewport3DViewModel.cs | 1 - FFXIV_TexTools/ViewModels/Viewport3DViewModel.cs | 6 ------ 2 files changed, 7 deletions(-) diff --git a/FFXIV_TexTools/ViewModels/FullModelViewport3DViewModel.cs b/FFXIV_TexTools/ViewModels/FullModelViewport3DViewModel.cs index 0ae6f32d..14a164a8 100644 --- a/FFXIV_TexTools/ViewModels/FullModelViewport3DViewModel.cs +++ b/FFXIV_TexTools/ViewModels/FullModelViewport3DViewModel.cs @@ -88,7 +88,6 @@ public async Task UpdateModel(TTModel model, Dictionary t var slot = ViewHelpers.GetModelSlot(model.Source); SharpDX.BoundingBox? boundingBox = null; - ModelModifiers.CalculateTangents(model); // Remove any existing models of the same item type RemoveSlot(slot); diff --git a/FFXIV_TexTools/ViewModels/Viewport3DViewModel.cs b/FFXIV_TexTools/ViewModels/Viewport3DViewModel.cs index 3a75c512..5d3dd673 100644 --- a/FFXIV_TexTools/ViewModels/Viewport3DViewModel.cs +++ b/FFXIV_TexTools/ViewModels/Viewport3DViewModel.cs @@ -269,12 +269,6 @@ public async Task UpdateModel(TTModel importModel = null, List // Push all the potentially CPU intense stuff onto a new thread. await Task.Run(async () => { - if (newModel && originalModel != _Model) - { - // Only recalculate if an actually new-new model, since this doesn't change on shape application. - ModelModifiers.CalculateTangents(model); - } - if (newModel) { lock (_Geometry) From cf4ffe2653db538d42772ca6cbea677cdf7bf6c0 Mon Sep 17 00:00:00 2001 From: Lunaretic Date: Wed, 24 Jul 2024 14:39:03 -0400 Subject: [PATCH 05/11] Added regenerate skeletons button. --- .../Views/CustomizeSettingsView.xaml | 4 +- .../Views/CustomizeSettingsView.xaml.cs | 47 +++++++++++++++++++ lib/xivModdingFramework | 2 +- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/FFXIV_TexTools/Views/CustomizeSettingsView.xaml b/FFXIV_TexTools/Views/CustomizeSettingsView.xaml index 77311bba..2ee3ac3b 100644 --- a/FFXIV_TexTools/Views/CustomizeSettingsView.xaml +++ b/FFXIV_TexTools/Views/CustomizeSettingsView.xaml @@ -269,6 +269,7 @@ + @@ -280,8 +281,9 @@ - + + + RenderOptions.BitmapScalingMode="NearestNeighbor"> + + + + + +