Skip to content
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

hints for docking branch: update imgui-cpp submodule to 505f19e3b00 (docking, ocornut 2022-04-05) #274

Draft
wants to merge 2 commits into
base: docking
Choose a base branch
from

Conversation

pthom
Copy link
Contributor

@pthom pthom commented Apr 15, 2022

Note: this PR cannot be merged to the docking branch, as of now (since the docking branch which should match the commit: ocornut/imgui@2565945 from 15 March 2021). However it could help later, when the imgui docking branch is updated. It reflects some API change in the cpp code.


1. Adaptations done inside pyimgui:

  • setup.py: common_flags = ['-std=c++11'] added to extra_compile_args
    (required since imgui started to use constexpr)

  • IsClippedEx new signature:
    => impacts one line in AnsiTextColored.cpp

  • GetContentRegionAvailWidth() replaced by GetContentRegionAvail().x
    => remove declaration in cimgui.pxd and impl in core.pyx,
    adapt one commented line in testwindow.py,

  • ImGuiColorEditFlags__OptionsDefault renamed to
    ImGuiColorEditFlags_DefaultOptions_
    => one line changed in core.pyx and enums.pxd

  • ImGuiNavMoveFlags_ScrollToEdge renamed to
    ImGuiNavMoveFlags_ScrollToEdgeY
    => renamed NAV_MOVE_SCROLL_TO_EDGE to
    NAV_MOVE_SCROLL_TO_EDGE_Y
    inside internal.pyx and enums_internal.pxd,

2. Merged latest version of the branch dev/version-2.0

3. (Incomplete - advice needed) Corrected tests

In the tests, calls to imgui.new_frame() fail is no backend is initialized, we get the error below:

    imgui.core.ImGuiError: ImGui assertion error
       (g.IO.Fonts->IsBuilt() && "Font Atlas not built!
    Make sure you called ImGui_ImplXXXX_NewFrame() function for renderer backend,
    which should call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8()")
    at imgui-cpp/imgui.cpp:8604

So, I tried to add `dummy_glfw_init.py, which provides only one function: create_dummy_glfw_renderer()
that will instantiate a glfw renderer backend.

With that, the tests work on my side. However they fail in CI (when loading OpenGL).

I don't know if that is a correct solution, or if we should try to trick imgui into thinking that a backend was initialized, even though it was not.

@pthom pthom marked this pull request as draft April 15, 2022 08:30
@pthom pthom force-pushed the pthom/docking_2022_04_05 branch 2 times, most recently from bcb9ab9 to c30c825 Compare April 15, 2022 12:06
@KinoxKlark
Copy link
Member

KinoxKlark commented Apr 19, 2022

Hey, sorry for the late answer. Thank you for your help, it is much appreciated. Are you aware of the roadmap for docking in #259? I think the idea was to stay in sync with the main branch that we froze in 1.82 for now in order to finish and release (hopefully someday) the 2.0 version of pyimgui. Thus the docking branch should match the commit: ocornut/imgui@2565945 from 15 March 2021.

Are your changes compatible and would it be possible to easily revert to this specific commit? Or maybe you have a good argument to desync both branches for now?

Maybe it would be time to decide that 2.0 should match a more recent version of dearimgui which would imply some additional works before release. But in any case, shouldn't the docking branch match the commit associated with the latest release of dearimgui (from February) and not just a recent commit?

Edit: For reference, I also drop this effort on docking branch #261 which may be of interest in the discussion.

Adaptations done inside pyimgui:
********************************

- setup.py: `common_flags = ['-std=c++11']` addd to `extra_compile_args`
  (required since imgui started to use constexpr)

- `IsClippedEx` new signature:
   => impacts one line in AnsiTextColored.cpp

- `GetContentRegionAvailWidth()` replaced by `GetContentRegionAvail().x`
  => remove declaration in cimgui.pxd and impl in core.pyx,
     adapt one commented line in testwindow.py,

- `ImGuiColorEditFlags__OptionsDefault` renamed to
  `ImGuiColorEditFlags_DefaultOptions_`
   => one line changed in core.pyx and enums.pxd

- `ImGuiNavMoveFlags_ScrollToEdge` renamed to
  `ImGuiNavMoveFlags_ScrollToEdgeY`
   => renamed `NAV_MOVE_SCROLL_TO_EDGE` to
              `NAV_MOVE_SCROLL_TO_EDGE_Y`
      inside internal.pyx and enums_internal.pxd,
Calls to `imgui.new_frame()` fail is no backend is initialized, we get the error below:
    imgui.core.ImGuiError: ImGui assertion error
       (g.IO.Fonts->IsBuilt() && "Font Atlas not built!
    Make sure you called ImGui_ImplXXXX_NewFrame() function for renderer backend,
    which should call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8()")
    at imgui-cpp/imgui.cpp:8604

dummy_glfw_init provides only one function: create_dummy_glfw_renderer()
that will instantiate a glfw renderer backend.

(added glfw to requirements-test.txt)
@pthom
Copy link
Contributor Author

pthom commented Apr 20, 2022

Hello,

Thanks for your answer!

Are you aware of the roadmap for docking in #259? I think the idea was to stay in sync with the main branch that we froze in 1.82 for now in order to finish and release (hopefully someday) the 2.0 version of pyimgui. Thus the docking branch should match the commit: ocornut/imgui@2565945 from 15 March 2021.

I had read the info too quickly and thought that the docking was following the docking branch closely. Sorry!

Are your changes compatible and would it be possible to easily revert to this specific commit? Or maybe you have a good argument to desync both branches for now?

At this time, I am OK with the status, and I don't need a desync.


However, there were some additional interesting modifications in this PR, which I now removed from here (since they were not related to this PR). I will propose them in two additional PR: one on the master branch, and one on the docking branch.

Concerning this PR, I think may be you could leave this PR open as an help for future implementers, when updating to a more recent version of the imgui docking branch.

@pthom pthom changed the title Update imgui-cpp submodule to 505f19e3b00 (docking, ocornut 2022-04-05) hints for docking branch: update imgui-cpp submodule to 505f19e3b00 (docking, ocornut 2022-04-05) Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants