Skip to content

Commit

Permalink
Update v3.0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunaretic committed Jul 23, 2024
2 parents 1ede842 + f7a42e3 commit f759501
Show file tree
Hide file tree
Showing 22 changed files with 909 additions and 289 deletions.
2 changes: 1 addition & 1 deletion ConsoleTools/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public static async Task<int> UnwrapFile()
else if (src.EndsWith(".mdl"))
{
var mdl = Mdl.GetXivMdl(data);
var ttm = TTModel.FromRaw(mdl);
var ttm = await TTModel.FromRaw(mdl);
ttm.Source = ffPath;
await Mdl.ExportTTModelToFile(ttm, ffPath, 1, null, rtx);
}
Expand Down
1 change: 1 addition & 0 deletions FFXIV_TexTools/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />

<ResourceDictionary Source="Simple Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Expand Down
6 changes: 3 additions & 3 deletions FFXIV_TexTools/FFXIV_TexTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
<Product>FFXIV_TexTools</Product>
<Copyright>Copyright © 2024</Copyright>

<ApplicationVersion>3.0.7.6</ApplicationVersion>
<AssemblyVersion>3.0.7.6</AssemblyVersion>
<FileVersion>3.0.7.6</FileVersion>
<ApplicationVersion>3.0.8.0</ApplicationVersion>
<AssemblyVersion>3.0.8.0</AssemblyVersion>
<FileVersion>3.0.8.0</FileVersion>

<LangVersion>9.0</LangVersion>
<UseWPF>true</UseWPF>
Expand Down
5 changes: 5 additions & 0 deletions FFXIV_TexTools/ViewModels/FullModelViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,11 @@ private void ReIndexMaterialDictionary(TTModel ttModel, Dictionary<int, ModelTex
/// </summary>
private void Remove(object obj)
{
if (ModelList.Count == 0 || ModelList == null)
{
return;
}

if (ModelList.Count == 1)
{
ViewportVM.ClearAll();
Expand Down
174 changes: 173 additions & 1 deletion FFXIV_TexTools/ViewModels/ImportModelEditViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

namespace FFXIV_TexTools.ViewModels
{
public class ImportModelEditViewModel
public class ImportModelEditViewModel : INotifyPropertyChanged
{


Expand Down Expand Up @@ -60,6 +60,176 @@ public class ImportModelEditViewModel

private XivDependencyRoot _root;

public void UpdateFlow()
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(EnableAnisotropy)));
}


public bool DisableShadows
{
get {
return (_newModel.Flags & EMeshFlags1.ShadowDisabled) != 0;
}
set
{
if (value)
{
_newModel.Flags |= EMeshFlags1.ShadowDisabled;
} else
{
_newModel.Flags &= ~EMeshFlags1.ShadowDisabled;
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DisableShadows)));
}
}
public bool DisableLightShadow
{
get
{
return (_newModel.Flags & EMeshFlags1.LightShadowDisabled) != 0;
}
set
{
if (value)
{
_newModel.Flags |= EMeshFlags1.LightShadowDisabled;
}
else
{
_newModel.Flags &= ~EMeshFlags1.LightShadowDisabled;
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DisableLightShadow)));
}
}
public bool EnableAnisotropy
{
get
{
return _newModel.AnisotropicLightingEnabled;
}
set
{
_newModel.AnisotropicLightingEnabled = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(EnableAnisotropy)));
}
}
public bool DisableWavingAnimation
{
get
{
return (_newModel.Flags & EMeshFlags1.WavingAnimationDisabled) != 0;
}
set
{
if (value)
{
_newModel.Flags |= EMeshFlags1.WavingAnimationDisabled;
}
else
{
_newModel.Flags &= ~EMeshFlags1.WavingAnimationDisabled;
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DisableWavingAnimation)));
}
}
public bool EnableLightingReflection
{
get
{
return (_newModel.Flags & EMeshFlags1.LightingReflectionEnabled) != 0;
}
set
{
if (value)
{
_newModel.Flags |= EMeshFlags1.LightingReflectionEnabled;
}
else
{
_newModel.Flags &= ~EMeshFlags1.LightingReflectionEnabled;
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(EnableLightingReflection)));
}
}
public bool UnknownFlag
{
get
{
return (_newModel.Flags & EMeshFlags1.Unknown10) != 0;
}
set
{
if (value)
{
_newModel.Flags |= EMeshFlags1.Unknown10;
}
else
{
_newModel.Flags &= ~EMeshFlags1.Unknown10;
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(UnknownFlag)));
}
}
public bool OccludeRain
{
get
{
return (_newModel.Flags & EMeshFlags1.RainOcclusionEnabled) != 0;
}
set
{
if (value)
{
_newModel.Flags |= EMeshFlags1.RainOcclusionEnabled;
}
else
{
_newModel.Flags &= ~EMeshFlags1.RainOcclusionEnabled;
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(OccludeRain)));
}
}
public bool OccludeSnow
{
get
{
return (_newModel.Flags & EMeshFlags1.SnowOcclusionEnabled) != 0;
}
set
{
if (value)
{
_newModel.Flags |= EMeshFlags1.SnowOcclusionEnabled;
}
else
{
_newModel.Flags &= ~EMeshFlags1.SnowOcclusionEnabled;
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(OccludeSnow)));
}
}
public bool OccludeDust
{
get
{
return (_newModel.Flags & EMeshFlags1.DustOcclusionEnabled) != 0;
}
set
{
if (value)
{
_newModel.Flags |= EMeshFlags1.DustOcclusionEnabled;
}
else
{
_newModel.Flags &= ~EMeshFlags1.DustOcclusionEnabled;
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(OccludeDust)));
}
}


private TTMeshGroup GetGroup()
{
if (_view.MeshNumberBox.SelectedValue == null)
Expand Down Expand Up @@ -1009,5 +1179,7 @@ private void MaterialPathTextBox_KeyDown(object sender, System.Windows.Input.Key
{ "shp_nse_d", "Nose d" },
{ "shp_nse_e", "Nose e" },
};

public event PropertyChangedEventHandler PropertyChanged;
}
}
22 changes: 6 additions & 16 deletions FFXIV_TexTools/ViewModels/ImportModelViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ namespace FFXIV_TexTools.ViewModels
{
public class ImportModelViewModel : INotifyPropertyChanged
{
private const int ExpandedHeight = 680;
private const double CloseDelay = 3000f;

private ImportModelView _view;
Expand Down Expand Up @@ -213,28 +212,23 @@ public ImportModelViewModel(ImportModelView view, string internalPath, IItem ref
// Default Settings for specific categories, event handlers are added to allow users to opt out of these defaults
if (referenceItem != null)
{
if (referenceItem.SecondaryCategory == XivStrings.Face && ComplexOptionsEnabled)
{
_view.UseOriginalShapeDataButton.IsChecked = Settings.Default.UseOriginalShapeDataForFace;
}
if (referenceItem.SecondaryCategory == XivStrings.Hair)
{
_view.CloneUV1Button.IsChecked = Settings.Default.CloneUV1toUV2ForHair;
}
}

_view.UseOriginalShapeDataButton.Click += UseOriginalShapeDataButton_Clicked;
_view.CloneUV1Button.Click += CloneUV1Button_Clicked;
_view.ShiftUVsButton.Click += ForceUVsButton_Clicked;
_view.UseImportedTangentButton.Click += UseExternalTangents_Clicked;
}

private void UseOriginalShapeDataButton_Clicked(object sender, RoutedEventArgs e)
{
Settings.Default.UseOriginalShapeDataForFace = _view.UseOriginalShapeDataButton.IsChecked == true;
Settings.Default.Save();
if (!string.IsNullOrWhiteSpace(startingFilePath))
{
SetRaceOverrideByFileName();
}
}


private void CloneUV1Button_Clicked(object sender, RoutedEventArgs e)
{
Settings.Default.CloneUV1toUV2ForHair = _view.CloneUV1Button.IsChecked == true;
Expand Down Expand Up @@ -331,20 +325,16 @@ private async Task DoImport(bool showEditor)
}
}

_view.Height = ExpandedHeight;
_view.LogGrid.Height = 400;
_view.EnableAll(false);

// Clear log.
_view.LogTextBox.Document.Blocks.Clear();
_view.LogTextBox.AppendText("");

var options = new ModelImportOptions();
options.UseOriginalShapeData = _view.UseOriginalShapeDataButton.IsChecked == true ? true : false;
options.ShiftImportUV = _view.ShiftUVsButton.IsChecked == true ? true : false;
options.ClearUV2 = _view.ClearUV2Button.IsChecked == true ? true : false;
options.CloneUV2 = _view.CloneUV1Button.IsChecked == true ? true : false;
options.ClearVAlpha = _view.ClearVAlphaButton.IsChecked == true ? true : false;
options.ClearVColor = _view.ClearVColorButton.IsChecked == true ? true : false;
options.AutoScale = _view.AutoScaleButton.IsChecked == true ? true : false;
options.UseImportedTangents = _view.UseImportedTangentButton.IsChecked == true ? true : false;

Expand Down
15 changes: 11 additions & 4 deletions FFXIV_TexTools/Views/Controls/ShaderKeysEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public WrappedKey(ShaderKeysEditor editor, ShaderKey key)
{
_Editor = editor;
Key = key;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(KnownValues)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(KeyId)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Name)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Value)));
}

public event PropertyChangedEventHandler PropertyChanged;
Expand All @@ -41,10 +45,6 @@ public uint KeyId
set
{
Key.KeyId = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(KeyId)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Name)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(KnownValues)));

var ninfo = Key.GetKeyInfo(_Editor.Material.ShaderPack);
if (ninfo != null)
{
Expand All @@ -54,6 +54,12 @@ public uint KeyId
{
Value = 0;
}

PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(KnownValues)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(KeyId)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Name)));
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Value)));

}
}
public uint Value
Expand Down Expand Up @@ -107,6 +113,7 @@ public ObservableCollection<KeyValuePair<string, uint>> KnownValues {
values.Add(new KeyValuePair<string, uint>(name, val.Key));
}

var asHex = Value.ToString("X8");
if (!values.Any(x => x.Value == Value))
{
values.Add(new KeyValuePair<string, uint>(Value.ToString("X8"), Value));
Expand Down
6 changes: 3 additions & 3 deletions FFXIV_TexTools/Views/FileControls/ModelFileControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ protected override async Task<bool> INTERNAL_LoadFile(byte[] data, string path,
// The data coming in here is an uncompressed .mdl file.
return await Task.Run(async () =>
{
return await LoadModel(Mdl.GetTTModel(data, path));
return await LoadModel(await Mdl.GetTTModel(data, path));
});
}
protected async Task<bool> LoadModel(TTModel model) {
Expand Down Expand Up @@ -415,7 +415,7 @@ protected async Task UpdateVisual()

FmvButtonEnabled = true;
// Disable FMV button if we're an unsupported type.
if (Model.IsInternal)
if (Model.HasPath)
{
var modelRoot = await XivCache.GetFirstRoot(Model.Source);
if (modelRoot == null ||
Expand Down Expand Up @@ -699,7 +699,7 @@ protected override KeyValuePair<string, string> GetDefaultExtension()

private void FullModel_Click(object sender, RoutedEventArgs e)
{
if (Model == null || !Model.IsInternal) return;
if (Model == null || !Model.HasPath) return;
try
{
// Load a clean copy of the model.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,11 @@ private void RebuildList()

private void RemoveManipulation_Click(object sender, System.Windows.RoutedEventArgs e)
{
Data.Manipulations.Remove(SelectedManipulation);
RebuildList();
if (SelectedManipulation != null && Data.Manipulations != null)
{
Data.Manipulations.Remove(SelectedManipulation);
RebuildList();
}
}

private void Done_Click(object sender, System.Windows.RoutedEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ private void SetupUi()
var options = new List<WizardOptionEntry>();
foreach (var g in Data.Groups)
{
if (g == null) continue;
options.AddRange(g.Options);
}
OptionsList.ItemsSource = options;
Expand Down
Loading

0 comments on commit f759501

Please sign in to comment.