-
-
Notifications
You must be signed in to change notification settings - Fork 687
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
Updating backend ImGui/ImPlot/ImNodes to latest versions #2275
Conversation
What a massive PR! It would be very cool if it would be merged. Grazie mille! Is there a website for this product by your company? |
This is a great PR! It looks like a lot of the breaking changes could be made to not be if desired via aliases on the Python side, which is nice. |
Really thank you! |
Thank you! What do you mean with aliases? How would you use them in this case? |
Could you reply here when the demo is up? Or you could post on #showcase on Discord. |
Also, if you are looking to promote your app when it's done, I'd recommend posting on Reddit. I have some experience with that, so I'd could give a few suggestions if you like. |
"Alias" may not have been the best word. For example; in the case of discontinuing While I personally don't mind when updates are API-breaking (a benefit of me not needing to work on large projects, I suppose), DPG is supposed to be in "maintenence mode"; @hoffstadt and @Pcothren may not want to have a major release, which would likely be necessary given the API change. |
This branch seems to work well with an app that uses DearPyPixl, just needed to rename |
Thank you, I appreciate that! I'll tell you something when it'll be the moment and I'll post something in the #showcase for sure |
That's great, thanks! I really need feedback of someone testing it! |
Oh okay, got it, but I think this is gonna create a "complete" new version so maybe there won't be the need of making 100% backward compatible, but if they'll say so I'm sure we'll find a way... there aren't so many breaking changes |
The main things to take into account are:
Good luck! |
Thanks for the heads-up! I'll need to test this PR against my apps that use DearPyPixl as well, although I don't expect I'll find many problems. Docking's one, I suppose. |
While I really appreciate all the work done and still being done behind this PR, and welcome any fixes that correct possible earlier mistakes in ImGui upgrade, can we keep unrelated commits in separate PRs? (maybe published later, once this PR gets merged). I've noticed that commits continue to trickle into this PR, and some of them look unrelated to ImGui upgrade, which increases the work to review all this and might cause extra havoc if this PR needs any substantial rework. Unfortunately I myself haven't had a chance to review the PR yet - my apologies on that, I'm quite bogged with other stuff. Hoping to get some progress this week... |
Yeah sure! I think you refer to the "recursive" functionality (as far as I remember it should be the only "extra" thing that I added)... I was actually uncertain of pushing that commit, but I'll revert it asap And obviously no problem for the review :) |
Just a heads up - I'm reviewing this PR as time permits. It's hard to estimate progress - I think I'm still less than 20% into it. Since there's still a lot to review, I'm not making any comments yet - will be adding them later. |
Thanks for the great work. How much effort would it be to directly use ImGui's docking branch so that we can keep the docking feature in DearPyGui ? If i understand correctly, their main and docking branch are regularly synced so there aren't too many differences in the core functionality. |
+1 for keeping the docking feature. That's one of the things I was going to discuss. |
While I'm still going through all the changes, I think it's time to start making some initial comments. First of all, a disclaimer: the text below reflects my own opinion and not that of DPG devs (I'm not one of DPG authors). Also, some of my comments might seem a bit harsh - please bear with me, it's not because of any negative attitude, it's more like giving up on proper wording 🙂. Here are some key things (other comments will be attached to code lines as usual in a PR).
Making comments in the PR will take quite some time (maybe a couple of days), and I'm still halfway through the review, so get your popcorn ready! 🍿 😁 |
One more thing I forgot to mention: I'd like to ask a favor of whoever makes changes in future - in other PRs as well! - to avoid unnecessary re-formatting, renaming etc. because it pollutes This is also what I actually mean when I type something like "the old code worked the same way, why change it?" |
A couple of words on At the moment, it is broken for Do we want to add a feature to DPG in such a broken state? If so, we need to make a warning either in the release notes or in the doc (or both), and eventually update ImGui once again to pull up the fix for this. |
- remove useless `no_legend` parameter in `custom_series` - remove `delete_rect` parameter in `plot` - change name of parameter `invert_order` to `invert`
Specifically: - remove build files - restore old `README.md` - add possibility to color query rect in plots - effectively enable `query` parameter in plots - fix deletion of query rects - fix deprecated `add_vline_series` and `add_hline_series` - remove `no_legend` parameter for subplots - correct descriptions - remove useless part with `IMGUI_DISABLE_OBSOLETE_FUNCTIONS` - fix validation of BarGroupPlot paramters
Also, remove useless `no_label` parameter from `mvColorMapScale`
Also: - remove `no_label` parameter in colormap scale - fix `PlotStems` flags - fix `share_series` parameter in Subplots
Also rename `resizable_x/y` left from previous change together with a couple of other parameters' name fixes
Specifically: - Get anti-alias info from `get_app_configuration` - Remove `offset` parameter from `digital_series` - Remove/comment out leftovers - Fix typo - Improve docs
Also, replace deprecated parameters in `dpg.draw_rectangle`in demo
@v-ein not the best choice of my life that rebase, but here weare, I did it! 😄 |
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 think we're ready for merge! @hoffstadt
In case somebody is interested, here are the test scripts that I used to check all those new functions and arguments: |
Alright guys... starting my part of this now. |
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.
Guys... great work. This looks great. I will approve it.
Before merging, I'm going to put the current master into another branch and update the readthedocs account to support multiple versions (dpg 1.0 & 2.0).
I can't thank you guys enough for all the work. I apologize for the state of the code you guys had to suffer through. It was in the middle of a refactor that I lost all motivation to finish.
Currently on pypi as 2.0.0b1: pip install dearpygui==2.0.0b1 |
I know it's a bit late in the process (since the PR has been merged), but can we add a line to the description @SamuMazzi? It turns out that the order of coordinates in the new query callback is different from what it was in the old version. Let's add this line (as a sub-item probably) to the "New query API for plots" line: Note: From now on, the query callback receives coordinates as |
Did it! Thanks for telling me that :) |
name: Updating backend ImGui/ImPlot/ImNodes
about: Updated backends
title: Updating backend ImGui/ImPlot/ImNodes
assignees: ''
After a loooooot of work and time, we've finally finished the PR. A huge thank you to @v-ein for all the help and support.
Description
This PR aims to update the
ImGui/ImPlot/ImNodes
backends of DPG to way more recent versions.Currently, DPG relies on really old version of these packages (~2/3 years old), now this is the situation before/after the PR:
Those versions are the latest available at the moment of merging the PR
and they are supported by DPG but this doesn't mean that we implemented
every single feature from those libraries (many are still missing like multi-selection,
several flags in different components, new API for shortcuts, etc...).
Below will be listed a summary of the major changes and new features. We tried to be as much backward compatible as possible. And hopefully you may not need to change anything in your current code.
Issues solved
Changes
StackToolWindow
query
API for plots. Now multiple queries can be created and managed. Check the demo and the new parameters inadd_plot
to have more info((x1, y1, x2, y2), (x1, y1, ...))
. This differs from the old behavior where the callback was getting(x1, x2, y1, y2)
, i.e. first the X range, then the Y range. The new format describes a sequence of rectangles in the plot's coordinate space.label
parameter inadd_separator
will put a label inside the separatorctrl + tab
navigation across windows independent fromkeyboard_navigation
parameterPresentation
section toMetricsTool
like in the original ImGuienable
parameter inadd_group
will applymvStyleVar_DisabledAlpha
to all its childrenHere is a list of all the new and deprecated arguments and functions.
Note: all deprecated functions and arguments are still accepted by DearPyGui API. Some of them may still work, some are ignored, but none should crash your application.
New functions
add_axis_tag
add_bar_group_series
add_inf_line_series
add_digital_series
get_plot_query_rects
set_axis_limits_constraints
reset_axis_limits_constraints
set_axis_zoom_constraints
reset_axis_zoom_constraints
New arguments
add_2d_histogram_series
col_major
add_button
repeat
add_child_window
always_auto_resize
always_use_window_padding
auto_resize_x
auto_resize_y
frame_style
resizable_x
resizable_y
add_colormap_scale
format
mirror
reverse_dir
add_combo
fit_width
add_custom_series
no_fit
add_drag_line
delayed
no_cursor
no_fit
no_inputs
add_drag_point
clamped
delayed
no_cursor
no_fit
no_inputs
offset
add_group
enabled
add_heat_series
col_major
add_histogram_series
cumulative
horizontal
add_input_text
always_overwrite
auto_select_all
ctrl_enter_for_new_line
escape_clears_all
no_horizontal_scroll
no_undo_redo
add_line_series
loop
no_clip
segments
shaded
skip_nan
add_pie_series
ignore_hidden
add_plot
max_query_rects
min_query_rects
no_frame
no_inputs
override_mod
query_color
zoom_mod
zoom_rate
add_plot_axis
auto_fit
foreground_grid
no_highlight
no_initial_fit
no_label
no_menus
no_side_switch
opposite
pan_stretch
range_fit
scale
tick_format
add_plot_legend
no_buttons
no_highlight_axis
no_highlight_item
no_menus
sort
add_scatter_series
no_clip
add_stair_series
pre_step
shaded
add_stem_series
horizontal
add_subplots
share_series
add_table_column
angled_header
no_header_label
add_text_point
offset
add_tree_node
span_full_width
span_text_width
add_window
unsaved_document
configure_app
anti_aliased_fill
anti_aliased_lines
anti_aliased_lines_use_tex
docking_shift_only
Deprecated functions
add_hline_series
: useadd_inf_line_series()
add_vline_series
: useadd_inf_line_series()
get_plot_query_area
: useget_plot_query_rects()
is_plot_queried
: useget_plot_query_rects()
Deprecated arguments
add_histogram_series
cumlative
cumulative
add_image_button
frame_padding
add_plot
anti_aliased
dpg.configure_app()
with theanti_aliasing
parameters.add_plot
no_child
add_plot
no_highlight
add_plot_legend
.add_plot
query_button
query_mod
add_drag_rect()
.add_plot_axis
log_scale
scale=dpg.mvPlotScale_Log10
instead.add_plot_axis
time
scale=dpg.mvPlotScale_Time
instead.add_text_point
x_offset
y_offset
offset
argument instead.Nerd info (for developers)
Why?
ImGui is currently sponsored by big tech companies like Adobe, Blizzard, Activision, etc. so we can expect a lot of improvements with the update (there are already ton of them) and we can expect a lot of people working on the really ugly/hard things like graphical backend libraries.
At my workplace we are about to ship a product based on DPG. Because of my job, I had to edit the backend and then I found out that what I edited was already modified in the new ImGui and then I also found out that the ImGui version we were relying on in DPG was really old.
We want to stick with this library but I honestly told them that I don't see the point of relying on an almost dead (okay, no, maintenance mode) library, so we decided to either upgrade it or drop it and replace it with something else.
I know that this is quite a huge change, and that several problems can arise but I also think that it can be definitely worth it. Also with this huge community all of these changes can be "easily" tested.
OpenGL
Currently, for the build, DPG relies on
gl3w
in theexamples
folder ofImGui
. This doesn't sound like a really stable thing and indeed a couple of releases later, that's been removed, so I addedgl3w
directly in thethirdparty
folder.Also
ImGui
decided to make some heavy changes in order to be more cross-platform. One of these, which is also my biggest concern about all of this work, is about the buttons of the keyboard. These are now less than before, and they have been all mapped to predefined values inImGui
.So if someone used them heavily now they could have some problem.
Major concerns
There haven't been any huge updates during these years so there shouldn't be a lot (or any) problems. If someone's willing to help and take a look, they'd be welcome.
Notes
There are still tons of updates and new features that can be implemented (i.e. Shortcuts API, Multi select, and many others), then if you want to take a look on what happened check this for ImPlot and ImGui
In ~2022 ImGui moved all the docking stuff in a separate branch, so now we're relying on that branch. This is not a big difference because it's always rebased on the main branch on every update and should be merged in the master in the version 2.0
Everything was tested with Valgrind in order to be sure that there wasn't any kind of accidental memory leak (or at least not more than those who were already there).
My main goal here was to have a real feedback from the most expert users on this work.
I hope I was clear enough!
I'd like to improve this library because I think it's really great, so any kind of suggestion will be well accepted.