Merge branch 'dev' of https://github.com/4sval/FModel into dev
Some checks are pending
FModel QA Builder / build (push) Waiting to run

This commit is contained in:
GMatrixGames
2024-07-22 11:03:51 -04:00
2 changed files with 45 additions and 8 deletions

View File

@@ -240,18 +240,31 @@ public class TabItem : ViewModel
public void AddImage(UTexture texture, bool save, bool updateUi)
{
var img = texture.Decode(UserSettings.Default.CurrentDir.TexturePlatform);
if (texture is UTextureCube)
var appendLayerNumber = false;
var img = new SKBitmap[1];
if (texture is UTexture2DArray textureArray)
{
img = img?.ToPanorama();
img = textureArray.DecodeTextureArray(UserSettings.Default.CurrentDir.TexturePlatform);
appendLayerNumber = true;
}
else
{
img[0] = texture.Decode(UserSettings.Default.CurrentDir.TexturePlatform);
if (texture is UTextureCube)
{
img[0] = img[0]?.ToPanorama();
}
}
AddImage(texture.Name, texture.RenderNearestNeighbor, img, save, updateUi);
AddImage(texture.Name, texture.RenderNearestNeighbor, img, save, updateUi, appendLayerNumber);
}
public void AddImage(string name, bool rnn, SKBitmap[] img, bool save, bool updateUi)
public void AddImage(string name, bool rnn, SKBitmap[] img, bool save, bool updateUi, bool appendLayerNumber = false)
{
foreach (var i in img) AddImage(name, rnn, i, save, updateUi);
for (var i = 0; i < img.Length; i++)
{
AddImage($"{name}{(appendLayerNumber ? $"_{i}" : "")}", rnn, img[i], save, updateUi);
}
}
public void AddImage(string name, bool rnn, SKBitmap img, bool save, bool updateUi)

View File

@@ -1,4 +1,7 @@
using FModel.ViewModels;
using System;
using System.IO;
using System.Linq;
using FModel.ViewModels;
using Ookii.Dialogs.Wpf;
using System.Windows;
using CUE4Parse.Utils;
@@ -39,8 +42,29 @@ public partial class DirectorySelector
var folderBrowser = new VistaFolderBrowserDialog {ShowNewFolderButton = false};
if (folderBrowser.ShowDialog() == true)
{
HelloMyNameIsGame.Text = folderBrowser.SelectedPath.SubstringAfterLast('\\');
HelloGameMyNameIsDirectory.Text = folderBrowser.SelectedPath;
// install_folder/
// ├─ Engine/
// ├─ GameName/
// │ ├─ Binaries/
// │ ├─ Content/
// │ │ ├─ Paks/
// our goal is to get the GameName folder
var currentFolder = folderBrowser.SelectedPath.SubstringAfterLast('\\');
if (currentFolder.Equals("Paks", StringComparison.InvariantCulture))
{
var dir = new DirectoryInfo(folderBrowser.SelectedPath);
if (dir.Parent is { Parent: not null } &&
dir.Parent.Name.Equals("Content", StringComparison.InvariantCulture) &&
dir.Parent.Parent.GetDirectories().Any(x => x.Name == "Binaries"))
{
HelloMyNameIsGame.Text = dir.Parent.Parent.Name;
return;
}
}
HelloMyNameIsGame.Text = folderBrowser.SelectedPath.SubstringAfterLast('\\');
}
}