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

Fix imgui_manager #140

Merged
merged 1 commit into from
Feb 4, 2022
Merged

Fix imgui_manager #140

merged 1 commit into from
Feb 4, 2022

Conversation

ifl0w
Copy link
Collaborator

@ifl0w ifl0w commented Feb 4, 2022

The new ImGui version did not work for me at all. The examples did compile but an assertion in ImGui was triggered.

I did not investigate what the io.KeyMap[ImGuiKey_Tab] = ImGuiKey_Tab; assignments are for, but removing them fixed the assertion. I figured that they aren't required as everything worked for me without them. Please verify this though!

Also writing directly to the internal members of io (e.g. io.KeysDown) is discouraged and made a lot of problems for me. The mouse input did not really work.
After applying the transition guide provided in the ImGui repo here everything worked fine again. :)

@ifl0w ifl0w changed the title update imgui_manager for newer IO API Fix imgui_manager Feb 4, 2022
@mrumpelnik
Copy link
Collaborator

mrumpelnik commented Feb 4, 2022

I did not investigate what the io.KeyMap[ImGuiKey_Tab] = ImGuiKey_Tab; assignments are for, but removing them fixed the assertion. I figured that they aren't required as everything worked for me without them. Please verify this though!

io.KeyMap[ImGuiKey_Tab] = ImGuiKey_Tab; is probably

Backend writing to io.KeyMap[], io.KeysDown[] -> backend should call io.AddKeyEvent()

from the transition guide. So I think by using io.AddKeyEvent(), your changes also handle this.

@johannesugb johannesugb self-requested a review February 4, 2022 20:30
Copy link
Member

@johannesugb johannesugb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's awesome. Thank you for the ultra fast fix!

The only question that remains: Shall we already define IMGUI_DISABLE_OBSOLETE_KEYIO to use ImGui's new mode of operation?

@johannesugb johannesugb merged commit e02cb4c into cg-tuwien:master Feb 4, 2022
@mrumpelnik
Copy link
Collaborator

mrumpelnik commented Feb 4, 2022

Since Gears-Vk has it's own input system, ImGuis key-down/up functions IsKeyDown(), IsKeyPressed(), IsKeyReleased(), GetKeyPressedAmount() are never used right?. Per transition guide, defining IMGUI_DISABLE_OBSOLETE_KEYIO should not affect anything in our code if we do not use these functions, so it should be fine. Since

In a few versions, IMGUI_DISABLE_OBSOLETE_FUNCTIONS will automatically set it

code using the obsolete API will break sometime if we keep ImGui updated... so probably better to fix this now to prevent future debugging sessions

@johannesugb
Copy link
Member

johannesugb commented Feb 4, 2022

ImGuis key-down/up functions IsKeyDown(), IsKeyPressed(), IsKeyReleased(), GetKeyPressedAmount() are not used in Gears-Vk's examples' code directly, but maybe indirectly when using some ImGui sliders or so? My concerns are that if GetIO().KeyMap is no longer used and IMGUI_DISABLE_OBSOLETE_FUNCTIONS is defined (which changes ImGui's inner mode of operation) that something might break -- but maybe my concerns are unjustified.

Maybe @ifl0w could test with IMGUI_DISABLE_OBSOLETE_FUNCTIONS to make sure everything still works afterwards.

@ifl0w
Copy link
Collaborator Author

ifl0w commented Feb 5, 2022

I tried building the examples with IMGUI_DISABLE_OBSOLETE_FUNCTIONS and IMGUI_DISABLE_OBSOLETE_KEYIO.
A lot of examples failed to build for me, but the issues seemed unrelated to ImGui. More like something with vk::Format but I did not take a close look.

In my project and the OrcaSceneExample, only the imgui file browser uses a deprecated imgui feature and in de imgui_manager ImGuiKey_KeyPadEnter was renamed to ImGuiKey_KeypadEnter. These two things are easy to fix. So I guess we could add the two defines and prevent further usage of deprecated functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants