mirror of
https://github.com/4sval/FModel.git
synced 2026-07-28 06:19:43 -05:00
default layout + switches + no more scroll flicker
This commit is contained in:
parent
1ae75d36d2
commit
88fa0dfd82
|
|
@ -1 +1 @@
|
||||||
Subproject commit bd6b84eac5dc4c852afe330be2c286dd4b48d626
|
Subproject commit f71be1eb998ee38e94a1a77994fb21e0338905c1
|
||||||
|
|
@ -31,12 +31,13 @@ public class ImGuiController : IDisposable
|
||||||
|
|
||||||
private int _windowWidth;
|
private int _windowWidth;
|
||||||
private int _windowHeight;
|
private int _windowHeight;
|
||||||
|
// private string _iniPath;
|
||||||
|
|
||||||
private ImFontPtr _normal;
|
private ImFontPtr _normal;
|
||||||
private ImFontPtr _bold;
|
private ImFontPtr _bold;
|
||||||
private ImFontPtr _semiBold;
|
private ImFontPtr _semiBold;
|
||||||
|
|
||||||
private readonly System.Numerics.Vector2 _scaleFactor = System.Numerics.Vector2.One;
|
private readonly Vector2 _scaleFactor = Vector2.One;
|
||||||
|
|
||||||
private static bool KHRDebugAvailable = false;
|
private static bool KHRDebugAvailable = false;
|
||||||
|
|
||||||
|
|
@ -44,6 +45,7 @@ public class ImGuiController : IDisposable
|
||||||
{
|
{
|
||||||
_windowWidth = width;
|
_windowWidth = width;
|
||||||
_windowHeight = height;
|
_windowHeight = height;
|
||||||
|
// _iniPath = Path.Combine(UserSettings.Default.OutputDirectory, ".data", "imgui.ini");
|
||||||
|
|
||||||
int major = GL.GetInteger(GetPName.MajorVersion);
|
int major = GL.GetInteger(GetPName.MajorVersion);
|
||||||
int minor = GL.GetInteger(GetPName.MinorVersion);
|
int minor = GL.GetInteger(GetPName.MinorVersion);
|
||||||
|
|
@ -52,6 +54,8 @@ public class ImGuiController : IDisposable
|
||||||
|
|
||||||
IntPtr context = ImGui.CreateContext();
|
IntPtr context = ImGui.CreateContext();
|
||||||
ImGui.SetCurrentContext(context);
|
ImGui.SetCurrentContext(context);
|
||||||
|
// ImGui.LoadIniSettingsFromDisk(_iniPath);
|
||||||
|
|
||||||
var io = ImGui.GetIO();
|
var io = ImGui.GetIO();
|
||||||
_normal = io.Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\segoeui.ttf", 16);
|
_normal = io.Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\segoeui.ttf", 16);
|
||||||
_bold = io.Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\segoeuib.ttf", 16);
|
_bold = io.Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\segoeuib.ttf", 16);
|
||||||
|
|
@ -237,7 +241,8 @@ outputColor = color * texture(in_fontTexture, texCoord);
|
||||||
private void SetPerFrameImGuiData(float deltaSeconds)
|
private void SetPerFrameImGuiData(float deltaSeconds)
|
||||||
{
|
{
|
||||||
ImGuiIOPtr io = ImGui.GetIO();
|
ImGuiIOPtr io = ImGui.GetIO();
|
||||||
io.DisplaySize = new System.Numerics.Vector2(
|
// if (io.WantSaveIniSettings) ImGui.SaveIniSettingsToDisk(_iniPath);
|
||||||
|
io.DisplaySize = new Vector2(
|
||||||
_windowWidth / _scaleFactor.X,
|
_windowWidth / _scaleFactor.X,
|
||||||
_windowHeight / _scaleFactor.Y);
|
_windowHeight / _scaleFactor.Y);
|
||||||
io.DisplayFramebufferScale = _scaleFactor;
|
io.DisplayFramebufferScale = _scaleFactor;
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ public partial class MainWindow
|
||||||
await _applicationView.CUE4Parse.InitInformation();
|
await _applicationView.CUE4Parse.InitInformation();
|
||||||
#endif
|
#endif
|
||||||
await _applicationView.CUE4Parse.InitMappings();
|
await _applicationView.CUE4Parse.InitMappings();
|
||||||
|
await _applicationView.InitImGuiSettings();
|
||||||
await _applicationView.InitVgmStream();
|
await _applicationView.InitVgmStream();
|
||||||
await _applicationView.InitOodle();
|
await _applicationView.InitOodle();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,4 +185,17 @@ public class ApplicationViewModel : ViewModel
|
||||||
(OodleLZ_FuzzSafe) a, (OodleLZ_CheckCRC) b, (OodleLZ_Verbosity) c, d, e, f, g, h, i, (OodleLZ_Decode_ThreadPhase) threadModule);
|
(OodleLZ_FuzzSafe) a, (OodleLZ_CheckCRC) b, (OodleLZ_Verbosity) c, d, e, f, g, h, i, (OodleLZ_Decode_ThreadPhase) threadModule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public async Task InitImGuiSettings()
|
||||||
|
{
|
||||||
|
var imgui = Path.Combine(/*UserSettings.Default.OutputDirectory, ".data", */"imgui.ini");
|
||||||
|
if (File.Exists(imgui)) return;
|
||||||
|
|
||||||
|
await ApplicationService.ApiEndpointView.DownloadFileAsync("https://cdn.fmodel.app/d/configurations/imgui.ini", imgui);
|
||||||
|
if (new FileInfo(imgui).Length == 0)
|
||||||
|
{
|
||||||
|
FLogger.AppendError();
|
||||||
|
FLogger.AppendText("Could not download ImGui settings", Constants.WHITE, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -215,15 +215,8 @@ public class Material : IDisposable
|
||||||
private const float _zero = 0.000001f; // doesn't actually work if _infinite is used as max value /shrug
|
private const float _zero = 0.000001f; // doesn't actually work if _infinite is used as max value /shrug
|
||||||
private const float _infinite = 0.0f;
|
private const float _infinite = 0.0f;
|
||||||
private const ImGuiSliderFlags _clamp = ImGuiSliderFlags.AlwaysClamp;
|
private const ImGuiSliderFlags _clamp = ImGuiSliderFlags.AlwaysClamp;
|
||||||
private void PushStyle()
|
|
||||||
{
|
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(8, 3));
|
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, new Vector2(0, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ImGuiParameters()
|
public void ImGuiParameters()
|
||||||
{
|
{
|
||||||
PushStyle();
|
|
||||||
if (ImGui.BeginTable("parameters", 2))
|
if (ImGui.BeginTable("parameters", 2))
|
||||||
{
|
{
|
||||||
SnimGui.Layout("Roughness");ImGui.PushID(1);
|
SnimGui.Layout("Roughness");ImGui.PushID(1);
|
||||||
|
|
@ -248,7 +241,6 @@ public class Material : IDisposable
|
||||||
}
|
}
|
||||||
ImGui.EndTable();
|
ImGui.EndTable();
|
||||||
}
|
}
|
||||||
ImGui.PopStyleVar(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ImGuiDictionaries<T>(string id, Dictionary<string, T> dictionary, bool center = false, bool wrap = false)
|
public void ImGuiDictionaries<T>(string id, Dictionary<string, T> dictionary, bool center = false, bool wrap = false)
|
||||||
|
|
@ -269,7 +261,6 @@ public class Material : IDisposable
|
||||||
|
|
||||||
public void ImGuiTextures(Dictionary<string, Texture> icons, Model model)
|
public void ImGuiTextures(Dictionary<string, Texture> icons, Model model)
|
||||||
{
|
{
|
||||||
PushStyle();
|
|
||||||
if (ImGui.BeginTable("material_textures", 2))
|
if (ImGui.BeginTable("material_textures", 2))
|
||||||
{
|
{
|
||||||
SnimGui.Layout("Channel");ImGui.PushID(1); ImGui.BeginDisabled(model.NumTexCoords < 2);
|
SnimGui.Layout("Channel");ImGui.PushID(1); ImGui.BeginDisabled(model.NumTexCoords < 2);
|
||||||
|
|
@ -294,7 +285,6 @@ public class Material : IDisposable
|
||||||
|
|
||||||
ImGui.EndTable();
|
ImGui.EndTable();
|
||||||
}
|
}
|
||||||
ImGui.PopStyleVar(2);
|
|
||||||
|
|
||||||
ImGui.Image(GetSelectedTexture() ?? icons["noimage"].GetPointer(), new Vector2(ImGui.GetContentRegionAvail().X), Vector2.Zero, Vector2.One, Vector4.One, new Vector4(1.0f, 1.0f, 1.0f, 0.25f));
|
ImGui.Image(GetSelectedTexture() ?? icons["noimage"].GetPointer(), new Vector2(ImGui.GetContentRegionAvail().X), Vector2.Zero, Vector2.One, Vector4.One, new Vector4(1.0f, 1.0f, 1.0f, 0.25f));
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
|
|
|
||||||
|
|
@ -67,12 +67,16 @@ public class Model : IDisposable
|
||||||
if (morphTargets is not { Length: > 0 })
|
if (morphTargets is not { Length: > 0 })
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var length = morphTargets.Length;
|
||||||
|
|
||||||
HasMorphTargets = true;
|
HasMorphTargets = true;
|
||||||
Morphs = new Morph[morphTargets.Length];
|
Morphs = new Morph[length];
|
||||||
for (var i = 0; i < Morphs.Length; i++)
|
for (var i = 0; i < Morphs.Length; i++)
|
||||||
{
|
{
|
||||||
Morphs[i] = new Morph(Vertices, _vertexSize, morphTargets[i].Load<UMorphTarget>());
|
Morphs[i] = new Morph(Vertices, _vertexSize, morphTargets[i].Load<UMorphTarget>());
|
||||||
|
Services.ApplicationService.ApplicationView.Status.UpdateStatusLabel($"{Morphs[i].Name} ... {i}/{length}");
|
||||||
}
|
}
|
||||||
|
Services.ApplicationService.ApplicationView.Status.UpdateStatusLabel("");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Model(string name, string type, ResolvedObject[] materials, FPackageIndex skeleton, CBaseMeshLod lod, CMeshVertex[] vertices, Transform transform = null) : this(name, type)
|
private Model(string name, string type, ResolvedObject[] materials, FPackageIndex skeleton, CBaseMeshLod lod, CMeshVertex[] vertices, Transform transform = null) : this(name, type)
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public class SnimGui
|
||||||
|
|
||||||
SectionWindow("Material Inspector", s.Renderer, DrawMaterialInspector, false);
|
SectionWindow("Material Inspector", s.Renderer, DrawMaterialInspector, false);
|
||||||
|
|
||||||
Window("Timeline", () => {});
|
// Window("Timeline", () => {});
|
||||||
Window("World", () => DrawWorld(s), false);
|
Window("World", () => DrawWorld(s), false);
|
||||||
Window("Sockets", () => DrawSockets(s));
|
Window("Sockets", () => DrawSockets(s));
|
||||||
|
|
||||||
|
|
@ -53,8 +53,6 @@ public class SnimGui
|
||||||
ImGui.SetNextItemOpen(true, ImGuiCond.Appearing);
|
ImGui.SetNextItemOpen(true, ImGuiCond.Appearing);
|
||||||
if (ImGui.CollapsingHeader("Editor"))
|
if (ImGui.CollapsingHeader("Editor"))
|
||||||
{
|
{
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(8, 3));
|
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, new Vector2(0, 1));
|
|
||||||
if (ImGui.BeginTable("world_editor", 2))
|
if (ImGui.BeginTable("world_editor", 2))
|
||||||
{
|
{
|
||||||
Layout("Skybox");ImGui.PushID(1);
|
Layout("Skybox");ImGui.PushID(1);
|
||||||
|
|
@ -70,7 +68,6 @@ public class SnimGui
|
||||||
|
|
||||||
ImGui.EndTable();
|
ImGui.EndTable();
|
||||||
}
|
}
|
||||||
ImGui.PopStyleVar(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SetNextItemOpen(true, ImGuiCond.Appearing);
|
ImGui.SetNextItemOpen(true, ImGuiCond.Appearing);
|
||||||
|
|
@ -242,8 +239,6 @@ public class SnimGui
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, Vector2.Zero);
|
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, Vector2.Zero);
|
||||||
MeshWindow("Details", s.Renderer, (icons, model) =>
|
MeshWindow("Details", s.Renderer, (icons, model) =>
|
||||||
{
|
{
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(8, 3));
|
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, new Vector2(0, 1));
|
|
||||||
if (ImGui.BeginTable("model_details", 2, ImGuiTableFlags.SizingStretchProp))
|
if (ImGui.BeginTable("model_details", 2, ImGuiTableFlags.SizingStretchProp))
|
||||||
{
|
{
|
||||||
Layout("Entity");ImGui.Text($" : ({model.Type}) {model.Name}");
|
Layout("Entity");ImGui.Text($" : ({model.Type}) {model.Name}");
|
||||||
|
|
@ -257,7 +252,6 @@ public class SnimGui
|
||||||
|
|
||||||
ImGui.EndTable();
|
ImGui.EndTable();
|
||||||
}
|
}
|
||||||
ImGui.PopStyleVar(2);
|
|
||||||
if (ImGui.BeginTabBar("tabbar_details", ImGuiTabBarFlags.None))
|
if (ImGui.BeginTabBar("tabbar_details", ImGuiTabBarFlags.None))
|
||||||
{
|
{
|
||||||
if (ImGui.BeginTabItem("Sections") && ImGui.BeginTable("table_sections", 2, ImGuiTableFlags.Resizable | ImGuiTableFlags.BordersOuterV, ImGui.GetContentRegionAvail()))
|
if (ImGui.BeginTabItem("Sections") && ImGui.BeginTable("table_sections", 2, ImGuiTableFlags.Resizable | ImGuiTableFlags.BordersOuterV, ImGui.GetContentRegionAvail()))
|
||||||
|
|
@ -471,6 +465,12 @@ public class SnimGui
|
||||||
ImGui.TreePop();
|
ImGui.TreePop();
|
||||||
}
|
}
|
||||||
ImGui.SetNextItemOpen(true, ImGuiCond.Appearing);
|
ImGui.SetNextItemOpen(true, ImGuiCond.Appearing);
|
||||||
|
if (ImGui.TreeNode("Switchs"))
|
||||||
|
{
|
||||||
|
material.ImGuiDictionaries("switchs", material.Parameters.Switchs, true);
|
||||||
|
ImGui.TreePop();
|
||||||
|
}
|
||||||
|
ImGui.SetNextItemOpen(true, ImGuiCond.Appearing);
|
||||||
if (ImGui.TreeNode("Colors"))
|
if (ImGui.TreeNode("Colors"))
|
||||||
{
|
{
|
||||||
material.ImGuiDictionaries("colors", material.Parameters.Colors, true);
|
material.ImGuiDictionaries("colors", material.Parameters.Colors, true);
|
||||||
|
|
@ -537,7 +537,7 @@ public class SnimGui
|
||||||
|
|
||||||
private void Window(string name, Action content, bool styled = true)
|
private void Window(string name, Action content, bool styled = true)
|
||||||
{
|
{
|
||||||
if (ImGui.Begin(name))
|
if (ImGui.Begin(name, ImGuiWindowFlags.NoScrollbar))
|
||||||
{
|
{
|
||||||
Controller.PopFont();
|
Controller.PopFont();
|
||||||
if (styled) PushStyleCompact();
|
if (styled) PushStyleCompact();
|
||||||
|
|
@ -568,9 +568,8 @@ public class SnimGui
|
||||||
private void PopStyleCompact() => ImGui.PopStyleVar(2);
|
private void PopStyleCompact() => ImGui.PopStyleVar(2);
|
||||||
private void PushStyleCompact()
|
private void PushStyleCompact()
|
||||||
{
|
{
|
||||||
var style = ImGui.GetStyle();
|
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(8, 3));
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, style.FramePadding with { Y = style.FramePadding.Y * 0.6f });
|
ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, new Vector2(0, 1));
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, style.ItemSpacing with { Y = style.ItemSpacing.Y * 0.6f });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NoMeshSelected() => CenteredTextColored(_errorColor, "No Mesh Selected");
|
private void NoMeshSelected() => CenteredTextColored(_errorColor, "No Mesh Selected");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user