Skip to content

fix: added missing includes and add helper method to enable build#1135

Merged
alandtse merged 2 commits into
community-shaders:devfrom
soda3000:pr-includes
Jun 12, 2025
Merged

fix: added missing includes and add helper method to enable build#1135
alandtse merged 2 commits into
community-shaders:devfrom
soda3000:pr-includes

Conversation

@soda3000
Copy link
Copy Markdown
Contributor

@soda3000 soda3000 commented Jun 11, 2025

Wasn't able to build without adjusting these few missing includes and also since settings is private, I added a helper method to get the ThemeSettings publicly.

Summary by CodeRabbit

  • New Features
    • Improved access to theme settings, allowing UI elements to display error messages with consistent styling.
  • Refactor
    • Updated how the error color is retrieved for displaying messages in the user interface.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 11, 2025

Walkthrough

The changes refactor how the error color for UI rendering is accessed by introducing a public accessor method, GetTheme(), in the Menu class. The code now retrieves the theme settings via this method instead of directly accessing the settings member. Necessary include directives were also updated in both Feature.h and Menu.h.

Changes

File(s) Change Summary
src/Feature.h Added includes for "Globals.h" and "Menu.h". Updated error color access in DrawUnloadedUI to use Menu::GetSingleton()->GetTheme() instead of global pointer.
src/Menu.h Added include for <winrt/Base.h>. Introduced GetTheme() public accessor method for theme settings.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Feature
    participant Menu

    User->>Feature: Trigger DrawUnloadedUI()
    Feature->>Menu: Menu::GetSingleton()
    Feature->>Menu: GetTheme()
    Menu-->>Feature: Return ThemeSettings (read-only)
    Feature->>Feature: Access StatusPalette.Error from ThemeSettings
    Feature->>UI: ImGui::TextColored(errorColor, "This feature is not installed!")
Loading
✨ 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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.
@soda3000 soda3000 changed the title Fixed includes and encapsulation to build fix: added missing includes and add helper method to enable build Jun 11, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/Menu.h (1)

182-182: Accessor could be safer & clearer with [[nodiscard]] + noexcept
Returning a const reference is fine, but marking the function noexcept and [[nodiscard]] prevents accidental misuse and advertises that the call is side-effect free.

-const ThemeSettings& GetTheme() const { return settings.Theme; }
+[[nodiscard]] const ThemeSettings& GetTheme() const noexcept { return settings.Theme; }

Optional, but a cheap win.

src/Feature.h (1)

3-5: Superfluous/expensive includes
DrawUnloadedUI only needs the Menu declaration and ImVec4; the full Menu.h (≈1 k-loc) drags extra headers into every TU that includes Feature.h.

Consider:

#include "Globals.h"          // Still required?
class Menu;                   // forward declaration

and move the #include "Menu.h" to the implementation file that actually calls Menu::GetSingleton().
This shaves compile time and avoids unnecessary rebuilds when Menu.h changes.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5793468 and e567341.

📒 Files selected for processing (2)
  • src/Feature.h (2 hunks)
  • src/Menu.h (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build plugin and addons
🔇 Additional comments (1)
src/Feature.h (1)

60-60: Theme access now properly encapsulated – nice
Using Menu::GetSingleton()->GetTheme() removes the writeable global and respects the new accessor.

Comment thread src/Menu.h

#include "Utils/Serialize.h"
#include <dxgi1_4.h>
#include <winrt/Base.h>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Jun 11, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

Incorrect case in winrt include may break builds on case-sensitive filesystems
The Windows C++/WinRT header is winrt/base.h (all lower-case). Using Base.h compiles on the default Windows file-system but fails on case-sensitive environments (WSL, CI containers, cross-platform tool-chains).

-#include <winrt/Base.h>
+#include <winrt/base.h>
🤖 Prompt for AI Agents
In src/Menu.h at line 5, the include directive uses incorrect casing for the
Windows C++/WinRT header. Change the include from #include <winrt/Base.h> to
#include <winrt/base.h> using all lowercase letters to ensure compatibility with
case-sensitive filesystems.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

pretty sure that's okay

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@soda3000 It usually builds on a default Windows workstation because NTFS is case-insensitive, but any workflow that compiles the project on a case-sensitive file-system (e.g. WSL, Linux CI runner, macOS, or even Windows with the optional case-sensitive flag enabled) will look for the literal path and fail to find Base.h.

Microsoft ships the header as

…/cppwinrt/winrt/base.h

(all lower-case) in both the VS/BuildTools and vcpkg layouts.
Compilers such as Clang/LLVM on a case-sensitive volume therefore error with:

fatal error: 'winrt/Base.h' file not found

Switching to #include <winrt/base.h> keeps Windows builds unchanged while preventing those portability breaks. Let me know if you’d like me to submit the one-line fix, or if you prefer to leave it as-is and we can revisit later.

@github-actions
Copy link
Copy Markdown

✅ A pre-release build is available for this PR:
Download

Copy link
Copy Markdown
Collaborator

@alandtse alandtse left a comment

Choose a reason for hiding this comment

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

At least it builds. Thanks.

@alandtse alandtse merged commit e8a10ec into community-shaders:dev Jun 12, 2025
10 of 11 checks passed
alandtse added a commit to alandtse/open-shaders that referenced this pull request Jun 12, 2025
* Fixed includes and encapsulation to build

* style: 🎨 apply pre-commit.ci formatting

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
davo0411 pushed a commit to davo0411/skyrim-community-shaders that referenced this pull request Jun 21, 2025
* Fixed includes and encapsulation to build

* style: 🎨 apply pre-commit.ci formatting

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
alandtse pushed a commit to alandtse/open-shaders that referenced this pull request Jul 20, 2025
* Fixed includes and encapsulation to build

* style: 🎨 apply pre-commit.ci formatting

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

2 participants