mirror of
https://github.com/4sval/FModel.git
synced 2026-09-09 01:56:34 -05:00
Nanite Static Meshes support in UE 5.0-5.3
Some checks failed
FModel QA Builder / build (push) Has been cancelled
Some checks failed
FModel QA Builder / build (push) Has been cancelled
MindsEye and Wuthering Waves 2.4 support
This commit is contained in:
Submodule CUE4Parse updated: c1631562d5...f9b3811127
@@ -10,6 +10,7 @@ using CUE4Parse_Conversion.Meshes;
|
||||
using CUE4Parse_Conversion.Textures;
|
||||
using CUE4Parse_Conversion.UEFormat.Enums;
|
||||
using CUE4Parse.UE4.Assets.Exports.Material;
|
||||
using CUE4Parse.UE4.Assets.Exports.Nanite;
|
||||
using FModel.Framework;
|
||||
using FModel.ViewModels;
|
||||
using FModel.ViewModels.ApiEndpoints.Models;
|
||||
@@ -60,6 +61,7 @@ namespace FModel.Settings
|
||||
{
|
||||
LodFormat = Default.LodExportFormat,
|
||||
MeshFormat = Default.MeshExportFormat,
|
||||
NaniteMeshFormat = Default.NaniteMeshExportFormat,
|
||||
AnimFormat = Default.MeshExportFormat switch
|
||||
{
|
||||
EMeshFormat.UEFormat => EAnimFormat.UEFormat,
|
||||
@@ -367,6 +369,13 @@ namespace FModel.Settings
|
||||
set => SetProperty(ref _meshExportFormat, value);
|
||||
}
|
||||
|
||||
private ENaniteMeshFormat _naniteMeshExportFormat = ENaniteMeshFormat.OnlyNaniteLOD;
|
||||
public ENaniteMeshFormat NaniteMeshExportFormat
|
||||
{
|
||||
get => _naniteMeshExportFormat;
|
||||
set => SetProperty(ref _naniteMeshExportFormat, value);
|
||||
}
|
||||
|
||||
private EMaterialFormat _materialExportFormat = EMaterialFormat.FirstLayer;
|
||||
public EMaterialFormat MaterialExportFormat
|
||||
{
|
||||
|
||||
@@ -163,6 +163,7 @@ public class CUE4ParseViewModel : ViewModel
|
||||
|
||||
Provider.ReadScriptData = UserSettings.Default.ReadScriptData;
|
||||
Provider.ReadShaderMaps = UserSettings.Default.ReadShaderMaps;
|
||||
Provider.ReadNaniteData = true;
|
||||
|
||||
GameDirectory = new GameDirectoryViewModel();
|
||||
AssetsFolder = new AssetsFolderViewModel();
|
||||
|
||||
@@ -9,6 +9,7 @@ using CUE4Parse_Conversion.Meshes;
|
||||
using CUE4Parse_Conversion.Textures;
|
||||
using CUE4Parse_Conversion.UEFormat.Enums;
|
||||
using CUE4Parse.UE4.Assets.Exports.Material;
|
||||
using CUE4Parse.UE4.Assets.Exports.Nanite;
|
||||
using FModel.Framework;
|
||||
using FModel.Services;
|
||||
using FModel.Settings;
|
||||
@@ -143,6 +144,13 @@ public class SettingsViewModel : ViewModel
|
||||
set => SetProperty(ref _selectedLodExportFormat, value);
|
||||
}
|
||||
|
||||
private ENaniteMeshFormat _selectedNaniteMeshExportFormat;
|
||||
public ENaniteMeshFormat SelectedNaniteMeshExportFormat
|
||||
{
|
||||
get => _selectedNaniteMeshExportFormat;
|
||||
set => SetProperty(ref _selectedNaniteMeshExportFormat, value);
|
||||
}
|
||||
|
||||
private EMaterialFormat _selectedMaterialExportFormat;
|
||||
public EMaterialFormat SelectedMaterialExportFormat
|
||||
{
|
||||
@@ -170,6 +178,7 @@ public class SettingsViewModel : ViewModel
|
||||
public ReadOnlyObservableCollection<ESocketFormat> SocketExportFormats { get; private set; }
|
||||
public ReadOnlyObservableCollection<EFileCompressionFormat> CompressionFormats { get; private set; }
|
||||
public ReadOnlyObservableCollection<ELodFormat> LodExportFormats { get; private set; }
|
||||
public ReadOnlyObservableCollection<ENaniteMeshFormat> NaniteMeshExportFormats { get; private set; }
|
||||
public ReadOnlyObservableCollection<EMaterialFormat> MaterialExportFormats { get; private set; }
|
||||
public ReadOnlyObservableCollection<ETextureFormat> TextureExportFormats { get; private set; }
|
||||
public ReadOnlyObservableCollection<ETexturePlatform> Platforms { get; private set; }
|
||||
@@ -193,6 +202,7 @@ public class SettingsViewModel : ViewModel
|
||||
private ESocketFormat _socketExportFormatSnapshot;
|
||||
private EFileCompressionFormat _compressionFormatSnapshot;
|
||||
private ELodFormat _lodExportFormatSnapshot;
|
||||
private ENaniteMeshFormat _naniteMeshExportFormatSnapshot;
|
||||
private EMaterialFormat _materialExportFormatSnapshot;
|
||||
private ETextureFormat _textureExportFormatSnapshot;
|
||||
|
||||
@@ -233,6 +243,7 @@ public class SettingsViewModel : ViewModel
|
||||
_socketExportFormatSnapshot = UserSettings.Default.SocketExportFormat;
|
||||
_compressionFormatSnapshot = UserSettings.Default.CompressionFormat;
|
||||
_lodExportFormatSnapshot = UserSettings.Default.LodExportFormat;
|
||||
_naniteMeshExportFormatSnapshot = UserSettings.Default.NaniteMeshExportFormat;
|
||||
_materialExportFormatSnapshot = UserSettings.Default.MaterialExportFormat;
|
||||
_textureExportFormatSnapshot = UserSettings.Default.TextureExportFormat;
|
||||
|
||||
@@ -248,6 +259,7 @@ public class SettingsViewModel : ViewModel
|
||||
SelectedSocketExportFormat = _socketExportFormatSnapshot;
|
||||
SelectedCompressionFormat = _selectedCompressionFormat;
|
||||
SelectedLodExportFormat = _lodExportFormatSnapshot;
|
||||
SelectedNaniteMeshExportFormat = _naniteMeshExportFormatSnapshot;
|
||||
SelectedMaterialExportFormat = _materialExportFormatSnapshot;
|
||||
SelectedTextureExportFormat = _textureExportFormatSnapshot;
|
||||
SelectedAesReload = UserSettings.Default.AesReload;
|
||||
@@ -263,6 +275,7 @@ public class SettingsViewModel : ViewModel
|
||||
SocketExportFormats = new ReadOnlyObservableCollection<ESocketFormat>(new ObservableCollection<ESocketFormat>(EnumerateSocketExportFormat()));
|
||||
CompressionFormats = new ReadOnlyObservableCollection<EFileCompressionFormat>(new ObservableCollection<EFileCompressionFormat>(EnumerateCompressionFormat()));
|
||||
LodExportFormats = new ReadOnlyObservableCollection<ELodFormat>(new ObservableCollection<ELodFormat>(EnumerateLodExportFormat()));
|
||||
NaniteMeshExportFormats = new ReadOnlyObservableCollection<ENaniteMeshFormat>(new ObservableCollection<ENaniteMeshFormat>(EnumerateNaniteMeshExportFormat()));
|
||||
MaterialExportFormats = new ReadOnlyObservableCollection<EMaterialFormat>(new ObservableCollection<EMaterialFormat>(EnumerateMaterialExportFormat()));
|
||||
TextureExportFormats = new ReadOnlyObservableCollection<ETextureFormat>(new ObservableCollection<ETextureFormat>(EnumerateTextureExportFormat()));
|
||||
Platforms = new ReadOnlyObservableCollection<ETexturePlatform>(new ObservableCollection<ETexturePlatform>(EnumerateUePlatforms()));
|
||||
@@ -303,6 +316,7 @@ public class SettingsViewModel : ViewModel
|
||||
UserSettings.Default.SocketExportFormat = SelectedSocketExportFormat;
|
||||
UserSettings.Default.CompressionFormat = SelectedCompressionFormat;
|
||||
UserSettings.Default.LodExportFormat = SelectedLodExportFormat;
|
||||
UserSettings.Default.NaniteMeshExportFormat = SelectedNaniteMeshExportFormat;
|
||||
UserSettings.Default.MaterialExportFormat = SelectedMaterialExportFormat;
|
||||
UserSettings.Default.TextureExportFormat = SelectedTextureExportFormat;
|
||||
UserSettings.Default.AesReload = SelectedAesReload;
|
||||
@@ -328,6 +342,7 @@ public class SettingsViewModel : ViewModel
|
||||
private IEnumerable<ESocketFormat> EnumerateSocketExportFormat() => Enum.GetValues<ESocketFormat>();
|
||||
private IEnumerable<EFileCompressionFormat> EnumerateCompressionFormat() => Enum.GetValues<EFileCompressionFormat>();
|
||||
private IEnumerable<ELodFormat> EnumerateLodExportFormat() => Enum.GetValues<ELodFormat>();
|
||||
private IEnumerable<ENaniteMeshFormat> EnumerateNaniteMeshExportFormat() => Enum.GetValues<ENaniteMeshFormat>();
|
||||
private IEnumerable<EMaterialFormat> EnumerateMaterialExportFormat() => Enum.GetValues<EMaterialFormat>();
|
||||
private IEnumerable<ETextureFormat> EnumerateTextureExportFormat() => Enum.GetValues<ETextureFormat>();
|
||||
private IEnumerable<ETexturePlatform> EnumerateUePlatforms() => Enum.GetValues<ETexturePlatform>();
|
||||
|
||||
@@ -316,6 +316,7 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -459,8 +460,8 @@
|
||||
|
||||
<Separator Grid.Row="16" Grid.Column="0" Grid.ColumnSpan="5" Style="{StaticResource CustomSeparator}" />
|
||||
|
||||
<TextBlock Grid.Row="17" Grid.Column="0" Text="Material Format" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<ComboBox Grid.Row="17" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.MaterialExportFormats}" SelectedItem="{Binding SettingsView.SelectedMaterialExportFormat, Mode=TwoWay}"
|
||||
<TextBlock Grid.Row="17" Grid.Column="0" Text="Nanite Format" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<ComboBox Grid.Row="17" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.NaniteMeshExportFormats}" SelectedItem="{Binding SettingsView.SelectedNaniteMeshExportFormat, Mode=TwoWay}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" Margin="0 0 0 5">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
@@ -469,8 +470,18 @@
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock Grid.Row="18" Grid.Column="0" Text="Texture Format" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<ComboBox Grid.Row="18" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.TextureExportFormats}" SelectedItem="{Binding SettingsView.SelectedTextureExportFormat, Mode=TwoWay}"
|
||||
<TextBlock Grid.Row="18" Grid.Column="0" Text="Material Format" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<ComboBox Grid.Row="18" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.MaterialExportFormats}" SelectedItem="{Binding SettingsView.SelectedMaterialExportFormat, Mode=TwoWay}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" Margin="0 0 0 5">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={x:Static converters:EnumToStringConverter.Instance}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock Grid.Row="19" Grid.Column="0" Text="Texture Format" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<ComboBox Grid.Row="19" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.TextureExportFormats}" SelectedItem="{Binding SettingsView.SelectedTextureExportFormat, Mode=TwoWay}"
|
||||
DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:Views.SettingsView}}}" Margin="0 0 0 5">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
@@ -12,6 +12,7 @@ using CUE4Parse.UE4.Assets.Exports.Component.SplineMesh;
|
||||
using CUE4Parse.UE4.Assets.Exports.Component.StaticMesh;
|
||||
using CUE4Parse.UE4.Assets.Exports.GeometryCollection;
|
||||
using CUE4Parse.UE4.Assets.Exports.Material;
|
||||
using CUE4Parse.UE4.Assets.Exports.Nanite;
|
||||
using CUE4Parse.UE4.Assets.Exports.SkeletalMesh;
|
||||
using CUE4Parse.UE4.Assets.Exports.StaticMesh;
|
||||
using CUE4Parse.UE4.Assets.Exports.Texture;
|
||||
@@ -86,7 +87,7 @@ public class Renderer : IDisposable
|
||||
switch (dummy)
|
||||
{
|
||||
case UStaticMesh when export.Value is UStaticMesh st:
|
||||
LoadStaticMesh(st);
|
||||
LoadStaticMesh(st, UserSettings.Default.NaniteMeshExportFormat);
|
||||
break;
|
||||
case USkeletalMesh when export.Value is USkeletalMesh sk:
|
||||
LoadSkeletalMesh(sk);
|
||||
@@ -343,7 +344,7 @@ public class Renderer : IDisposable
|
||||
wnd.WindowShouldClose(true, true);
|
||||
}
|
||||
|
||||
private void LoadStaticMesh(UStaticMesh original)
|
||||
private void LoadStaticMesh(UStaticMesh original, ENaniteMeshFormat naniteFormat = ENaniteMeshFormat.OnlyNormalLODs)
|
||||
{
|
||||
var guid = original.LightingGuid;
|
||||
if (Options.TryGetModel(guid, out var model))
|
||||
@@ -353,7 +354,7 @@ public class Renderer : IDisposable
|
||||
return;
|
||||
}
|
||||
|
||||
if (!original.TryConvert(out var mesh))
|
||||
if (!original.TryConvert(out var mesh, naniteFormat))
|
||||
return;
|
||||
|
||||
Options.Models[guid] = new StaticModel(original, mesh);
|
||||
|
||||
Reference in New Issue
Block a user