removed auto export XYZ + added right click bulk commands

This commit is contained in:
4sval 2022-12-21 18:33:56 +01:00
parent 2c4c1faeaa
commit a7bc3d0b60
9 changed files with 267 additions and 186 deletions

View File

@ -1,3 +1,4 @@
using System;
using System.ComponentModel;
namespace FModel;
@ -150,3 +151,15 @@ public enum EEndpointType
Aes,
Mapping
}
[Flags]
public enum EBulkType
{
None = 0,
Auto = 1 << 0,
Properties = 1 << 1,
Textures = 1 << 2,
Meshes = 1 << 3,
Skeletons = 1 << 4,
Animations = 1 << 5
}

View File

@ -69,7 +69,6 @@ public partial class MainWindow
await _applicationView.CUE4Parse.InitMappings();
await _applicationView.InitImGuiSettings();
await _applicationView.InitVgmStream();
await _applicationView.InitOodle();
if (UserSettings.Default.DiscordRpc == EDiscordRpc.Always)
_discordHandler.Initialize(_applicationView.CUE4Parse.Game);
@ -194,6 +193,22 @@ public partial class MainWindow
}
}
private async void OnFolderModelClick(object sender, RoutedEventArgs e)
{
if (AssetsFolderName.SelectedItem is TreeItem folder)
{
await _threadWorkerView.Begin(cancellationToken => { _applicationView.CUE4Parse.ModelFolder(cancellationToken, folder); });
}
}
private async void OnFolderAnimationClick(object sender, RoutedEventArgs e)
{
if (AssetsFolderName.SelectedItem is TreeItem folder)
{
await _threadWorkerView.Begin(cancellationToken => { _applicationView.CUE4Parse.AnimationFolder(cancellationToken, folder); });
}
}
private void OnSaveDirectoryClick(object sender, RoutedEventArgs e)
{
if (AssetsFolderName.SelectedItem is not TreeItem folder) return;

View File

@ -241,13 +241,6 @@ namespace FModel.Settings
set => SetProperty(ref _overridedPlatform, value);
}
private bool _saveMorphTargets = true;
public bool SaveMorphTargets
{
get => _saveMorphTargets;
set => SetProperty(ref _saveMorphTargets, value);
}
private IDictionary<FGame, string> _presets = new Dictionary<FGame, string>
{
{FGame.Unknown, Constants._NO_PRESET_TRIGGER},
@ -606,6 +599,27 @@ namespace FModel.Settings
set => SetProperty(ref _showGrid, value);
}
private bool _previewStaticMeshes = true;
public bool PreviewStaticMeshes
{
get => _previewStaticMeshes;
set => SetProperty(ref _previewStaticMeshes, value);
}
private bool _previewSkeletalMeshes = true;
public bool PreviewSkeletalMeshes
{
get => _previewSkeletalMeshes;
set => SetProperty(ref _previewSkeletalMeshes, value);
}
private bool _previewMaterials = true;
public bool PreviewMaterials
{
get => _previewMaterials;
set => SetProperty(ref _previewMaterials, value);
}
private bool _previewWorlds = true;
public bool PreviewWorlds
{
@ -613,83 +627,11 @@ namespace FModel.Settings
set => SetProperty(ref _previewWorlds, value);
}
private bool _previewStaticMeshes = true;
public bool PreviewStaticMeshes
private bool _saveMorphTargets = true;
public bool SaveMorphTargets
{
get => _previewStaticMeshes;
set
{
SetProperty(ref _previewStaticMeshes, value);
if (_previewStaticMeshes && SaveStaticMeshes)
SaveStaticMeshes = false;
}
}
private bool _previewSkeletalMeshes = true;
public bool PreviewSkeletalMeshes
{
get => _previewSkeletalMeshes;
set
{
SetProperty(ref _previewSkeletalMeshes, value);
if (_previewSkeletalMeshes && SaveSkeletalMeshes)
SaveSkeletalMeshes = false;
}
}
private bool _previewMaterials = true;
public bool PreviewMaterials
{
get => _previewMaterials;
set
{
SetProperty(ref _previewMaterials, value);
if (_previewMaterials && SaveMaterials)
SaveMaterials = false;
}
}
private bool _saveStaticMeshes;
public bool SaveStaticMeshes
{
get => _saveStaticMeshes;
set
{
SetProperty(ref _saveStaticMeshes, value);
if (_saveStaticMeshes && PreviewStaticMeshes)
PreviewStaticMeshes = false;
}
}
private bool _saveSkeletalMeshes;
public bool SaveSkeletalMeshes
{
get => _saveSkeletalMeshes;
set
{
SetProperty(ref _saveSkeletalMeshes, value);
if (_saveSkeletalMeshes && PreviewSkeletalMeshes)
PreviewSkeletalMeshes = false;
}
}
private bool _saveMaterials;
public bool SaveMaterials
{
get => _saveMaterials;
set
{
SetProperty(ref _saveMaterials, value);
if (_saveMaterials && PreviewMaterials)
PreviewMaterials = false;
}
}
private bool _saveAnimations = true;
public bool SaveAnimations
{
get => _saveAnimations;
set => SetProperty(ref _saveAnimations, value);
get => _saveMorphTargets;
set => SetProperty(ref _saveMorphTargets, value);
}
private bool _saveSkeletonAsMesh;

