fix: replace original shaders off and not saveable#1835
Conversation
This reverts commit f55f195.
📝 WalkthroughWalkthroughThis PR bumps the project version to 1.4.11 and adds JSON serialization support for LightLimitFix settings, including a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates Community Shaders’ settings persistence so shader replacement toggles (“Replace Original Shaders”) default to enabled and can be saved/loaded via JSON, and bumps the project version.
Changes:
- Initialize
State::enabledClassestotrueby default. - Persist “Replace Original Shaders” per-shader-class enablement into the JSON config and restore it on load.
- Add JSON (de)serialization for
LightLimitFix::Settingsand bump version to1.4.11.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/State.h |
Defaults shader-class enable toggles to enabled at startup. |
src/State.cpp |
Saves/loads per-shader-class “Replace Original Shaders” settings to/from JSON. |
src/Features/LightLimitFix.h |
Adds a new settings field (EnableContactShadows). |
src/Features/LightLimitFix.cpp |
Introduces nlohmann JSON serialization and enables saving/loading LLF settings. |
CMakeLists.txt |
Version bump to 1.4.11. |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/State.cpp (1)
590-597:⚠️ Potential issue | 🔴 CriticalFix index mismatch in
ShaderEnabled: change+ 1to- 1to match save/load and UI code.The
ShaderEnabledfunction usesindex = enum_integer(a_type) + 1to read fromenabledClasses, butForEachShaderTypeWithIndex(used by save/load at lines 411-412, 484-487) computesclassIndex = typeIndex - 1. For the same shader type with enum valuev, this creates an offset of 2:ShaderEnabledreadsenabledClasses[v+1]while save/load accessesenabledClasses[v-1]. This mismatch also affects the UI (AdvancedSettingsRenderer.cpp) and performance overlay, which all use the-1scheme. Toggle state persisted in config files will not control actual shader enablement.Change line 592 from:
auto index = magic_enum::enum_integer(a_type) + 1;to:
auto index = magic_enum::enum_integer(a_type) - 1;
🤖 Fix all issues with AI agents
In `@src/Features/LightLimitFix.h`:
- Around line 177-182: The new Settings::EnableContactShadows field is declared
and serialized via NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT in
LightLimitFix.cpp but never used; either drop the field or implement end-to-end
support: add a DrawSettings checkbox bound to Settings::EnableContactShadows
(same UI area that contains EnableLightsVisualisation), read the setting in the
module's runtime update/apply method (e.g., LightLimitFix::ApplySettings or
UpdateLights), and propagate it into the rendering pipeline by setting the
appropriate shader define/uniform or toggling the contact-shadow rendering path
so the serialized flag actually controls runtime behavior. Ensure the symbol
names to change include Settings::EnableContactShadows, the JSON macro in
LightLimitFix.cpp, the DrawSettings UI function, and the runtime method that
updates shader defines or light rendering.
|
✅ A pre-release build is available for this PR: |
Note this should be REBASED. Everyone will need to pull --rebase.
Summary by CodeRabbit
New Features
Chores