-
Notifications
You must be signed in to change notification settings - Fork 310
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
Integration of ImPlot, ImNodes and ImGuizmo #218
Integration of ImPlot, ImNodes and ImGuizmo #218
Conversation
…ding definition files
This is fantastic stuff, thanks for putting this together @TillAlex. I definitely want to support this in some form, and in general most of the changes here look reasonable. One question is how the native portions should be organized and delivered. As far as I can tell, all of these libraries are intended to be compiled and included together in a single native DLL. That's obviously possible here as well based on your testing, but it would be better if we could separate them out into 4 dynamic libraries (libcimgui, libimplot, libimnodes, and libimguizmo). This would allow users of ImGui.NET alone to avoid including extra libraries that they aren't interested in. The new libraries would need to be built against a particular version of libcimgui (and thus would need to be used w/ a particular version of ImGui.NET), but I can't think of any technical reason why this wouldn't work. Functionally, this would mean expanding ImGui.NET-nativebuild to cover the new libraries, in a way that produced 4 compatible dynamic libs from source. Long-term, I'd like to see the extra libraries moved out of this repo into separate ones, but I don't feel very strongly about that initially. The fact that all of them will need CodeGenerator means that a larger restructuring would be needed for that to work. Along these lines, it would be nice if CodeGenerator was a little less aware of the quirks of each individual project (e.g. now it knows about things like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes to CodeGenerator are relatively minor, so I don't have any major issues with them. I would like to see CodeGenerator made more generic (e.g. instead of hard-coding all of these new quirks, it would be better if they were passed in somehow), but it's a larger piece of work. To get this merged, I think we should work towards the following:
- Get the end-to-end working w/ the native libraries. We can set up an auto-build of some other branch of ImGui.NET-nativebuild to test this before incorporating it into the main branch there. The new C# projects should include those native libraries exactly the same way that ImGui.NET does.
- Trim the additions down to just ImPlot and ImGuizmo. It turns out that there are 3 similar node editor extensions (imnodes, ImNodes, and imgui-node-editor). The latter seems to have the largest usage (judging by activity), but I don't think there's a cimgui binding for it. I don't really want to be in the business of choosing which one of those to support here. Long-term, I'd like all of this to live outside of the main repository here (including any future libraries that users want to wrap) so someone else could support it if they wanted. I'm okay with including ImPlot and ImGuizmo to prove this out for now.
|
||
public static readonly List<string> WellKnownEnums = new List<string>() | ||
{ | ||
"ImGuiMouseButton" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I guess this is needed because one of the new projects uses ImGuiMouseButton, but the definitions.json file that is used for it doesn't include it (since it's part of cimgui). This might work as a quick fix, but it points to a deeper issue. It seems like the new libraries should reference the cimgui definitions while generating code.
@@ -0,0 +1,8 @@ | |||
namespace ImGuiNET | |||
{ | |||
public enum MODE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was a bit conflicted above, but seeing some of these types makes me think that these new libraries should be in their own namespaces. I don't necessarily want types like MODE
and OPERATION
to pollute the ImGuiNET namespace for regular users of ImGui.NET even if they have to opt-in to this library.
{ | ||
"cimgui" => "ImGui", | ||
"cimplot" => "ImPlot", | ||
"cimnodes" => "ImNodes", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your comments! On 1) I think you are totally right that split native libraries are the better solution and it shouldn't be to complicated to integrate that into ImGui.NET-nativebuild. I am not a cmake pro, but I will give it a try. On 2) I understand your point about ImNodes, but I also think it's sad not to have a nodes editor for ImGui.NET. Perhaps we should just generate wrappers for all the cimxxx projects so that the user can choose from at least two of the three nodes editors. If @sonoro1234 decides to include imgui-node-editor as well we can add that as well. Hopefully I will find some time this evening to work on some of the points from your comments. |
Hi Alex, Best regards, |
@cbaal83 Here are x64 binaries I just built: binaries.zip Included are separate binaries of the current versions of cimgui, cimplot, cimnodes and cimguizmo. I changed this PR to work with these. Until now I only tested the demo window of ImPlot used in ImGui.NET.SampleProgram. It works as long as you replace the original cimgui with the one in the zip, because cimplot.dll is built against ImGui 1.79. I am not sure if my way of building separate binaries is correct. Let me know if they work for you. |
…izmo_Integration # Conflicts: # src/ImGui.NET.SampleProgram/ImGui.NET.SampleProgram.csproj
@TillAlex |
I have just added thoose 2 lines to the XNA SampleGame on line 84
I've also tested Implot.CreateContext() and implot.SetImGuiContext() (inside ImguiRenderer ctor), doesn't work. Do i miss something obvious here? //cbaal83 |
Just tested the same and it works. Found two potential problems you could be running into:
|
Yep, i haven't done all three together. It's working now :). |
Ok, quick question:
|
Another issue: I have the feel iam doing something wrong here :D. //cbaal |
I feel stupid now, chart wasn't zoomed out... |
I can not check at the moment if this works, but you can try
|
Both works, the safe and unsafe way. Which needs to be called before any Implot.BeginPlot Thanks! |
Do these work with the docking/viewport branch of imgui? |
@TillAlex Implot.BeginItem which are necessary for custom graphs. Any chance you add them? |
@cbaal83 As far as I understand cimplot does not wrap the internal api of implot. @sonoro1234 Is this correct? |
Yes, only imgui_internal is wrapped. |
@sonoro1234 |
https://github.com/cimgui/cimplot/tree/internal just added Main problem for compiling is
in implot.cpp so different signature for LabelTickTime the cause seems to be inline in definition Just pushed with local cimgui_skipped = {
ImBufferWriter_Write = true,
ImPlot_LabelTickTime = true,
ImPlot_AddTicksTime = true
} So that compilation succeds |
I took the precompiled binaries from your post earlier, where they're seperate dlls. Should I compile them myself? |
You do not have to compile them yourself, but you really have to make sure you are using the precompiled cimgui.dll and cimplot.dll. The compiler tends to replace cimgui.dll with the one from the repository during compilation. |
Alright, I got it working! Thank you all so much! |
What was the problem? Wrong DLL? |
Yeah, wrong dll. I had forgotten to replace it. Took some more tweaking with the Unity ImGui package I was using after that, but I've never been so happy to see a graph in my life. Thanks a ton for this PR man, truly appreciated! |
Any progress on this? |
Hey guys |
cimplot wraps implot_internal by default now |
cimnodes also regenerated |
Cimgui 1.82 generated |
Recent native libraries can be found in the AppVeyor build artifacts of ImGuiNET/ImGui.NET-nativebuild#3. |
Awesome :D Thank you! |
It seems that I took the non docking definitions.json. Will fix this later on.... |
Was just about to ask if you had it working with docking as well :) |
Definitions for cimgui from docking_inter brach are used again. Just did a short test with docking enabled and it seems to work. |
I switched my branch of ImGui.NET-nativebuild to cimgui master accidently. Now it's using docking_inter branch again. Here is the corresponding pull request: ImGuiNET/ImGui.NET-nativebuild#3 The appveyor pipeline there generates working native libraries for windows and linux. |
@TillAlex I've merged this with a few adjustments applied in follow-up commits. I have not pushed any official packages using this yet, but I'd like to do that soon for the core library, because it's overdue for an update. EDIT: Just wanted to say that this is an awesome contribution, thanks again! |
@mellinoe Thanks for merging! |
Ok I red whole thread, but I am still confused - how do I get to include Implot (and others) into docking version? If I understand, everything is available already, just binaries are missing? I wish to make this available for Unity, normal docking Imgui is working already :). |
Ok, got it working on Windows/Unity by downloading this repo: https://github.com/TillAlex/ImGui.NET-nativebuild/tree/additional_libraries and running |
This PR adds support for ImPlot(#191), ImNodes(#201) and ImGuizmo(#200).
What has been done:
Until now I only did minimal testing. Binaries including cimplot, cimnodes and cimguizmo are missing. For testing I manually compiled a cimgui.dll including cimplot. I am not sure if you prefer one binary including all projects or separate binaries.
Please let me know what you think about this PR. Feel free to change this PR in any way that is necessary to include it. If you need me to change anything let me know.