View File

@ -41,6 +41,7 @@ using FModel.Views;
using FModel.Views.Resources.Controls;
using FModel.Views.Snooper;
using Newtonsoft.Json;
using Ookii.Dialogs.Wpf;
using OpenTK.Windowing.Common;
using OpenTK.Windowing.Desktop;
using Serilog;
@ -525,15 +526,18 @@ public class CUE4ParseViewModel : ViewModel
=> 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));
=> BulkFolder(cancellationToken, folder, asset => Extract(cancellationToken, asset.FullPath, TabControl.HasNoTabs, EBulkType.Properties | EBulkType.Auto));
public void TextureFolder(CancellationToken cancellationToken, TreeItem folder)
=> BulkFolder(cancellationToken, folder, asset =>
{
Extract(cancellationToken, asset.FullPath, TabControl.HasNoTabs, false, true);
});
=> BulkFolder(cancellationToken, folder, asset => Extract(cancellationToken, asset.FullPath, TabControl.HasNoTabs, EBulkType.Textures | EBulkType.Auto));
public void Extract(CancellationToken cancellationToken, string fullPath, bool addNewTab = false, bool bulkSave = false, bool bulkTexture = false)
public void ModelFolder(CancellationToken cancellationToken, TreeItem folder)
=> BulkFolder(cancellationToken, folder, asset => Extract(cancellationToken, asset.FullPath, TabControl.HasNoTabs, EBulkType.Meshes | EBulkType.Auto));
public void AnimationFolder(CancellationToken cancellationToken, TreeItem folder)
=> BulkFolder(cancellationToken, folder, asset => Extract(cancellationToken, asset.FullPath, TabControl.HasNoTabs, EBulkType.Animations | EBulkType.Auto));
public void Extract(CancellationToken cancellationToken, string fullPath, bool addNewTab = false, EBulkType bulk = EBulkType.None)
{
Log.Information("User DOUBLE-CLICKED to extract '{FullPath}'", fullPath);
@ -551,6 +555,8 @@ public class CUE4ParseViewModel : ViewModel
TabControl.SelectedTab.Directory = directory;
}
var autoProperties = bulk == (EBulkType.Properties | EBulkType.Auto);
var autoTextures = bulk == (EBulkType.Textures | EBulkType.Auto);
TabControl.SelectedTab.ClearImages();
TabControl.SelectedTab.ResetDocumentText();
TabControl.SelectedTab.ScrollTrigger = null;
@ -561,12 +567,12 @@ public class CUE4ParseViewModel : ViewModel
case "umap":
{
var exports = Provider.LoadObjectExports(fullPath); // cancellationToken
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(exports, Formatting.Indented), bulkSave);
if (bulkSave) break;
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(exports, Formatting.Indented), autoProperties);
if (HasFlag(bulk, EBulkType.Properties)) break; // do not search for viewable exports if we are dealing with jsons
foreach (var e in exports)
{
if (CheckExport(cancellationToken, e, bulkTexture))
if (CheckExport(cancellationToken, e, bulk))
break;
}
@ -602,7 +608,7 @@ public class CUE4ParseViewModel : ViewModel
using var stream = new MemoryStream(data) { Position = 0 };
using var reader = new StreamReader(stream);
TabControl.SelectedTab.SetDocumentText(reader.ReadToEnd(), bulkSave);
TabControl.SelectedTab.SetDocumentText(reader.ReadToEnd(), autoProperties);
}
break;
@ -612,7 +618,7 @@ public class CUE4ParseViewModel : ViewModel
if (Provider.TryCreateReader(fullPath, out var archive))
{
var metadata = new FTextLocalizationMetaDataResource(archive);
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(metadata, Formatting.Indented), bulkSave);
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(metadata, Formatting.Indented), autoProperties);
}
break;
@ -622,7 +628,7 @@ public class CUE4ParseViewModel : ViewModel
if (Provider.TryCreateReader(fullPath, out var archive))
{
var locres = new FTextLocalizationResource(archive);
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(locres, Formatting.Indented), bulkSave);
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(locres, Formatting.Indented), autoProperties);
}
break;
@ -632,7 +638,7 @@ public class CUE4ParseViewModel : ViewModel
if (Provider.TryCreateReader(fullPath, out var archive))
{
var registry = new FAssetRegistryState(archive);
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(registry, Formatting.Indented), bulkSave);
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(registry, Formatting.Indented), autoProperties);
}
break;
@ -643,7 +649,7 @@ public class CUE4ParseViewModel : ViewModel
if (Provider.TryCreateReader(fullPath, out var archive))
{
var wwise = new WwiseReader(archive);
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(wwise, Formatting.Indented), bulkSave);
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(wwise, Formatting.Indented), autoProperties);
foreach (var (name, data) in wwise.WwiseEncodedMedias)
{
SaveAndPlaySound(fullPath.SubstringBeforeWithLast("/") + name, "WEM", data);
@ -664,7 +670,7 @@ public class CUE4ParseViewModel : ViewModel
if (Provider.TryCreateReader(fullPath, out var archive))
{
var header = new FOodleDictionaryArchive(archive).Header;
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(header, Formatting.Indented), bulkSave);
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(header, Formatting.Indented), autoProperties);
}
break;
@ -676,7 +682,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), bulkTexture);
TabControl.SelectedTab.AddImage(fileName.SubstringBeforeLast("."), false, SKBitmap.Decode(stream), autoTextures);
}
break;
@ -696,7 +702,7 @@ public class CUE4ParseViewModel : ViewModel
canvas.DrawPicture(svg.Picture, paint);
}
TabControl.SelectedTab.AddImage(fileName.SubstringBeforeLast("."), false, bitmap, bulkTexture);
TabControl.SelectedTab.AddImage(fileName.SubstringBeforeLast("."), false, bitmap, autoTextures);
}
break;
@ -713,7 +719,7 @@ public class CUE4ParseViewModel : ViewModel
if (Provider.TryCreateReader(fullPath, out var archive))
{
var ar = new FShaderCodeArchive(archive);
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(ar, Formatting.Indented), bulkSave);
TabControl.SelectedTab.SetDocumentText(JsonConvert.SerializeObject(ar, Formatting.Indented), autoProperties);
}
break;
@ -744,11 +750,13 @@ public class CUE4ParseViewModel : ViewModel
}
}
private bool CheckExport(CancellationToken cancellationToken, UObject export, bool bulkTexture = false) // return true once you wanna stop searching for exports
private bool CheckExport(CancellationToken cancellationToken, UObject export, EBulkType bulk = EBulkType.None) // return true once you wanna stop searching for exports
{
var isNone = bulk == EBulkType.None;
var loadTextures = isNone || HasFlag(bulk, EBulkType.Textures);
switch (export)
{
case USolarisDigest solarisDigest when !bulkTexture:
case USolarisDigest solarisDigest when isNone:
{
if (!TabControl.CanAddTabs) return false;
@ -757,13 +765,13 @@ public class CUE4ParseViewModel : ViewModel
TabControl.SelectedTab.SetDocumentText(solarisDigest.ReadableCode, false);
return true;
}
case UTexture2D texture:
case UTexture2D texture when loadTextures:
{
TabControl.SelectedTab.AddImage(texture, bulkTexture);
TabControl.SelectedTab.AddImage(texture, HasFlag(bulk, EBulkType.Auto));
return false;
}
case UAkMediaAssetData when !bulkTexture:
case USoundWave when !bulkTexture:
case UAkMediaAssetData when isNone:
case USoundWave when isNone:
{
var shouldDecompress = UserSettings.Default.CompressedAudioMode == ECompressedAudio.PlayDecompressed;
export.Decode(shouldDecompress, out var audioFormat, out var data);
@ -773,46 +781,50 @@ public class CUE4ParseViewModel : ViewModel
SaveAndPlaySound(Path.Combine(TabControl.SelectedTab.Directory, TabControl.SelectedTab.Header.SubstringBeforeLast('.')).Replace('\\', '/'), audioFormat, data);
return false;
}
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 &&
case UWorld when isNone && UserSettings.Default.PreviewWorlds:
case UStaticMesh when isNone && UserSettings.Default.PreviewStaticMeshes:
case USkeletalMesh when isNone && UserSettings.Default.PreviewSkeletalMeshes:
case UMaterialInstance when isNone && 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))):
export.Owner.Name.EndsWith($"/RenderSwitch_Materials/{export.Name}", StringComparison.OrdinalIgnoreCase) ||
export.Owner.Name.EndsWith($"/MI_BPTile/{export.Name}", StringComparison.OrdinalIgnoreCase))):
{
if (SnooperViewer.TryLoadExport(cancellationToken, export))
SnooperViewer.Run();
return true;
}
case UMaterialInstance m when !bulkTexture && ModelIsOverwritingMaterial:
case UMaterialInstance m when isNone && ModelIsOverwritingMaterial:
{
SnooperViewer.Renderer.Swap(m);
SnooperViewer.Run();
return true;
}
case UAnimSequence a when !bulkTexture && ModelIsWaitingAnimation:
case UAnimSequence a when isNone && ModelIsWaitingAnimation:
{
SnooperViewer.Renderer.Animate(a);
SnooperViewer.Run();
return true;
}
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:
case UStaticMesh when HasFlag(bulk, EBulkType.Meshes):
case USkeletalMesh when HasFlag(bulk, EBulkType.Meshes):
case USkeleton when UserSettings.Default.SaveSkeletonAsMesh && HasFlag(bulk, EBulkType.Meshes):
// case UMaterialInstance when HasFlag(bulk, EBulkType.Materials): // read the fucking json
case UAnimSequence when HasFlag(bulk, EBulkType.Animations):
{
SaveExport(export);
SaveExport(export, HasFlag(bulk, EBulkType.Auto));
return true;
}
default:
{
if (!loadTextures)
return false;
using var package = new CreatorPackage(export, UserSettings.Default.CosmeticStyle);
if (!package.TryConstructCreator(out var creator)) return false;
if (!package.TryConstructCreator(out var creator))
return false;
creator.ParseForInfo();
TabControl.SelectedTab.AddImage(export.Name, false, creator.Draw(), bulkTexture);
TabControl.SelectedTab.AddImage(export.Name, false, creator.Draw(), HasFlag(bulk, EBulkType.Auto));
return true;
}
}
@ -845,7 +857,7 @@ public class CUE4ParseViewModel : ViewModel
});
}
private void SaveExport(UObject export)
private void SaveExport(UObject export, bool auto)
{
var exportOptions = new ExporterOptions
{
@ -857,7 +869,18 @@ public class CUE4ParseViewModel : ViewModel
ExportMorphTargets = UserSettings.Default.SaveMorphTargets
};
var toSave = new Exporter(export, exportOptions);
var toSaveDirectory = new DirectoryInfo(UserSettings.Default.ModelDirectory);
string dir;
if (!auto)
{
var folderBrowser = new VistaFolderBrowserDialog();
if (folderBrowser.ShowDialog() == true)
dir = folderBrowser.SelectedPath;
else return;
}
else dir = UserSettings.Default.ModelDirectory;
var toSaveDirectory = new DirectoryInfo(dir);
if (toSave.TryWriteToDir(toSaveDirectory, out var label, out var savedFilePath))
{
Log.Information("Successfully saved {FilePath}", savedFilePath);
@ -895,4 +918,9 @@ public class CUE4ParseViewModel : ViewModel
FLogger.AppendText($"Could not export '{fileName}'", Constants.WHITE, true);
}
}
private static bool HasFlag(EBulkType a, EBulkType b)
{
return (a & b) == b;
}
}

View File

@ -31,7 +31,6 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath, true);
}
break;
case "Assets_Export_Data":
foreach (var asset in assetItems)
@ -39,25 +38,36 @@ public class RightClickMenuCommand : ViewModelCommand<ApplicationViewModel>
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.ExportData(asset.FullPath);
}
break;
case "Assets_Save_Properties":
foreach (var asset in assetItems)
{
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath);
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath, false, EBulkType.Properties);
contextViewModel.CUE4Parse.TabControl.SelectedTab.SaveProperty(false);
}
break;
case "Assets_Save_Textures":
foreach (var asset in assetItems)
{
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath);
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath, false, EBulkType.Textures);
contextViewModel.CUE4Parse.TabControl.SelectedTab.SaveImages(false);
}
break;
case "Assets_Save_Models":
foreach (var asset in assetItems)
{
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath, false, EBulkType.Meshes);
}
break;
case "Assets_Save_Animations":
foreach (var asset in assetItems)
{
cancellationToken.ThrowIfCancellationRequested();
contextViewModel.CUE4Parse.Extract(cancellationToken, asset.FullPath, false, EBulkType.Animations);
}
break;
}
});

View File

@ -9,13 +9,15 @@ namespace FModel.ViewModels.Commands;
public class TabCommand : ViewModelCommand<TabItem>
{
private ApplicationViewModel _applicationView => ApplicationService.ApplicationView;
private ThreadWorkerViewModel _threadWorkerView => ApplicationService.ThreadWorkerView;
public TabCommand(TabItem contextViewModel) : base(contextViewModel)
{
}
public override void Execute(TabItem contextViewModel, object parameter)
public override async void Execute(TabItem contextViewModel, object parameter)
{
var fullPath = contextViewModel.Directory + "/" + contextViewModel.Header;
switch (parameter)
{
case TabItem mdlClick:
@ -30,6 +32,35 @@ public class TabCommand : ViewModelCommand<TabItem>
case "Close_Other_Tabs":
_applicationView.CUE4Parse.TabControl.RemoveOtherTabs(contextViewModel);
break;
case "Assets_Export_Data":
await _threadWorkerView.Begin(_ => _applicationView.CUE4Parse.ExportData(fullPath));
break;
case "Assets_Save_Properties":
await _threadWorkerView.Begin(cancellationToken =>
{
_applicationView.CUE4Parse.Extract(cancellationToken, fullPath, false, EBulkType.Properties);
_applicationView.CUE4Parse.TabControl.SelectedTab.SaveProperty(false);
});
break;
case "Assets_Save_Textures":
await _threadWorkerView.Begin(cancellationToken =>
{
_applicationView.CUE4Parse.Extract(cancellationToken, fullPath, false, EBulkType.Textures);
_applicationView.CUE4Parse.TabControl.SelectedTab.SaveImages(false);
});
break;
case "Assets_Save_Models":
await _threadWorkerView.Begin(cancellationToken =>
{
_applicationView.CUE4Parse.Extract(cancellationToken, fullPath, false, EBulkType.Meshes);
});
break;
case "Assets_Save_Animations":
await _threadWorkerView.Begin(cancellationToken =>
{
_applicationView.CUE4Parse.Extract(cancellationToken, fullPath, false, EBulkType.Animations);
});
break;
case "Open_Properties":
if (contextViewModel.Header == "New Tab" || contextViewModel.Document == null) return;
Helper.OpenWindow<AdonisWindow>(contextViewModel.Header + " (Properties)", () =>
@ -45,4 +76,4 @@ public class TabCommand : ViewModelCommand<TabItem>
break;
}
}
}
}

