From 79399e5db2bbd744c0ae2ffabc8c4060f8c7574d Mon Sep 17 00:00:00 2001 From: 4sval Date: Fri, 27 Jan 2023 23:45:55 +0100 Subject: [PATCH] usable again --- CUE4Parse | 2 +- FModel/Creator/CreatorPackage.cs | 1 + FModel/MainWindow.xaml | 2 + FModel/MainWindow.xaml.cs | 8 -- FModel/Resources/light.vert | 2 +- FModel/Views/ImageMerger.xaml | 8 +- FModel/Views/ImageMerger.xaml.cs | 2 + FModel/Views/SearchView.xaml | 76 +++++++++++++++++++ FModel/Views/Snooper/Lights/Light.cs | 4 - FModel/Views/Snooper/Lights/PointLight.cs | 2 +- FModel/Views/Snooper/Lights/SpotLight.cs | 2 +- .../Snooper/Models/Animations/Animation.cs | 2 - FModel/Views/Snooper/Models/Model.cs | 10 --- FModel/Views/Snooper/Renderer.cs | 9 +-- FModel/Views/Snooper/Shading/Shader.cs | 2 +- FModel/Views/Snooper/SnimGui.cs | 7 +- 16 files changed, 96 insertions(+), 43 deletions(-) diff --git a/CUE4Parse b/CUE4Parse index c1d74305..3b74a52b 160000 --- a/CUE4Parse +++ b/CUE4Parse @@ -1 +1 @@ -Subproject commit c1d74305a2ea139fea16abe31edd559645f96548 +Subproject commit 3b74a52bb943ffd3365b94d1fcadb05550ebfdaa diff --git a/FModel/Creator/CreatorPackage.cs b/FModel/Creator/CreatorPackage.cs index ac794ab2..527c79e6 100644 --- a/FModel/Creator/CreatorPackage.cs +++ b/FModel/Creator/CreatorPackage.cs @@ -107,6 +107,7 @@ public class CreatorPackage : IDisposable case "FortChallengeBundleScheduleDefinition": case "FortWeaponMeleeDualWieldItemDefinition": case "FortDailyRewardScheduleTokenDefinition": + case "FortCreativeWeaponRangedItemDefinition": case "FortCreativeRealEstatePlotItemDefinition": case "AthenaDanceItemDefinition_AdHocSquadsJoin_C": creator = _style switch diff --git a/FModel/MainWindow.xaml b/FModel/MainWindow.xaml index 9f32042d..f5d533a2 100644 --- a/FModel/MainWindow.xaml +++ b/FModel/MainWindow.xaml @@ -339,6 +339,7 @@ + @@ -494,6 +495,7 @@ + diff --git a/FModel/MainWindow.xaml.cs b/FModel/MainWindow.xaml.cs index 1d1f8edc..191079d2 100644 --- a/FModel/MainWindow.xaml.cs +++ b/FModel/MainWindow.xaml.cs @@ -84,14 +84,6 @@ public partial class MainWindow // await _threadWorkerView.Begin(cancellationToken => // _applicationView.CUE4Parse.Extract(cancellationToken, // "FortniteGame/Content/Animation/Game/MainPlayer/Emotes/Acrobatic_Superhero/Emote_AcrobaticSuperhero_CMM.uasset")); -#endif -#if DEBUG - // await _threadWorkerView.Begin(cancellationToken => - // _applicationView.CUE4Parse.Extract(cancellationToken, - // "Hk_project/Content/Character/Drone/Mesh/SKM_Drone.uasset")); - // await _threadWorkerView.Begin(cancellationToken => - // _applicationView.CUE4Parse.Extract(cancellationToken, - // "Hk_project/Content/Animation/DRONE/B12_TestSpin360.uasset")); #endif } diff --git a/FModel/Resources/light.vert b/FModel/Resources/light.vert index 0b7778ce..06802a1d 100644 --- a/FModel/Resources/light.vert +++ b/FModel/Resources/light.vert @@ -10,7 +10,7 @@ out vec2 fTexCoords; void main() { - float scale = 0.0075; + float scale = 0.075; mat4 result; result[0] = vec4(scale, 0.0, 0.0, 0.0); result[1] = vec4(0.0, scale, 0.0, 0.0); diff --git a/FModel/Views/ImageMerger.xaml b/FModel/Views/ImageMerger.xaml index cda98bba..5c4296e6 100644 --- a/FModel/Views/ImageMerger.xaml +++ b/FModel/Views/ImageMerger.xaml @@ -38,7 +38,7 @@ - + @@ -51,10 +51,10 @@ - + + IsMoveToPointEnabled="True" Minimum="1" Maximum="20" TickFrequency="1" MouseUp="Click_DrawPreview" Thumb.DragCompleted="DrawPreview"/> - \ No newline at end of file + diff --git a/FModel/Views/ImageMerger.xaml.cs b/FModel/Views/ImageMerger.xaml.cs index f6175aec..b665119b 100644 --- a/FModel/Views/ImageMerger.xaml.cs +++ b/FModel/Views/ImageMerger.xaml.cs @@ -84,6 +84,8 @@ public partial class ImageMerger { maxWidth = curW + image.Width + margin; curH += lineMaxHeight + margin; + if (curH > maxHeight) + maxHeight = curH; curW = 0; lineMaxHeight = 0; diff --git a/FModel/Views/SearchView.xaml b/FModel/Views/SearchView.xaml index 351a6271..ca24c3e9 100644 --- a/FModel/Views/SearchView.xaml +++ b/FModel/Views/SearchView.xaml @@ -155,6 +155,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FModel/Views/Snooper/Lights/Light.cs b/FModel/Views/Snooper/Lights/Light.cs index 74635f3f..77c2bbff 100644 --- a/FModel/Views/Snooper/Lights/Light.cs +++ b/FModel/Views/Snooper/Lights/Light.cs @@ -28,7 +28,6 @@ public abstract class Light : IDisposable 1f, 1f, 0f, 1f, -1f, 0 }; - public string Name; public readonly FGuid Model; public readonly Texture Icon; public Transform Transform; @@ -100,7 +99,6 @@ public abstract class Light : IDisposable public void Render(Shader shader) { - GL.Disable(EnableCap.DepthTest); GL.Disable(EnableCap.CullFace); _vao.Bind(); @@ -112,7 +110,6 @@ public abstract class Light : IDisposable GL.DrawArrays(PrimitiveType.Triangles, 0, Indices.Length); GL.Enable(EnableCap.CullFace); - GL.Enable(EnableCap.DepthTest); } public virtual void Render(int i, Shader shader) @@ -124,7 +121,6 @@ public abstract class Light : IDisposable public virtual void ImGuiLight() { - SnimGui.Layout("Position");SnimGui.TooltipCopy(Transform.Matrix.Translation.ToString()); SnimGui.Layout("Color");ImGui.PushID(1); ImGui.ColorEdit4("", ref Color, ImGuiColorEditFlags.NoAlpha); ImGui.PopID();SnimGui.Layout("Intensity");ImGui.PushID(2); diff --git a/FModel/Views/Snooper/Lights/PointLight.cs b/FModel/Views/Snooper/Lights/PointLight.cs index 81ac8e58..55fcda20 100644 --- a/FModel/Views/Snooper/Lights/PointLight.cs +++ b/FModel/Views/Snooper/Lights/PointLight.cs @@ -23,7 +23,7 @@ public class PointLight : Light public PointLight(FGuid model, Texture icon, UObject parent, UObject point, Transform transform) : base(model, icon, parent, point, transform) { - if (!point.TryGetValue(out float radius, "SourceRadius", "AttenuationRadius")) + if (!point.TryGetValue(out float radius, "AttenuationRadius", "SourceRadius")) radius = 1.0f; radius *= Constants.SCALE_DOWN_RATIO; diff --git a/FModel/Views/Snooper/Lights/SpotLight.cs b/FModel/Views/Snooper/Lights/SpotLight.cs index 1d861551..0b20f062 100644 --- a/FModel/Views/Snooper/Lights/SpotLight.cs +++ b/FModel/Views/Snooper/Lights/SpotLight.cs @@ -23,7 +23,7 @@ public class SpotLight : Light public SpotLight(FGuid model, Texture icon, UObject parent, UObject spot, Transform transform) : base(model, icon, parent, spot, transform) { - if (!spot.TryGetValue(out Attenuation, "SourceRadius", "AttenuationRadius")) + if (!spot.TryGetValue(out Attenuation, "AttenuationRadius", "SourceRadius")) Attenuation = 1.0f; Attenuation *= Constants.SCALE_DOWN_RATIO; diff --git a/FModel/Views/Snooper/Models/Animations/Animation.cs b/FModel/Views/Snooper/Models/Animations/Animation.cs index 4937155f..ed3dc90c 100644 --- a/FModel/Views/Snooper/Models/Animations/Animation.cs +++ b/FModel/Views/Snooper/Models/Animations/Animation.cs @@ -1,7 +1,5 @@ using System; -using System.Numerics; using CUE4Parse_Conversion.Animations; -using CUE4Parse.UE4.Objects.Core.Math; namespace FModel.Views.Snooper.Models.Animations; diff --git a/FModel/Views/Snooper/Models/Model.cs b/FModel/Views/Snooper/Models/Model.cs index 9f1589a3..2de4a53e 100644 --- a/FModel/Views/Snooper/Models/Model.cs +++ b/FModel/Views/Snooper/Models/Model.cs @@ -230,15 +230,6 @@ public class Model : IDisposable public void UpdateMatrices(Options options) { UpdateMatrices(); - if (HasSkeleton && Skeleton.Anim != null) - { - for (int i = 0; i < options.Lights.Count; i++) - { - options.Lights[i].Transform = Skeleton.Anim.BoneTransforms[i][Skeleton.Anim.CurrentTime]; - options.Lights[i].UpdateMatrices(); - } - } - foreach (var socket in Sockets) { foreach (var attached in socket.AttachedModels) @@ -371,7 +362,6 @@ public class Model : IDisposable shader.SetUniform("uMorphTime", MorphTime); if (!outline) { - if (HasSkeleton) Skeleton.SetUniform(shader); shader.SetUniform("uUvCount", UvCount); shader.SetUniform("uHasVertexColors", HasVertexColors); } diff --git a/FModel/Views/Snooper/Renderer.cs b/FModel/Views/Snooper/Renderer.cs index a81616de..f1019c59 100644 --- a/FModel/Views/Snooper/Renderer.cs +++ b/FModel/Views/Snooper/Renderer.cs @@ -131,7 +131,7 @@ public class Renderer : IDisposable } { // light pass - var uNumLights = Math.Min(Options.Lights.Count, 150); + var uNumLights = Math.Min(Options.Lights.Count, 100); _shader.SetUniform("uNumLights", ShowLights ? uNumLights : 0); if (ShowLights) @@ -178,13 +178,6 @@ public class Renderer : IDisposable if (Options.Models.ContainsKey(guid) || !original.TryConvert(out var mesh)) return; Options.Models[guid] = new Model(original, mesh); - foreach ((var name, var index) in Options.Models[guid].Skeleton.BonesIndexByName) - { - if (!Options.Models[guid].Skeleton.BonesTransformByIndex.TryGetValue(index, out var transform)) continue; - - Options.Lights.Add( - new PointLight(guid, Options.Icons["pointlight"], original, original, transform) { Name = name}); - } Options.SelectModel(guid); SetupCamera(Options.Models[guid].Box); } diff --git a/FModel/Views/Snooper/Shading/Shader.cs b/FModel/Views/Snooper/Shading/Shader.cs index 5599f260..4cbc9b13 100644 --- a/FModel/Views/Snooper/Shading/Shader.cs +++ b/FModel/Views/Snooper/Shading/Shader.cs @@ -122,7 +122,7 @@ public class Shader : IDisposable _uniformsLocation.Add(name, location); if (location == -1) { - // throw new Exception($"{name} uniform not found on shader."); + throw new Exception($"{name} uniform not found on shader."); } } return location; diff --git a/FModel/Views/Snooper/SnimGui.cs b/FModel/Views/Snooper/SnimGui.cs index 43a8fdf1..5f5c8129 100644 --- a/FModel/Views/Snooper/SnimGui.cs +++ b/FModel/Views/Snooper/SnimGui.cs @@ -159,7 +159,9 @@ public class SnimGui for (int i = 0; i < s.Renderer.Options.Lights.Count; i++) { var light = s.Renderer.Options.Lights[i]; - var id = $"{light.Name}##{i}"; + var id = s.Renderer.Options.TryGetModel(light.Model, out var lightModel) ? lightModel.Name : "None"; + + id += $"##{i}"; if (ImGui.TreeNode(id) && ImGui.BeginTable(id, 2)) { s.Renderer.Options.SelectModel(light.Model); @@ -342,7 +344,8 @@ Snooper aims to give an accurate preview of models, materials, skeletal animatio _saver.Value = model.TrySave(out _saver.Label, out _saver.Path); s.WindowShouldFreeze(false); } - ImGui.BeginDisabled(!model.HasSkeleton); + ImGui.BeginDisabled(true); + // ImGui.BeginDisabled(!model.HasSkeleton); if (ImGui.Selectable("Animate")) { s.Renderer.Options.AnimateMesh(true);