mirror of
https://github.com/4sval/FModel.git
synced 2026-03-24 18:54:42 -05:00
FortPlayerAugmentItemDefinition + no more auto save
This commit is contained in:
parent
fc82540388
commit
2a4f91cc65
|
|
@ -1 +1 @@
|
|||
Subproject commit af16aa14f37f9a4705308e087ae820ac1076f54f
|
||||
Subproject commit 1cec00df148a2cdc2f4dbf73316b9b1ea6da33f7
|
||||
|
|
@ -90,6 +90,7 @@ public class CreatorPackage : IDisposable
|
|||
case "FortPlaysetPropItemDefinition":
|
||||
case "FortHomebaseNodeItemDefinition":
|
||||
case "FortNeverPersistItemDefinition":
|
||||
case "FortPlayerAugmentItemDefinition":
|
||||
case "RadioContentSourceItemDefinition":
|
||||
case "FortPlaysetGrenadeItemDefinition":
|
||||
case "FortPersonalVehicleItemDefinition":
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@
|
|||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Header="Export Raw Data" Command="{Binding RightClickMenuCommand}">
|
||||
<MenuItem Header="Export Raw Data (.uasset)" Command="{Binding RightClickMenuCommand}">
|
||||
<MenuItem.CommandParameter>
|
||||
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
|
||||
<Binding Source="Assets_Export_Data" />
|
||||
|
|
@ -109,7 +109,7 @@
|
|||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Save Property" Command="{Binding RightClickMenuCommand}">
|
||||
<MenuItem Header="Save Property (.json)" Command="{Binding RightClickMenuCommand}">
|
||||
<MenuItem.CommandParameter>
|
||||
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
|
||||
<Binding Source="Assets_Save_Properties" />
|
||||
|
|
@ -124,10 +124,10 @@
|
|||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Save Texture" Command="{Binding RightClickMenuCommand}">
|
||||
<MenuItem Header="Save Texture (.png)" Command="{Binding RightClickMenuCommand}">
|
||||
<MenuItem.CommandParameter>
|
||||
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
|
||||
<Binding Source="Assets_Save_Texture" />
|
||||
<Binding Source="Assets_Save_Textures" />
|
||||
<Binding Path="SelectedItems" ElementName="AssetsListName" />
|
||||
</MultiBinding>
|
||||
</MenuItem.CommandParameter>
|
||||
|
|
@ -139,24 +139,8 @@
|
|||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Auto">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
<Path Fill="{DynamicResource {x:Static adonisUi:Brushes.AccentForegroundBrush}}" Data="{StaticResource StatusBarIcon}" />
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
<MenuItem Header="Save Properties" IsCheckable="True" StaysOpenOnClick="True"
|
||||
InputGestureText="{Binding AutoSaveProps, Source={x:Static local:Settings.UserSettings.Default}}"
|
||||
IsChecked="{Binding IsAutoSaveProps, Source={x:Static local:Settings.UserSettings.Default}}" />
|
||||
<MenuItem Header="Save Textures" IsCheckable="True" StaysOpenOnClick="True"
|
||||
InputGestureText="{Binding AutoSaveTextures, Source={x:Static local:Settings.UserSettings.Default}}"
|
||||
IsChecked="{Binding IsAutoSaveTextures, Source={x:Static local:Settings.UserSettings.Default}}" />
|
||||
<MenuItem Header="Open Sounds" IsCheckable="True" StaysOpenOnClick="True"
|
||||
InputGestureText="{Binding AutoOpenSounds, Source={x:Static local:Settings.UserSettings.Default}}"
|
||||
IsChecked="{Binding IsAutoOpenSounds, Source={x:Static local:Settings.UserSettings.Default}}" />
|
||||
</MenuItem>
|
||||
<MenuItem Header="Auto Open Sounds" IsCheckable="True" StaysOpenOnClick="True"
|
||||
IsChecked="{Binding IsAutoOpenSounds, Source={x:Static local:Settings.UserSettings.Default}}" />
|
||||
</MenuItem>
|
||||
<MenuItem Header="Views">
|
||||
<MenuItem Header="3D Viewer" Command="{Binding MenuCommand}" CommandParameter="Views_3dViewer">
|
||||
|
|
@ -400,7 +384,7 @@
|
|||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Export Folder's Packages Raw Data" Click="OnFolderExportClick">
|
||||
<MenuItem Header="Export Folder's Packages Raw Data (.uasset)" Click="OnFolderExportClick">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
|
|
@ -409,7 +393,7 @@
|
|||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Save Folder's Packages Properties" Click="OnFolderSaveClick">
|
||||
<MenuItem Header="Save Folder's Packages Properties (.json)" Click="OnFolderSaveClick">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
|
|
@ -418,6 +402,15 @@
|
|||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Save Folder's Packages Textures (.png)" Click="OnFolderTextureClick">
|
||||
<MenuItem.Icon>
|
||||
<Viewbox Width="16" Height="16">
|
||||
<Canvas Width="24" Height="24">
|
||||
<Path Fill="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" Data="{StaticResource TextureIcon}" />
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Header="Save Directory" Click="OnSaveDirectoryClick">
|
||||
<MenuItem.Icon>
|
||||
|
|
@ -528,7 +521,7 @@
|
|||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Export Raw Data" Command="{Binding DataContext.RightClickMenuCommand}">
|
||||
<MenuItem Header="Export Raw Data (.uasset)" Command="{Binding DataContext.RightClickMenuCommand}">
|
||||
<MenuItem.CommandParameter>
|
||||
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
|
||||
<Binding Source="Assets_Export_Data" />
|
||||
|
|
@ -543,7 +536,7 @@
|
|||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Save Properties" Command="{Binding DataContext.RightClickMenuCommand}">
|
||||
<MenuItem Header="Save Properties (.json)" Command="{Binding DataContext.RightClickMenuCommand}">
|
||||
<MenuItem.CommandParameter>
|
||||
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
|
||||
<Binding Source="Assets_Save_Properties" />
|
||||
|
|
@ -558,10 +551,10 @@
|
|||
</Viewbox>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Save Texture" Command="{Binding DataContext.RightClickMenuCommand}">
|
||||
<MenuItem Header="Save Texture (.png)" Command="{Binding DataContext.RightClickMenuCommand}">
|
||||
<MenuItem.CommandParameter>
|
||||
<MultiBinding Converter="{x:Static converters:MultiParameterConverter.Instance}">
|
||||
<Binding Source="Assets_Save_Texture" />
|
||||
<Binding Source="Assets_Save_Textures" />
|
||||
<Binding Path="SelectedItems" />
|
||||
</MultiBinding>
|
||||
</MenuItem.CommandParameter>
|
||||
|
|
@ -803,32 +796,6 @@
|
|||
</Viewbox>
|
||||
</StatusBarItem>
|
||||
|
||||
<StatusBarItem Width="30" HorizontalContentAlignment="Stretch" ToolTip="Auto Save Properties Enabled">
|
||||
<StatusBarItem.Style>
|
||||
<Style TargetType="StatusBarItem">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsAutoSaveProps, Source={x:Static local:Settings.UserSettings.Default}}" Value="False">
|
||||
<Setter Property="Visibility" Value="Hidden" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</StatusBarItem.Style>
|
||||
<TextBlock HorizontalAlignment="Center" FontWeight="SemiBold" Text="PRP" />
|
||||
</StatusBarItem>
|
||||
|
||||
<StatusBarItem Width="30" HorizontalContentAlignment="Stretch" ToolTip="Auto Save Textures Enabled">
|
||||
<StatusBarItem.Style>
|
||||
<Style TargetType="StatusBarItem">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsAutoSaveTextures, Source={x:Static local:Settings.UserSettings.Default}}" Value="False">
|
||||
<Setter Property="Visibility" Value="Hidden" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</StatusBarItem.Style>
|
||||
<TextBlock HorizontalAlignment="Center" FontWeight="SemiBold" Text="TEX" />
|
||||
</StatusBarItem>
|
||||
|
||||
<StatusBarItem Width="30" HorizontalContentAlignment="Stretch" ToolTip="Auto Open Sounds Enabled">
|
||||
<StatusBarItem.Style>
|
||||
<Style TargetType="StatusBarItem">
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@ public partial class MainWindow
|
|||
|
||||
public MainWindow()
|
||||
{
|
||||
CommandBindings.Add(new CommandBinding(new RoutedCommand("AutoSaveProps", typeof(MainWindow), new InputGestureCollection { new KeyGesture(UserSettings.Default.AutoSaveProps.Key, UserSettings.Default.AutoSaveProps.Modifiers) }), OnAutoTriggerExecuted));
|
||||
CommandBindings.Add(new CommandBinding(new RoutedCommand("AutoSaveTextures", typeof(MainWindow), new InputGestureCollection { new KeyGesture(UserSettings.Default.AutoSaveTextures.Key, UserSettings.Default.AutoSaveTextures.Modifiers) }), OnAutoTriggerExecuted));
|
||||
CommandBindings.Add(new CommandBinding(new RoutedCommand("AutoOpenSounds", typeof(MainWindow), new InputGestureCollection { new KeyGesture(UserSettings.Default.AutoOpenSounds.Key, UserSettings.Default.AutoOpenSounds.Modifiers) }), OnAutoTriggerExecuted));
|
||||
CommandBindings.Add(new CommandBinding(new RoutedCommand("ReloadMappings", typeof(MainWindow), new InputGestureCollection { new KeyGesture(Key.F12) }), OnMappingsReload));
|
||||
CommandBindings.Add(new CommandBinding(ApplicationCommands.Find, (_, _) => OnOpenAvalonFinder()));
|
||||
|
||||
|
|
@ -143,22 +140,6 @@ public partial class MainWindow
|
|||
await _applicationView.CUE4Parse.InitMappings();
|
||||
}
|
||||
|
||||
private void OnAutoTriggerExecuted(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
switch ((e.Command as RoutedCommand)?.Name)
|
||||
{
|
||||
case "AutoSaveProps":
|
||||
UserSettings.Default.IsAutoSaveProps = !UserSettings.Default.IsAutoSaveProps;
|
||||
break;
|
||||
case "AutoSaveTextures":
|
||||
UserSettings.Default.IsAutoSaveTextures = !UserSettings.Default.IsAutoSaveTextures;
|
||||
break;
|
||||
case "AutoOpenSounds":
|
||||
UserSettings.Default.IsAutoOpenSounds = !UserSettings.Default.IsAutoOpenSounds;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnOpenAvalonFinder()
|
||||
{
|
||||
_applicationView.CUE4Parse.TabControl.SelectedTab.HasSearchOpen = true;
|
||||
|
|
@ -205,6 +186,14 @@ public partial class MainWindow
|
|||
}
|
||||
}
|
||||
|
||||
private async void OnFolderTextureClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AssetsFolderName.SelectedItem is TreeItem folder)
|
||||
{
|
||||
await _threadWorkerView.Begin(cancellationToken => { _applicationView.CUE4Parse.TextureFolder(cancellationToken, folder); });
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSaveDirectoryClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AssetsFolderName.SelectedItem is not TreeItem folder) return;
|
||||
|
|
|
|||
|
|
@ -112,20 +112,6 @@ namespace FModel.Settings
|
|||
set => SetProperty(ref _lastOpenedSettingTab, value);
|
||||
}
|
||||
|
||||
private bool _isAutoSaveProps;
|
||||
public bool IsAutoSaveProps
|
||||
{
|
||||
get => _isAutoSaveProps;
|
||||
set => SetProperty(ref _isAutoSaveProps, value);
|
||||
}
|
||||
|
||||
private bool _isAutoSaveTextures;
|
||||
public bool IsAutoSaveTextures
|
||||
{
|
||||
get => _isAutoSaveTextures;
|
||||
set => SetProperty(ref _isAutoSaveTextures, value);
|
||||
}
|
||||
|
||||
private bool _isAutoOpenSounds = true;
|
||||
public bool IsAutoOpenSounds
|
||||
{
|
||||
|
|
@ -557,27 +543,6 @@ namespace FModel.Settings
|
|||
set => SetProperty(ref _assetRemoveTab, value);
|
||||
}
|
||||
|
||||
private Hotkey _autoSaveProps = new(Key.F1);
|
||||
public Hotkey AutoSaveProps
|
||||
{
|
||||
get => _autoSaveProps;
|
||||
set => SetProperty(ref _autoSaveProps, value);
|
||||
}
|
||||
|
||||
private Hotkey _autoSaveTextures = new(Key.F2);
|
||||
public Hotkey AutoSaveTextures
|
||||
{
|
||||
get => _autoSaveTextures;
|
||||
set => SetProperty(ref _autoSaveTextures, value);
|
||||
}
|
||||
|
||||
private Hotkey _autoOpenSounds = new(Key.F3);
|
||||
public Hotkey AutoOpenSounds
|
||||
{
|
||||
get => _autoOpenSounds;
|
||||
set => SetProperty(ref _autoOpenSounds, value);
|
||||
}
|
||||
|
||||
private Hotkey _addAudio = new(Key.N, ModifierKeys.Control);
|
||||
public Hotkey AddAudio
|
||||
{
|
||||
|
|
|
|||
|
|
@ -488,56 +488,6 @@ public class CUE4ParseViewModel : ViewModel
|
|||
});
|
||||
}
|
||||
|
||||
public void ExtractFolder(CancellationToken cancellationToken, TreeItem folder)
|
||||
{
|
||||
foreach (var asset in folder.AssetsList.Assets)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
try
|
||||
{
|
||||
Extract(cancellationToken, asset.FullPath, TabControl.HasNoTabs);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var f in folder.Folders) ExtractFolder(cancellationToken, f);
|
||||
}
|
||||
|
||||
public void ExportFolder(CancellationToken cancellationToken, TreeItem folder)
|
||||
{
|
||||
foreach (var asset in folder.AssetsList.Assets)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
ExportData(asset.FullPath);
|
||||
}
|
||||
|
||||
foreach (var f in folder.Folders) ExportFolder(cancellationToken, f);
|
||||
}
|
||||
|
||||
public void SaveFolder(CancellationToken cancellationToken, TreeItem folder)
|
||||
{
|
||||
foreach (var asset in folder.AssetsList.Assets)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
try
|
||||
{
|
||||
Extract(cancellationToken, asset.FullPath, TabControl.HasNoTabs, true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var f in folder.Folders) SaveFolder(cancellationToken, f);
|
||||
}
|
||||
|
||||
public void ExtractSelected(CancellationToken cancellationToken, IEnumerable<AssetItem> assetItems)
|
||||
{
|
||||
foreach (var asset in assetItems)
|
||||
|
|
@ -548,7 +498,41 @@ public class CUE4ParseViewModel : ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
public void Extract(CancellationToken cancellationToken, string fullPath, bool addNewTab = false, bool bulkSave = false)
|
||||
private void BulkFolder(CancellationToken cancellationToken, TreeItem folder, Action<AssetItem> action)
|
||||
{
|
||||
foreach (var asset in folder.AssetsList.Assets)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
try
|
||||
{
|
||||
action(asset);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var f in folder.Folders) BulkFolder(cancellationToken, f, action);
|
||||
}
|
||||
|
||||
public void ExportFolder(CancellationToken cancellationToken, TreeItem folder)
|
||||
=> BulkFolder(cancellationToken, folder, asset => ExportData(asset.FullPath));
|
||||
|
||||
public void ExtractFolder(CancellationToken cancellationToken, TreeItem folder)
|
||||
=> BulkFolder(cancellationToken, folder, asset => Extract(cancellationToken, asset.FullPath, TabControl.HasNoTabs));
|
||||
|
||||
public void SaveFolder(CancellationToken cancellationToken, TreeItem folder)
|
||||
=> BulkFolder(cancellationToken, folder, asset => Extract(cancellationToken, asset.FullPath, TabControl.HasNoTabs, true));
|
||||
|
||||
public void TextureFolder(CancellationToken cancellationToken, TreeItem folder)
|
||||
=> BulkFolder(cancellationToken, folder, asset =>
|
||||
{
|
||||
Extract(cancellationToken, asset.FullPath, TabControl.HasNoTabs, false, true);
|
||||
});
|
||||
|
||||
public void Extract(CancellationToken cancellationToken, string fullPath, bool addNewTab = false, bool bulkSave = false, bool bulkTexture = false)
|
||||
{
|
||||
Log.Information("User DOUBLE-CLICKED to extract '{FullPath}'", fullPath);
|
||||
|
||||
|
|
@ -581,7 +565,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
|
||||
foreach (var e in exports)
|
||||
{
|
||||
if (CheckExport(cancellationToken, e))
|
||||
if (CheckExport(cancellationToken, e, bulkTexture))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -691,7 +675,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
if (Provider.TrySaveAsset(fullPath, out var data))
|
||||
{
|
||||
using var stream = new MemoryStream(data) { Position = 0 };
|
||||
TabControl.SelectedTab.AddImage(fileName.SubstringBeforeLast("."), false, SKBitmap.Decode(stream));
|
||||
TabControl.SelectedTab.AddImage(fileName.SubstringBeforeLast("."), false, SKBitmap.Decode(stream), bulkTexture);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -711,7 +695,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
canvas.DrawPicture(svg.Picture, paint);
|
||||
}
|
||||
|
||||
TabControl.SelectedTab.AddImage(fileName.SubstringBeforeLast("."), false, bitmap);
|
||||
TabControl.SelectedTab.AddImage(fileName.SubstringBeforeLast("."), false, bitmap, bulkTexture);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -759,11 +743,11 @@ public class CUE4ParseViewModel : ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
private bool CheckExport(CancellationToken cancellationToken, UObject export) // return true once you wanna stop searching for exports
|
||||
private bool CheckExport(CancellationToken cancellationToken, UObject export, bool bulkTexture = false) // return true once you wanna stop searching for exports
|
||||
{
|
||||
switch (export)
|
||||
{
|
||||
case USolarisDigest solarisDigest:
|
||||
case USolarisDigest solarisDigest when !bulkTexture:
|
||||
{
|
||||
if (!TabControl.CanAddTabs) return false;
|
||||
|
||||
|
|
@ -774,11 +758,11 @@ public class CUE4ParseViewModel : ViewModel
|
|||
}
|
||||
case UTexture2D texture:
|
||||
{
|
||||
TabControl.SelectedTab.AddImage(texture);
|
||||
TabControl.SelectedTab.AddImage(texture, bulkTexture);
|
||||
return false;
|
||||
}
|
||||
case UAkMediaAssetData:
|
||||
case USoundWave:
|
||||
case UAkMediaAssetData when !bulkTexture:
|
||||
case USoundWave when !bulkTexture:
|
||||
{
|
||||
var shouldDecompress = UserSettings.Default.CompressedAudioMode == ECompressedAudio.PlayDecompressed;
|
||||
export.Decode(shouldDecompress, out var audioFormat, out var data);
|
||||
|
|
@ -788,10 +772,10 @@ public class CUE4ParseViewModel : ViewModel
|
|||
SaveAndPlaySound(Path.Combine(TabControl.SelectedTab.Directory, TabControl.SelectedTab.Header.SubstringBeforeLast('.')).Replace('\\', '/'), audioFormat, data);
|
||||
return false;
|
||||
}
|
||||
case UWorld when UserSettings.Default.PreviewWorlds:
|
||||
case UStaticMesh when UserSettings.Default.PreviewStaticMeshes:
|
||||
case USkeletalMesh when UserSettings.Default.PreviewSkeletalMeshes:
|
||||
case UMaterialInstance when UserSettings.Default.PreviewMaterials && !ModelIsOverwritingMaterial &&
|
||||
case UWorld when !bulkTexture && UserSettings.Default.PreviewWorlds:
|
||||
case UStaticMesh when !bulkTexture && UserSettings.Default.PreviewStaticMeshes:
|
||||
case USkeletalMesh when !bulkTexture && UserSettings.Default.PreviewSkeletalMeshes:
|
||||
case UMaterialInstance when !bulkTexture && UserSettings.Default.PreviewMaterials && !ModelIsOverwritingMaterial &&
|
||||
!(Game == FGame.FortniteGame && export.Owner != null && (export.Owner.Name.EndsWith($"/MI_OfferImages/{export.Name}", StringComparison.OrdinalIgnoreCase) ||
|
||||
export.Owner.Name.EndsWith($"/RenderSwitch_Materials/{export.Name}", StringComparison.OrdinalIgnoreCase) ||
|
||||
export.Owner.Name.EndsWith($"/MI_BPTile/{export.Name}", StringComparison.OrdinalIgnoreCase))):
|
||||
|
|
@ -800,23 +784,23 @@ public class CUE4ParseViewModel : ViewModel
|
|||
SnooperViewer.Run();
|
||||
return true;
|
||||
}
|
||||
case UMaterialInstance m when ModelIsOverwritingMaterial:
|
||||
case UMaterialInstance m when !bulkTexture && ModelIsOverwritingMaterial:
|
||||
{
|
||||
SnooperViewer.Renderer.Swap(m);
|
||||
SnooperViewer.Run();
|
||||
return true;
|
||||
}
|
||||
case UAnimSequence a when ModelIsWaitingAnimation:
|
||||
case UAnimSequence a when !bulkTexture && ModelIsWaitingAnimation:
|
||||
{
|
||||
SnooperViewer.Renderer.Animate(a);
|
||||
SnooperViewer.Run();
|
||||
return true;
|
||||
}
|
||||
case UStaticMesh when UserSettings.Default.SaveStaticMeshes:
|
||||
case USkeletalMesh when UserSettings.Default.SaveSkeletalMeshes:
|
||||
case UMaterialInstance when UserSettings.Default.SaveMaterials:
|
||||
case USkeleton when UserSettings.Default.SaveSkeletonAsMesh:
|
||||
case UAnimSequence when UserSettings.Default.SaveAnimations:
|
||||
case UStaticMesh when !bulkTexture && UserSettings.Default.SaveStaticMeshes:
|
||||
case USkeletalMesh when !bulkTexture && UserSettings.Default.SaveSkeletalMeshes:
|
||||
case UMaterialInstance when !bulkTexture && UserSettings.Default.SaveMaterials:
|
||||
case USkeleton when !bulkTexture && UserSettings.Default.SaveSkeletonAsMesh:
|
||||
case UAnimSequence when !bulkTexture && UserSettings.Default.SaveAnimations:
|
||||
{
|
||||
SaveExport(export);
|
||||
return true;
|
||||
|
|
@ -827,7 +811,7 @@ public class CUE4ParseViewModel : ViewModel
|
|||
if (!package.TryConstructCreator(out var creator)) return false;
|
||||
|
||||
creator.ParseForInfo();
|
||||
TabControl.SelectedTab.AddImage(export.Name, false, creator.Draw());
|
||||
TabControl.SelectedTab.AddImage(export.Name, false, creator.Draw(), bulkTexture);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
|
|||
}
|
||||
|
||||
break;
|
||||
case "Assets_Save_Texture":
|
||||
case "Assets_Save_Textures":
|
||||
foreach (var asset in assetItems)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath);
|
||||
contextViewModel.CUE4Parse.TabControl.SelectedTab.SaveImage(false);
|
||||
contextViewModel.CUE4Parse.TabControl.SelectedTab.SaveImages(false);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ using System.Windows;
|
|||
using System.Windows.Media.Imaging;
|
||||
using CUE4Parse.UE4.Assets.Exports.Texture;
|
||||
using CUE4Parse_Conversion.Textures;
|
||||
using Ookii.Dialogs.Wpf;
|
||||
|
||||
namespace FModel.ViewModels;
|
||||
|
||||
|
|
@ -221,19 +222,20 @@ public class TabItem : ViewModel
|
|||
});
|
||||
}
|
||||
|
||||
public void AddImage(UTexture2D texture) => AddImage(texture.Name, texture.bRenderNearestNeighbor, texture.Decode(UserSettings.Default.OverridedPlatform));
|
||||
public void AddImage(UTexture2D texture, bool bulkTexture)
|
||||
=> AddImage(texture.Name, texture.bRenderNearestNeighbor, texture.Decode(UserSettings.Default.OverridedPlatform), bulkTexture);
|
||||
|
||||
public void AddImage(string name, bool rnn, SKBitmap[] img)
|
||||
public void AddImage(string name, bool rnn, SKBitmap[] img, bool bulkTexture)
|
||||
{
|
||||
foreach (var i in img) AddImage(name, rnn, i);
|
||||
foreach (var i in img) AddImage(name, rnn, i, bulkTexture);
|
||||
}
|
||||
|
||||
public void AddImage(string name, bool rnn, SKBitmap img)
|
||||
public void AddImage(string name, bool rnn, SKBitmap img, bool bulkTexture)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
var t = new TabImage(name, rnn, img);
|
||||
if (UserSettings.Default.IsAutoSaveTextures)
|
||||
if (bulkTexture)
|
||||
SaveImage(t, true);
|
||||
|
||||
_images.Add(t);
|
||||
|
|
@ -253,7 +255,7 @@ public class TabItem : ViewModel
|
|||
Document ??= new TextDocument();
|
||||
Document.Text = text;
|
||||
|
||||
if (UserSettings.Default.IsAutoSaveProps || bulkSave)
|
||||
if (bulkSave)
|
||||
SaveProperty(true);
|
||||
});
|
||||
}
|
||||
|
|
@ -267,16 +269,47 @@ public class TabItem : ViewModel
|
|||
});
|
||||
}
|
||||
|
||||
public void SaveImage(bool autoSave) => SaveImage(SelectedImage, autoSave);
|
||||
public void SaveImages(bool bulkTexture)
|
||||
{
|
||||
if (_images.Count == 1)
|
||||
{
|
||||
SaveImage(bulkTexture);
|
||||
return;
|
||||
}
|
||||
|
||||
private void SaveImage(TabImage image, bool autoSave)
|
||||
var directory = Path.Combine(UserSettings.Default.TextureDirectory,
|
||||
UserSettings.Default.KeepDirectoryStructure ? Directory : "").Replace('\\', '/');
|
||||
|
||||
if (!bulkTexture)
|
||||
{
|
||||
var folderBrowser = new VistaFolderBrowserDialog { Description = "description ???", UseDescriptionForTitle = false };
|
||||
if (folderBrowser.ShowDialog() == true)
|
||||
{
|
||||
directory = folderBrowser.SelectedPath;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(directory);
|
||||
}
|
||||
|
||||
foreach (var image in _images)
|
||||
{
|
||||
if (image == null) return;
|
||||
var fileName = $"{image.ExportName}.png";
|
||||
SaveImage(image, Path.Combine(directory, fileName), fileName);
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveImage(bool bulkTexture) => SaveImage(SelectedImage, bulkTexture);
|
||||
private void SaveImage(TabImage image, bool bulkTexture)
|
||||
{
|
||||
if (image == null) return;
|
||||
var fileName = $"{image.ExportName}.png";
|
||||
var directory = Path.Combine(UserSettings.Default.TextureDirectory,
|
||||
var path = Path.Combine(UserSettings.Default.TextureDirectory,
|
||||
UserSettings.Default.KeepDirectoryStructure ? Directory : "", fileName!).Replace('\\', '/');
|
||||
|
||||
if (!autoSave)
|
||||
if (!bulkTexture)
|
||||
{
|
||||
var saveFileDialog = new SaveFileDialog
|
||||
{
|
||||
|
|
@ -287,19 +320,26 @@ public class TabItem : ViewModel
|
|||
};
|
||||
var result = saveFileDialog.ShowDialog();
|
||||
if (!result.HasValue || !result.Value) return;
|
||||
directory = saveFileDialog.FileName;
|
||||
path = saveFileDialog.FileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(directory.SubstringBeforeLast('/'));
|
||||
System.IO.Directory.CreateDirectory(path.SubstringBeforeLast('/'));
|
||||
}
|
||||
|
||||
using (var fs = new FileStream(directory, FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||
{
|
||||
fs.Write(image.ImageBuffer, 0, image.ImageBuffer.Length);
|
||||
}
|
||||
SaveImage(image, path, fileName);
|
||||
}
|
||||
|
||||
SaveCheck(directory, fileName);
|
||||
private void SaveImage(TabImage image, string path, string fileName)
|
||||
{
|
||||
SaveImage(image, path);
|
||||
SaveCheck(path, fileName);
|
||||
}
|
||||
|
||||
private void SaveImage(TabImage image, string path)
|
||||
{
|
||||
using var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read);
|
||||
fs.Write(image.ImageBuffer, 0, image.ImageBuffer.Length);
|
||||
}
|
||||
|
||||
public void SaveProperty(bool autoSave)
|
||||
|
|
@ -451,4 +491,4 @@ public class TabControlViewModel : ViewModel
|
|||
{
|
||||
yield return new TabItem("New Tab", string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -420,10 +420,6 @@
|
|||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
|
|
@ -455,29 +451,17 @@
|
|||
|
||||
<Separator Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="3" Style="{StaticResource CustomSeparator}" />
|
||||
|
||||
<TextBlock Grid.Row="8" Grid.Column="0" Text="Auto Save Properties *" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<TextBlock Grid.Row="8" Grid.Column="0" Text="Add Audio File" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<controls:HotkeyTextBox Grid.Row="8" Grid.Column="2" Style="{StaticResource TextBoxDefaultStyle}" Margin="0 0 0 5"
|
||||
HotKey="{Binding AutoSaveProps, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" />
|
||||
<TextBlock Grid.Row="9" Grid.Column="0" Text="Auto Save Textures *" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<controls:HotkeyTextBox Grid.Row="9" Grid.Column="2" Style="{StaticResource TextBoxDefaultStyle}" Margin="0 0 0 5"
|
||||
HotKey="{Binding AutoSaveTextures, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" />
|
||||
<TextBlock Grid.Row="10" Grid.Column="0" Text="Auto Open Sounds *" VerticalAlignment="Center" />
|
||||
<controls:HotkeyTextBox Grid.Row="10" Grid.Column="2" Style="{StaticResource TextBoxDefaultStyle}"
|
||||
HotKey="{Binding AutoOpenSounds, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" />
|
||||
|
||||
<Separator Grid.Row="11" Grid.Column="0" Grid.ColumnSpan="3" Style="{StaticResource CustomSeparator}" />
|
||||
|
||||
<TextBlock Grid.Row="12" Grid.Column="0" Text="Add Audio File" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<controls:HotkeyTextBox Grid.Row="12" Grid.Column="2" Style="{StaticResource TextBoxDefaultStyle}" Margin="0 0 0 5"
|
||||
HotKey="{Binding AddAudio, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" />
|
||||
<TextBlock Grid.Row="13" Grid.Column="0" Text="Play / Pause Current Audio" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<controls:HotkeyTextBox Grid.Row="13" Grid.Column="2" Style="{StaticResource TextBoxDefaultStyle}" Margin="0 0 0 5"
|
||||
<TextBlock Grid.Row="9" Grid.Column="0" Text="Play / Pause Current Audio" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<controls:HotkeyTextBox Grid.Row="9" Grid.Column="2" Style="{StaticResource TextBoxDefaultStyle}" Margin="0 0 0 5"
|
||||
HotKey="{Binding PlayPauseAudio, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" />
|
||||
<TextBlock Grid.Row="14" Grid.Column="0" Text="Previous Audio" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<controls:HotkeyTextBox Grid.Row="14" Grid.Column="2" Style="{StaticResource TextBoxDefaultStyle}" Margin="0 0 0 5"
|
||||
<TextBlock Grid.Row="10" Grid.Column="0" Text="Previous Audio" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<controls:HotkeyTextBox Grid.Row="10" Grid.Column="2" Style="{StaticResource TextBoxDefaultStyle}" Margin="0 0 0 5"
|
||||
HotKey="{Binding PreviousAudio, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" />
|
||||
<TextBlock Grid.Row="15" Grid.Column="0" Text="Next Audio" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<controls:HotkeyTextBox Grid.Row="15" Grid.Column="2" Style="{StaticResource TextBoxDefaultStyle}" Margin="0 0 0 5"
|
||||
<TextBlock Grid.Row="11" Grid.Column="0" Text="Next Audio" VerticalAlignment="Center" Margin="0 0 0 5" />
|
||||
<controls:HotkeyTextBox Grid.Row="11" Grid.Column="2" Style="{StaticResource TextBoxDefaultStyle}" Margin="0 0 0 5"
|
||||
HotKey="{Binding NextAudio, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
|
|
|||
|
|
@ -107,8 +107,10 @@ public class Material : IDisposable
|
|||
if (Parameters.TryGetScalar(out var roughness, "Rough", "Roughness"))
|
||||
Roughness = roughness;
|
||||
|
||||
if (Parameters.TryGetScalar(out var emissiveMult, "emissive mult", "Emissive_Mult"))
|
||||
EmissiveMult = emissiveMult;
|
||||
if (Parameters.TryGetScalar(out var emissiveMultScalar, "emissive mult", "Emissive_Mult"))
|
||||
EmissiveMult = emissiveMultScalar;
|
||||
else if (Parameters.TryGetLinearColor(out var emissiveMultColor, "Emissive Multiplier"))
|
||||
EmissiveMult = emissiveMultColor.R;
|
||||
|
||||
if (Parameters.TryGetScalar(out var uvScale, "UV Scale"))
|
||||
UVScale = uvScale;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user