View File

@ -277,29 +277,31 @@ public class TabItem : ViewModel
public void SaveImages(bool bulkTexture)
{
if (_images.Count == 1)
switch (_images.Count)
{
SaveImage(bulkTexture);
return;
}
case 1:
SaveImage(bulkTexture);
break;
case > 1:
var directory = Path.Combine(UserSettings.Default.TextureDirectory,
UserSettings.Default.KeepDirectoryStructure ? Directory : "").Replace('\\', '/');
var directory = Path.Combine(UserSettings.Default.TextureDirectory,
UserSettings.Default.KeepDirectoryStructure ? Directory : "").Replace('\\', '/');
if (!bulkTexture)
{
var folderBrowser = new VistaFolderBrowserDialog();
if (folderBrowser.ShowDialog() == true)
directory = folderBrowser.SelectedPath;
else return;
}
else System.IO.Directory.CreateDirectory(directory);
if (!bulkTexture)
{
var folderBrowser = new VistaFolderBrowserDialog();
if (folderBrowser.ShowDialog() == true)
directory = folderBrowser.SelectedPath;
else return;
}
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);
foreach (var image in _images)
{
if (image == null) return;
var fileName = $"{image.ExportName}.png";
SaveImage(image, Path.Combine(directory, fileName), fileName);
}
break;
}
}

