diff --git a/CUE4Parse b/CUE4Parse index 61365034..d9e236a7 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit 61365034c395794512d29145c2cb052f3cb5427a +Subproject commit d9e236a759d0815cf701cb92d14124658a60b2be diff --git a/FModel/ViewModels/CUE4ParseViewModel.cs b/FModel/ViewModels/CUE4ParseViewModel.cs index 954da98a..69020523 100644 --- a/FModel/ViewModels/CUE4ParseViewModel.cs +++ b/FModel/ViewModels/CUE4ParseViewModel.cs @@ -647,6 +647,7 @@ public void Extract(CancellationToken cancellationToken, string fullPath, bool a case "bat": case "dat": case "cfg": + case "ddr": case "ide": case "ipl": case "zon": diff --git a/FModel/ViewModels/SearchViewModel.cs b/FModel/ViewModels/SearchViewModel.cs index 301a6067..426d0d6e 100644 --- a/FModel/ViewModels/SearchViewModel.cs +++ b/FModel/ViewModels/SearchViewModel.cs @@ -58,7 +58,7 @@ private bool ItemFilter(object item, IEnumerable filters) return filters.All(x => assetItem.FullPath.Contains(x, HasMatchCaseEnabled ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase)); var o = RegexOptions.None; - if (HasMatchCaseEnabled) o |= RegexOptions.IgnoreCase; + if (!HasMatchCaseEnabled) o |= RegexOptions.IgnoreCase; return new Regex(FilterText, o).Match(assetItem.FullPath).Success; } -} \ No newline at end of file +} diff --git a/FModel/Views/Snooper/Options.cs b/FModel/Views/Snooper/Options.cs index 0493fcbd..7c190ab9 100644 --- a/FModel/Views/Snooper/Options.cs +++ b/FModel/Views/Snooper/Options.cs @@ -9,6 +9,7 @@ using FModel.Views.Snooper.Lights; using FModel.Views.Snooper.Models; using FModel.Views.Snooper.Shading; +using SkiaSharp; namespace FModel.Views.Snooper; @@ -185,17 +186,26 @@ public void SelectMorph(int index, SkeletalModel model) model.UpdateMorph(SelectedMorph); } - public bool TryGetTexture(UTexture2D o, bool fix, out Texture texture) + public bool TryGetTexture(UTexture o, bool fix, out Texture texture) { var guid = o.LightingGuid; - if (!Textures.TryGetValue(guid, out texture) && - o.Decode(UserSettings.Default.PreviewMaxTextureSize, UserSettings.Default.CurrentDir.TexturePlatform) is { } bitmap) + if (Textures.TryGetValue(guid, out texture)) return texture != null; + + SKBitmap bitmap = o switch + { + UTexture2D texture2D => texture2D.Decode(UserSettings.Default.PreviewMaxTextureSize, UserSettings.Default.CurrentDir.TexturePlatform), + UTexture2DArray texture2DArray => texture2DArray.DecodeTextureArray(UserSettings.Default.CurrentDir.TexturePlatform)?.FirstOrDefault(), + _ => o.Decode(UserSettings.Default.CurrentDir.TexturePlatform) + }; + + if (bitmap is not null) { texture = new Texture(bitmap, o); if (fix) TextureHelper.FixChannels(_game, texture); Textures[guid] = texture; bitmap.Dispose(); } + return texture != null; } diff --git a/FModel/Views/Snooper/Shading/Material.cs b/FModel/Views/Snooper/Shading/Material.cs index 8b0c9f03..05d7e354 100644 --- a/FModel/Views/Snooper/Shading/Material.cs +++ b/FModel/Views/Snooper/Shading/Material.cs @@ -158,9 +158,9 @@ public void Setup(Options options, int uvCount) /// list of texture parameter names by uv channel /// fallback texture name to use if no top texture found /// if no top texture, no fallback texture, then use the first texture found - private Texture[] FillTextures(Options options, int uvCount, bool top, IReadOnlyList triggers, string fallback, bool first = false) + private Texture[] FillTextures(Options options, int uvCount, bool top, string[][] triggers, string fallback, bool first = false) { - UTexture2D original; + UTexture original; Texture transformed; var fix = fallback == CMaterialParams2.FallbackSpecularMasks; var textures = new Texture[uvCount]; @@ -192,7 +192,7 @@ private Texture[] FillTextures(Options options, int uvCount, bool top, IReadOnly /// reference array /// list of color parameter names by uv channel /// fallback color to use if no trigger was found - private Vector4[] FillColors(int uvCount, IReadOnlyList textures, IReadOnlyList triggers, Vector4 fallback) + private Vector4[] FillColors(int uvCount, Texture[] textures, string[][] triggers, Vector4 fallback) { var colors = new Vector4[uvCount]; for (int i = 0; i < colors.Length; i++) diff --git a/FModel/Views/Snooper/Shading/Texture.cs b/FModel/Views/Snooper/Shading/Texture.cs index e5d37d29..d2d5f157 100644 --- a/FModel/Views/Snooper/Shading/Texture.cs +++ b/FModel/Views/Snooper/Shading/Texture.cs @@ -79,15 +79,13 @@ public Texture(int width, int height) : this(TextureType.Framebuffer) GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, _target, _handle, 0); } - public Texture(SKBitmap bitmap, UTexture2D texture2D) : this(TextureType.Normal) + public Texture(SKBitmap bitmap, UTexture texture2D) : this(TextureType.Normal) { Type = texture2D.ExportType; Guid = texture2D.LightingGuid; Name = texture2D.Name; Path = texture2D.GetPathName(); Format = texture2D.Format; - ImportedWidth = texture2D.ImportedSize.X; - ImportedHeight = texture2D.ImportedSize.Y; Width = bitmap.Width; Height = bitmap.Height; Bind(TextureUnit.Texture0);