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 tooltip wonkyness #4856

Merged
merged 1 commit into from
Jan 12, 2025
Merged

Conversation

briaguya-ai
Copy link
Contributor

@briaguya-ai briaguya-ai commented Jan 11, 2025

@Spodi mentioned

oh what, my game just blacked out. no image at all
hovering over some option in Graphic enhancement menu causes that
let me check which one
seems like cull glitch actors, when it is actually disabled (as in: greyed out) (edited)
hovering ANY grayed out menu checkbox results in a blackout, lol
nothing i tried makes it go away, other than completely closing the game (edited)

i did some digging and wasn't able to repro that exact behavior but following the repro steps led to

wonk.mp4

i then found/mentioned

so it seems to be tooltip related, i can't repro the issue if i comment out

if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && strcmp(disabledTooltipText, "") != 0) {
ImGui::SetTooltip("%s", disabledTooltipText);
}
(which is interesting because it's not something i touched in #4838)

after more digging i found

so the tooltip stuff has something to do with ocornut/imgui@f953ebf

i tried commenting out BeginDisabledOverrideReenable and EndDisabledOverrideReenable and it doesn't bug out, but i see the standard tooltip instead of the disabled tooltip

i can also get to that point without changing imgui source by changing ReEnableComponent to have the tooltip stuff before PopStyleVar and PopItemFlag instead of in between them (and i know we're making it into the if block because i put logging in there and it's logging when i'm hovering

orig

    void ReEnableComponent(const char* disabledTooltipText) {
        // End of disable region of previous component
        ImGui::PopStyleVar(1);
        if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && strcmp(disabledTooltipText, "") != 0) {
            ImGui::SetTooltip("%s", disabledTooltipText);
        }
        ImGui::PopItemFlag();
    }

shows non-disabled tooltip

    void ReEnableComponent(const char* disabledTooltipText) {
        // End of disable region of previous component
        if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && strcmp(disabledTooltipText, "") != 0) {
            SPDLOG_INFO("blarg");
            ImGui::SetTooltip("%s", disabledTooltipText);
        }
        ImGui::PopStyleVar(1);
        ImGui::PopItemFlag();
    }

so i did a bit more digging and grabbed a build from before the imgui bump https://github.com/HarbourMasters/Shipwright/actions/runs/12721871572 and tested out the tooltip - it seems we're seeing the standard (non-disabled) tooltip every time (even when the checkbox is disabled) there too

Build Artifacts

@aMannus aMannus merged commit b774d39 into HarbourMasters:develop Jan 12, 2025
5 checks passed
@briaguya-ai briaguya-ai deleted the fix-tooltip-bug branch February 9, 2025 05:11
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.

3 participants