View File

@ -28,6 +28,8 @@
<Geometry x:Key="ExportIcon">M19.41,7.41l-4.83-4.83C14.21,2.21,13.7,2,13.17,2H6C4.9,2,4.01,2.9,4.01,4L4,20c0,1.1,0.89,2,1.99,2H18c1.1,0,2-0.9,2-2 V8.83C20,8.3,19.79,7.79,19.41,7.41z M14.8,15H13v3c0,0.55-0.45,1-1,1s-1-0.45-1-1v-3H9.21c-0.45,0-0.67-0.54-0.35-0.85l2.8-2.79 c0.2-0.19,0.51-0.19,0.71,0l2.79,2.79C15.46,14.46,15.24,15,14.8,15z M14,9c-0.55,0-1-0.45-1-1V3.5L18.5,9H14z</Geometry>
<Geometry x:Key="SaveIcon">M16.17,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V7.83c0-0.53-0.21-1.04-0.59-1.41l-2.83-2.83 C17.21,3.21,16.7,3,16.17,3z M12,18c-1.66,0-3-1.34-3-3s1.34-3,3-3s3,1.34,3,3S13.66,18,12,18z M14,10H7c-0.55,0-1-0.45-1-1V7 c0-0.55,0.45-1,1-1h7c0.55,0,1,0.45,1,1v2C15,9.55,14.55,10,14,10z</Geometry>
<Geometry x:Key="TextureIcon">M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3z M6.6,16.2l2-2.67 c0.2-0.27,0.6-0.27,0.8,0L11.25,16l2.6-3.47c0.2-0.27,0.6-0.27,0.8,0l2.75,3.67c0.25,0.33,0.01,0.8-0.4,0.8H7 C6.59,17,6.35,16.53,6.6,16.2z</Geometry>
<Geometry x:Key="ModelIcon">M12 6q-.825 0-1.412-.588Q10 4.825 10 4t.588-1.413Q11.175 2 12 2t1.413.587Q14 3.175 14 4q0 .825-.587 1.412Q12.825 6 12 6ZM9 22V9H3V7h18v2h-6v13h-2v-6h-2v6Z</Geometry>
<Geometry x:Key="AnimationIcon">M9 22q-1.45 0-2.725-.55Q5 20.9 4.05 19.95q-.95-.95-1.5-2.225Q2 16.45 2 15q0-2.025 1.05-3.7Q4.1 9.625 5.8 8.75q.5-.975 1.238-1.713Q7.775 6.3 8.75 5.8q.825-1.7 2.525-2.75T15 2q1.45 0 2.725.55Q19 3.1 19.95 4.05q.95.95 1.5 2.225Q22 7.55 22 9q0 2.125-1.05 3.75t-2.75 2.5q-.5.975-1.238 1.712-.737.738-1.712 1.238-.875 1.7-2.55 2.75Q11.025 22 9 22Zm0-2q.825 0 1.588-.25Q11.35 19.5 12 19q-1.45 0-2.725-.55Q8 17.9 7.05 16.95q-.95-.95-1.5-2.225Q5 13.45 5 12q-.5.65-.75 1.412Q4 14.175 4 15q0 1.05.4 1.95.4.9 1.075 1.575.675.675 1.575 1.075.9.4 1.95.4Zm3-3q.825 0 1.613-.25.787-.25 1.437-.75-1.475 0-2.75-.562-1.275-.563-2.225-1.513-.95-.95-1.513-2.225Q8 10.425 8 8.95q-.5.65-.75 1.437Q7 11.175 7 12q0 1.05.388 1.95.387.9 1.087 1.575.675.7 1.575 1.088.9.387 1.95.387Zm3-3q.45 0 .863-.075.412-.075.837-.225.55-1.5.163-2.888-.388-1.387-1.338-2.337-.95-.95-2.337-1.338Q11.8 6.75 10.3 7.3q-.15.425-.225.837Q10 8.55 10 9q0 1.05.387 1.95.388.9 1.088 1.575.675.7 1.575 1.088.9.387 1.95.387Zm4-1.95q.5-.65.75-1.438Q20 9.825 20 9q0-1.05-.387-1.95-.388-.9-1.088-1.575-.675-.7-1.575-1.088Q16.05 4 15 4q-.875 0-1.637.25-.763.25-1.413.75 1.475 0 2.75.562 1.275.563 2.225 1.513.95.95 1.513 2.225.562 1.275.562 2.75Z</Geometry>
<Geometry x:Key="CopyIcon">M3,7L3,7C2.45,7,2,7.45,2,8v13c0,1.1,0.9,2,2,2h11c0.55,0,1-0.45,1-1v0c0-0.55-0.45-1-1-1H4V8C4,7.45,3.55,7,3,7z M15.59,1.59C15.21,1.21,14.7,1,14.17,1H8C6.9,1,6.01,1.9,6.01,3L6,17c0,1.1,0.89,2,1.99,2H19c1.1,0,2-0.9,2-2V7.83 c0-0.53-0.21-1.04-0.59-1.41L15.59,1.59z M14,7V2.5L19.5,8H15C14.45,8,14,7.55,14,7z</Geometry>
<Geometry x:Key="DirectoriesIcon">M14.4,6l-0.24-1.2C14.07,4.34,13.66,4,13.18,4H6C5.45,4,5,4.45,5,5v15c0,0.55,0.45,1,1,1l0,0c0.55,0,1-0.45,1-1v-6h5.6 l0.24,1.2c0.09,0.47,0.5,0.8,0.98,0.8H19c0.55,0,1-0.45,1-1V7c0-0.55-0.45-1-1-1H14.4z</Geometry>
<Geometry x:Key="DirectoriesAddIcon">M20 1v3h3v2h-3v3h-2V6h-3V4h3V1h2zm-8 12c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm2-9.75V7h3v3h2.92c.05.39.08.79.08 1.2 0 3.32-2.67 7.25-8 11.8-5.33-4.55-8-8.48-8-11.8C4 6.22 7.8 3 12 3c.68 0 1.35.08 2 .25z</Geometry>
@ -851,6 +853,52 @@
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="Export Raw Data (.uasset)" Command="{Binding TabCommand}" CommandParameter="Assets_Export_Data">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
<Path Fill="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" Data="{StaticResource ExportIcon}" />
</Canvas>
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Properties (.json)" Command="{Binding TabCommand}" CommandParameter="Assets_Save_Properties">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
<Path Fill="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" Data="{StaticResource SaveIcon}" />
</Canvas>
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Texture (.png)" Command="{Binding TabCommand}" CommandParameter="Assets_Save_Textures">
<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>
<MenuItem Header="Save Model (.psk)" Command="{Binding TabCommand}" CommandParameter="Assets_Save_Models">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
<Path Fill="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" Data="{StaticResource ModelIcon}" />
</Canvas>
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Save Animation (.psa)" Command="{Binding TabCommand}" CommandParameter="Assets_Save_Animations">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">
<Canvas Width="24" Height="24">
<Path Fill="{DynamicResource {x:Static adonisUi:Brushes.ForegroundBrush}}" Data="{StaticResource AnimationIcon}" />
</Canvas>
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="Open Properties" Command="{Binding TabCommand}" CommandParameter="Open_Properties">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">
@ -862,7 +910,6 @@
</Viewbox>
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="Jump to Package Folder" Command="{Binding GoToCommand}" CommandParameter="{Binding Directory}">
<MenuItem.Icon>
<Viewbox Width="16" Height="16">

View File

@ -308,6 +308,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
@ -352,50 +353,42 @@
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock Grid.Row="4" Grid.Column="0" Text="Preview in Model Viewer" VerticalAlignment="Center" Margin="0 0 0 5" />
<UniformGrid Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" Rows="1" Columns="3" Margin="0 5 0 10">
<CheckBox Content="Static Meshes" HorizontalAlignment="Left"
IsChecked="{Binding PreviewStaticMeshes, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"/>
<CheckBox Content="Skeletal Meshes" HorizontalAlignment="Center"
IsChecked="{Binding PreviewSkeletalMeshes, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"/>
<CheckBox Content="Materials" HorizontalAlignment="Right"
IsChecked="{Binding PreviewMaterials, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"/>
</UniformGrid>
<Separator Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="5" Style="{StaticResource CustomSeparator}" />
<TextBlock Grid.Row="5" Grid.Column="0" Text="Auto-Export without Previewing" VerticalAlignment="Center" Margin="0 0 0 5" />
<UniformGrid Grid.Row="5" Grid.Column="2" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" Rows="1" Columns="3" Margin="0 5 0 10">
<CheckBox Content="Static Meshes" HorizontalAlignment="Left"
IsChecked="{Binding SaveStaticMeshes, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}" />
<CheckBox Content="Skeletal Meshes" HorizontalAlignment="Center"
IsChecked="{Binding SaveSkeletalMeshes, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"/>
<CheckBox Content="Materials" HorizontalAlignment="Right"
IsChecked="{Binding SaveMaterials, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"/>
</UniformGrid>
<TextBlock Grid.Row="5" Grid.Column="0" Text="Preview Static Meshes" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="5" Grid.Column="2" Grid.ColumnSpan="3" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding PreviewStaticMeshes, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" Margin="0 5 0 5"/>
<TextBlock Grid.Row="6" Grid.Column="0" Text="Preview Levels (.umap)" VerticalAlignment="Center" Margin="0 0 0 5" />
<TextBlock Grid.Row="6" Grid.Column="0" Text="Preview Skeletal Meshes" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="6" Grid.Column="2" Grid.ColumnSpan="3" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding PreviewSkeletalMeshes, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" Margin="0 5 0 5"/>
<TextBlock Grid.Row="7" Grid.Column="0" Text="Preview Materials" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="7" Grid.Column="2" Grid.ColumnSpan="3" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding PreviewMaterials, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" Margin="0 5 0 5"/>
<TextBlock Grid.Row="8" Grid.Column="0" Text="Preview Levels (.umap)" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="8" Grid.Column="2" Grid.ColumnSpan="3" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding PreviewWorlds, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" Margin="0 5 0 5"/>
<TextBlock Grid.Row="7" Grid.Column="0" Text="Auto-Export Morph Targets" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="7" Grid.Column="2" Grid.ColumnSpan="3" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
<TextBlock Grid.Row="9" Grid.Column="0" Text="Save Morph Targets in Meshes" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="9" Grid.Column="2" Grid.ColumnSpan="3" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding SaveMorphTargets, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" Margin="0 5 0 5"/>
<TextBlock Grid.Row="8" Grid.Column="0" Text="Auto-Export Animations" VerticalAlignment="Center" Margin="0 0 0 5" />
<CheckBox Grid.Row="8" Grid.Column="2" Grid.ColumnSpan="3" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding SaveAnimations, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" Margin="0 5 0 5"/>
<TextBlock Grid.Row="9" Grid.Column="0" Text="Export Skeletons as Empty Meshes" VerticalAlignment="Center" />
<CheckBox Grid.Row="9" Grid.Column="2" Grid.ColumnSpan="3" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
<TextBlock Grid.Row="10" Grid.Column="0" Text="Handle Skeletons as Empty Meshes" VerticalAlignment="Center" />
<CheckBox Grid.Row="10" Grid.Column="2" Grid.ColumnSpan="3" Content="{Binding IsChecked, RelativeSource={RelativeSource Self}, Converter={x:Static converters:BoolToToggleConverter.Instance}}"
IsChecked="{Binding SaveSkeletonAsMesh, Source={x:Static local:Settings.UserSettings.Default}, Mode=TwoWay}"
Style="{DynamicResource {x:Static adonisUi:Styles.ToggleSwitch}}" Margin="0 5 0 0"/>
<Separator Grid.Row="10" Grid.Column="0" Grid.ColumnSpan="5" Style="{StaticResource CustomSeparator}" />
<Separator Grid.Row="11" Grid.Column="0" Grid.ColumnSpan="5" Style="{StaticResource CustomSeparator}" />
<TextBlock Grid.Row="11" Grid.Column="0" Text="Texture Format" VerticalAlignment="Center" Margin="0 0 0 5" />
<ComboBox Grid.Row="11" Grid.Column="2" Grid.ColumnSpan="3" ItemsSource="{Binding SettingsView.TextureExportFormats}" SelectedItem="{Binding SettingsView.SelectedTextureExportFormat, Mode=TwoWay}"
<TextBlock Grid.Row="12" Grid.Column="0" Text="Texture Format" VerticalAlignment="Center" Margin="0 0 0 5" />
<ComboBox Grid.Row="12" 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>