mirror of
https://github.com/4sval/FModel.git
synced 2026-03-22 01:34:37 -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 _windowHeight;
|
||||
// private string _iniPath;
|
||||
|
||||
private ImFontPtr _normal;
|
||||
private ImFontPtr _bold;
|
||||
private ImFontPtr _semiBold;
|
||||
|
||||
private readonly System.Numerics.Vector2 _scaleFactor = System.Numerics.Vector2.One;
|
||||
private readonly Vector2 _scaleFactor = Vector2.One;
|
||||
|
||||
private static bool KHRDebugAvailable = false;
|
||||
|
||||
|
|
@ -44,6 +45,7 @@ public class ImGuiController : IDisposable
|
|||
{
|
||||
_windowWidth = width;
|
||||
_windowHeight = height;
|
||||
// _iniPath = Path.Combine(UserSettings.Default.OutputDirectory, ".data", "imgui.ini");
|
||||
|
||||
int major = GL.GetInteger(GetPName.MajorVersion);
|
||||
int minor = GL.GetInteger(GetPName.MinorVersion);
|
||||
|
|
@ -52,6 +54,8 @@ public class ImGuiController : IDisposable
|
|||
|
||||
IntPtr context = ImGui.CreateContext();
|
||||
ImGui.SetCurrentContext(context);
|
||||
// ImGui.LoadIniSettingsFromDisk(_iniPath);
|
||||
|
||||
var io = ImGui.GetIO();
|
||||
_normal = io.Fonts.AddFontFromFileTTF("C:\\Windows\\Fonts\\segoeui.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)
|
||||
{
|
||||
ImGuiIOPtr io = ImGui.GetIO();
|
||||
io.DisplaySize = new System.Numerics.Vector2(
|
||||
// if (io.WantSaveIniSettings) ImGui.SaveIniSettingsToDisk(_iniPath);
|
||||
io.DisplaySize = new Vector2(
|
||||
_windowWidth / _scaleFactor.X,
|
||||
_windowHeight / _scaleFactor.Y);
|
||||
io.DisplayFramebufferScale = _scaleFactor;
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ public partial class MainWindow
|
|||
await _applicationView.CUE4Parse.InitInformation();
|
||||
#endif
|
||||
await _applicationView.CUE4Parse.InitMappings();
|
||||
await _applicationView.InitImGuiSettings();
|
||||
await _applicationView.InitVgmStream();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 _infinite = 0.0f;
|
||||
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()
|
||||
{
|
||||
PushStyle();
|
||||
if (ImGui.BeginTable("parameters", 2))
|
||||
{
|
||||
SnimGui.Layout("Roughness");ImGui.PushID(1);
|
||||
|
|
@ -248,7 +241,6 @@ public class Material : IDisposable
|
|||
}
|
||||
ImGui.EndTable();
|
||||
}
|
||||
ImGui.PopStyleVar(2);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
PushStyle();
|
||||
if (ImGui.BeginTable("material_textures", 2))
|
||||
{
|
||||
SnimGui.Layout("Channel");ImGui.PushID(1); ImGui.BeginDisabled(model.NumTexCoords < 2);
|
||||
|
|
@ -294,7 +285,6 @@ public class Material : IDisposable
|
|||
|
||||
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.Spacing();
|
||||
|
|
|
|||
|
|
@ -67,12 +67,16 @@ public class Model : IDisposable
|
|||
if (morphTargets is not { Length: > 0 })
|
||||
return;
|
||||
|
||||
var length = morphTargets.Length;
|
||||
|
||||
HasMorphTargets = true;
|
||||
Morphs = new Morph[morphTargets.Length];
|
||||
Morphs = new Morph[length];
|
||||
for (var i = 0; i < Morphs.Length; i++)
|
||||
{
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class SnimGui
|
|||
|
||||
SectionWindow("Material Inspector", s.Renderer, DrawMaterialInspector, false);
|
||||
|
||||
Window("Timeline", () => {});
|
||||
// Window("Timeline", () => {});
|
||||
Window("World", () => DrawWorld(s), false);
|
||||
Window("Sockets", () => DrawSockets(s));
|
||||
|
||||
|
|
@ -53,8 +53,6 @@ public class SnimGui
|
|||
ImGui.SetNextItemOpen(true, ImGuiCond.Appearing);
|
||||
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))
|
||||
{
|
||||
Layout("Skybox");ImGui.PushID(1);
|
||||
|
|
@ -70,7 +68,6 @@ public class SnimGui
|
|||
|
||||
ImGui.EndTable();
|
||||
}
|
||||
ImGui.PopStyleVar(2);
|
||||
}
|
||||
|
||||
ImGui.SetNextItemOpen(true, ImGuiCond.Appearing);
|
||||
|
|
@ -242,8 +239,6 @@ public class SnimGui
|
|||
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, Vector2.Zero);
|
||||
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))
|
||||
{
|
||||
Layout("Entity");ImGui.Text($" : ({model.Type}) {model.Name}");
|
||||
|
|
@ -257,7 +252,6 @@ public class SnimGui
|
|||
|
||||
ImGui.EndTable();
|
||||
}
|
||||
ImGui.PopStyleVar(2);
|
||||
if (ImGui.BeginTabBar("tabbar_details", ImGuiTabBarFlags.None))
|
||||
{
|
||||
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.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"))
|
||||
{
|
||||
material.ImGuiDictionaries("colors", material.Parameters.Colors, true);
|
||||
|
|
@ -537,7 +537,7 @@ public class SnimGui
|
|||
|
||||
private void Window(string name, Action content, bool styled = true)
|
||||
{
|
||||
if (ImGui.Begin(name))
|
||||
if (ImGui.Begin(name, ImGuiWindowFlags.NoScrollbar))
|
||||
{
|
||||
Controller.PopFont();
|
||||
if (styled) PushStyleCompact();
|
||||
|
|
@ -568,9 +568,8 @@ public class SnimGui
|
|||
private void PopStyleCompact() => ImGui.PopStyleVar(2);
|
||||
private void PushStyleCompact()
|
||||
{
|
||||
var style = ImGui.GetStyle();
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, style.FramePadding with { Y = style.FramePadding.Y * 0.6f });
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, style.ItemSpacing with { Y = style.ItemSpacing.Y * 0.6f });
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(8, 3));
|
||||
ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, new Vector2(0, 1));
|
||||
}
|
||||
|
||||
private void NoMeshSelected() => CenteredTextColored(_errorColor, "No Mesh Selected");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user