-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional third-party modules for ImGui #75
Comments
For the most part, everything should just work in C++. I've been meaning to test this to be sure, so I added ImPlot to the GDExtension example. The important thing is to call I have no plans to add C# or GDScript bindings for any third-party libraries, it's just way too much tedious work to write and maintain that sort of thing. The C# bindings are entirely ImGui.NET, and the GDScript bindings only exist because dear_bindings does the heavy lifting specifically for ImGui. |
Thought of an important extra detail while looking at imgui_markdown, which is that fonts can only be accessed after the scene tree is loaded, eg in your node's Let me know if you have any specific difficulties. ImWindow would be very complicated to support, but its functionality now exists natively in ImGui with its docking and multi-viewport features. https://github.com/pkdawson/imgui-godot/wiki/CPlusPlus#notes |
I added an example of using imgui_markdown, because that's a good way to show how to setup something a little more complex. It's still pretty straightforward, except maybe the few extra lines of code to handle atlas textures properly. |
One could just use the bindings from the ImGui.NET repo it does contain ImPlot / ImNodes etc. bindings for C#. I just don't know how to tell Godot where to find cimplot.. (btw cimplot and all other C Bindings can be obtained here) EDIT: EDIT2:
No clue why.. because commenting out ImPlot::BeginPlot etc. and Godot does not crash and runs without issues....
This is how I "run it": private readonly List<double> _fps = new List<double>(64);
private double _elapsedTime = 0;
public override void _Ready()
{
base._Ready();
ImGuiSync.SyncPtrs();
ImPlot.CreateContext();
}
public override void _Process(double delta)
{
_elapsedTime += delta;
if (_elapsedTime >= 1.0)
{
_fps.Add(Performance.GetMonitor(Performance.Monitor.TimeFps));
_elapsedTime = 0.0;
}
if (ImGui.Begin("Monitor"))
{
//Performance.TIME_FPS
if (ImPlot.BeginPlot("FPS"))
{
Span<double> fpsSpan = CollectionsMarshal.AsSpan(_fps);
ImPlot.PlotLine("FPS", ref fpsSpan[0], fpsSpan.Length);
ImPlot.EndPlot();
}
}
ImGui.End();
base._Process(delta);
} |
@Subtixx You shouldn't need to call SyncPtrs if you have the plugin installed and enabled, it does that automatically. So the key problem here is that the ImGuiContext is not shared between different DLLs / shared libraries. It needs to be manually synchronized. https://github.com/ocornut/imgui/blob/29fadad1939ab62adcc5cd9339db7a784de90120/imgui.cpp#L1204-L1213 Try adding this before creating the ImPlot context. I'm just looking at the ImPlot.NET code, haven't tested. ImPlot.SetImGuiContext(ImGui.GetCurrentContext()); |
Thank you very much! Didn't know that about Shared Libraries thanks! ImPlot.SetImGuiContext(ImGui.GetCurrentContext()); This does not fully solve the issue since now I'm crashing here: if (Window->SkipItems && !gp.CurrentSubplot) { now Window is null.. |
I've tried making some changes from ImGui.NET to Hexa.NET.ImGui for my personal use, and got imgui/implot/imnodes/imguizmo run successfully. |
Previously, when I used ImGui in C++, I used various libraries for ImGui, here are some of them
https://github.com/thedmd/imgui-node-editor
https://github.com/Nelarius/imnodes
https://github.com/epezent/implot
https://github.com/BalazsJako/ImGuiColorTextEdit
https://github.com/aiekick/ImGuiFileDialog
https://github.com/enkisoftware/imgui_markdown
https://github.com/thennequin/ImWindow
How are things going with this? Should I add everything manually or could I consider adding the most popular ones to the plugin itself?
The text was updated successfully, but these errors were encountered: