Skip to content

feat(menu): add option to disable Clear Shader Cache button#1740

Closed
SkrubbySkrubInAShrub wants to merge 5 commits into
community-shaders:devfrom
SkrubbySkrubInAShrub:hide-clear-shader-cache
Closed

feat(menu): add option to disable Clear Shader Cache button#1740
SkrubbySkrubInAShrub wants to merge 5 commits into
community-shaders:devfrom
SkrubbySkrubInAShrub:hide-clear-shader-cache

Conversation

@SkrubbySkrubInAShrub
Copy link
Copy Markdown
Collaborator

@SkrubbySkrubInAShrub SkrubbySkrubInAShrub commented Jan 20, 2026

Some preset authors have voiced a frustration about how they often accidentally click the clear shader cache button instead of clicking save settings. This leads to having lengthy shader recompilations.

This PR aims to address this frustration by adding a new toggle in the themes tab, which will grey out this button and disable it, this setting is turned off by default as to not affect default behaviour and my intention is to save this to the themes, rather than the user settings. however this is currently cumbersome as the theme saving system has jank.

Draft for now, will talk to Davo.

Summary by CodeRabbit

  • New Features
    • Added a new Interface setting to disable the Clear Shader Cache button in the menu header.
    • When disabled, the button appears greyed out and becomes non-functional.
    • The new option is available in the Interface settings tab under Additional Interface Settings.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 20, 2026

📝 Walkthrough

Walkthrough

This PR introduces a new configuration option DisableClearCacheButton to the theme settings that allows disabling the Clear Shader Cache button in the menu header. The implementation adds a boolean field to theme settings, propagates a disabled state flag through the action icon system, and updates menu rendering logic to respect the disabled state with appropriate visual indicators and blocked interactions.

Changes

Cohort / File(s) Summary
Theme Settings Structure
src/Menu.h, src/Menu.cpp
Added DisableClearCacheButton boolean field to Menu::ThemeSettings with serialization support via NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT declaration.
Action Icon Structure
src/Menu/MenuHeaderRenderer.h
Extended ActionIcon struct with new disabled boolean field (default: false) to propagate disabled state through icon data.
Header Rendering Logic
src/Menu/MenuHeaderRenderer.cpp
Implemented disabled state handling: BuildActionIcons computes disabled flag from settings; RenderDockedIcons and RenderUndockedIcons conditionally render disabled state with ImGui::BeginDisabled blocks, suppress callbacks, apply tint adjustments, and display "(Disabled)" tooltip suffix.
Settings UI
src/Menu/SettingsTabRenderer.cpp
Added "Disable Clear Shader Cache Button" checkbox in Interface tab settings under new "Additional Interface Settings" block, bound to Theme.DisableClearCacheButton with explanatory tooltip.

Sequence Diagram

sequenceDiagram
    participant Settings as Settings System
    participant HeaderRenderer as MenuHeaderRenderer
    participant ActionIcon as ActionIcon Data
    participant ImGui as ImGui Rendering

    Settings->>HeaderRenderer: Theme.DisableClearCacheButton = true/false
    HeaderRenderer->>HeaderRenderer: BuildActionIcons()<br/>compute isDisabled from settings
    HeaderRenderer->>ActionIcon: Create ActionIcon(disabled=isDisabled)<br/>Set tooltip to "(Disabled)" if disabled
    ActionIcon->>ImGui: Pass disabled flag & tooltip
    ImGui->>ImGui: BeginDisabled(icon.disabled)
    ImGui->>ImGui: Render button with tint/state
    ImGui->>ImGui: Block callback if disabled
    ImGui->>ImGui: EndDisabled()
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly Related PRs

  • #1297: Modifies the Clear Shader Cache action itself; shares the same button/action handling infrastructure.
  • #1330: Introduces theming and header rendering system that forms the foundation for this disabled-state feature.
  • #1107: Establishes menu header and icon subsystem; this PR extends it with disabled-state configuration.

Suggested Reviewers

  • davo0411
  • alandtse

Poem

🐰 A button disabled, a toggle so fine,
Theme settings now grant us control over the shine!
When users don't need that cache-clearing cheer,
Grey it out gently—no click, crystal clear.
Hop onwards with features that fit like a glove! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately and concisely describes the main change: adding an option to disable the Clear Shader Cache button in the menu.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.
@github-actions
Copy link
Copy Markdown

Using provided base ref: 44eb788
Using base ref: 44eb788
Base commit date: 2026-01-19T23:55:15Z (Monday, January 19, 2026 11:55 PM)
No actionable suggestions for changed features.

@SkrubbySkrubInAShrub
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@SkrubbySkrubInAShrub
Copy link
Copy Markdown
Collaborator Author

will rework

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.

1 participant