Skip to content

fix(weather-editor): reinit weathers for record changes#2174

Merged
alandtse merged 9 commits into
community-shaders:devfrom
SkrubbySkrubInAShrub:WE-WW-particle-selection
Apr 22, 2026
Merged

fix(weather-editor): reinit weathers for record changes#2174
alandtse merged 9 commits into
community-shaders:devfrom
SkrubbySkrubInAShrub:WE-WW-particle-selection

Conversation

@SkrubbySkrubInAShrub
Copy link
Copy Markdown
Collaborator

@SkrubbySkrubInAShrub SkrubbySkrubInAShrub commented Apr 21, 2026

When a weathers with records that are tied to them, like precipitation, only read which precipitation record it should play when the weather initialized. Changes to these values wouldn't propagate until the weather was re-initialized, either through forcing the weather or by having it reappear naturally.

This PR introduces some new helpers and logic to re-init weathers when these records are changed so that the changes are actually viewable live. Fixes the issue where changes related to precipitation and reference effects were not applying during edits.
Adds some extra guards to prevent weathers being reforced every frame when for example a slider is used.

Summary by CodeRabbit

  • New Features

    • Precipitation and reference-effect editors now require an explicit Apply, show a “(Changes require manual apply)” indicator, and display the Apply control even when auto-apply is enabled.
    • Editors mark relevant changes as pending so applying them triggers a full weather refresh.
  • Bug Fixes

    • Weather reliably reinitializes after changes to precipitation, reference effects, cloud layers, loading, or reverting.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d4a068ad-72ff-44df-af90-13453ab7a7ac

📥 Commits

Reviewing files that changed from the base of the PR and between acdd260 and 0bf4381.

📒 Files selected for processing (1)
  • src/WeatherEditor/Weather/WeatherWidget.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/WeatherEditor/Weather/WeatherWidget.cpp

📝 Walkthrough

Walkthrough

Widgets that reference forms consumed only at load (precipitation and reference effect) now require manual Apply; Apply paths call explicit weather reinitialization (ForceWeatherReinit / ForceCurrentWeatherReinit) so runtime weather reflects updated references.

Changes

Cohort / File(s) Summary
Precipitation & Reference Effect Widgets
src/WeatherEditor/Weather/PrecipitationWidget.cpp, src/WeatherEditor/Weather/PrecipitationWidget.h, src/WeatherEditor/Weather/ReferenceEffectWidget.cpp, src/WeatherEditor/Weather/ReferenceEffectWidget.h
Widgets now override RequiresManualApply()true; removed per-frame auto-apply from DrawWidget() paths. ApplyChanges() updated to call Widget::ForceCurrentWeatherReinit() after updating live particle/reference data.
Weather Widget
src/WeatherEditor/Weather/WeatherWidget.cpp, src/WeatherEditor/Weather/WeatherWidget.h
Added pendingReinit flag; multiple paths set/consume it (LoadSettings, DrawWidget selections, DrawCloudSettings, InheritAllFromParent, RevertChanges). ApplyChanges() now calls Widget::ForceWeatherReinit(weather) when pendingReinit is set and clears the flag.
Base Widget Class & UI
src/WeatherEditor/Widget.cpp, src/WeatherEditor/Widget.h
Added ForceWeatherReinit(RE::TESWeather*) and ForceCurrentWeatherReinit() APIs and virtual bool RequiresManualApply() const (default false). Header rendering updated to show Apply button and a “(Changes require manual apply)” warning when manual-apply is required even if auto-apply is enabled.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant UI as Editor UI
    participant Widget as Widget (Precip/RefEffect/Weather)
    participant Engine as Game Weather Engine

    User->>UI: Edit precipitation / reference effect
    UI->>Widget: DrawWidget() (widget reports RequiresManualApply)
    Widget-->>UI: Show Apply button & manual-apply warning
    User->>UI: Click Apply
    UI->>Widget: ApplyChanges()
    Widget->>Engine: Update runtime particle/ref data
    Widget->>Engine: ForceWeatherReinit(currentWeather)
    Engine-->>Widget: Weather reinitialized
    Widget-->>UI: Apply complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • alandtse
  • davo0411
  • jiayev

Poem

🐇🌦️ I nudged the rain, then waited for a click,
No auto-sprinkle, no per-frame trick.
Press Apply — the sky gives a sleepy spin,
Particles wake, the storms begin.
A rabbit hops; the weather’s in.

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding weather re-initialization when certain records (precipitation, reference effects) are modified.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

SkrubbySkrubInAShrub and others added 2 commits April 21, 2026 20:16
Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/WeatherEditor/Weather/WeatherWidget.cpp (1)

234-328: ⚠️ Potential issue | 🟡 Minor

Add pendingReinit = true to ImageSpace and VolumetricLighting form-picker and inherit handlers.

ImageSpace and VolumetricLighting form references are assigned in SetWeatherValues() identically to PrecipitationData and ReferenceEffect (all read at weather load time per the ForceWeatherReinit comment), but only the latter two set pendingReinit = true when changed. Changes to imageSpaceRefs[i] (lines 246–249, 259–260) and volumetricLightingRefs[i] (lines 294–297, 307–308) will not propagate until the weather is manually re-forced.

Extend pendingReinit = true to all four form-picker sites and all four inherit handlers to ensure consistency with precipitationData and referenceEffect behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/WeatherEditor/Weather/WeatherWidget.cpp` around lines 234 - 328, When
ImageSpace or VolumetricLighting refs change they must flag a weather reinit;
add pendingReinit = true in the same places PrecipitationData and
ReferenceEffect do: inside the inherit-handler branches where
settings.imageSpaceRefs[i] and settings.volumetricLightingRefs[i] are set from
parent (the blocks that compare and assign from
parentWidget->settings.imageSpaceRefs[i] /
parentWidget->settings.volumetricLightingRefs[i]) and immediately after the
WeatherUtils::DrawFormPickerCached calls that return true for ImageSpace and
VolumetricLighting (the form-picker change handlers). This ensures pendingReinit
is set whenever imageSpaceRefs or volumetricLightingRefs are changed (symbols to
locate: settings.imageSpaceRefs, settings.volumetricLightingRefs, pendingReinit,
parentWidget, WeatherUtils::DrawFormPickerCached, and
SetWeatherValues/ForceWeatherReinit mentioned in the comment).
🧹 Nitpick comments (1)
src/WeatherEditor/Weather/WeatherWidget.cpp (1)

498-505: Prefer routing the reinit through pendingReinit + ApplyChanges() for consistency.

LoadSettings currently does pendingReinit = false; ApplyChanges(); Widget::ForceWeatherReinit(weather);. Combined with the conditional reinit inside ApplyChanges (L1666‑1669), this is functionally equivalent to just setting pendingReinit = true and letting ApplyChanges handle the reinit. Same pattern duplication in RevertChanges at L1697‑1699.

Keeping the reinit decision in one place makes the lifecycle easier to reason about and avoids the risk of the two paths diverging in the future.

♻️ Consolidate to the pendingReinit pattern
 	originalSettings = settings;
-	pendingReinit = false;
+	pendingReinit = true;
 	ApplyChanges();
-	Widget::ForceWeatherReinit(weather);
 }

And at L1697‑1699:

 	settings = vanillaSettings;
-	pendingReinit = false;
+	pendingReinit = true;
 	ApplyChanges();
-	Widget::ForceWeatherReinit(weather);
 }

Note: this also interacts with the ForceWeatherReinit behavior concern raised in Widget.cpp — if that helper ends up gated on sky->currentWeather == weather, this simplification still holds.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/WeatherEditor/Weather/WeatherWidget.cpp` around lines 498 - 505, The
explicit call to Widget::ForceWeatherReinit(weather) in LoadSettings (and the
same in RevertChanges) duplicates reinit logic; instead set pendingReinit = true
and call ApplyChanges() so the reinit flows through the single-path in
ApplyChanges (which already checks pendingReinit), and remove the direct
Widget::ForceWeatherReinit(weather) calls; update
LoadFeatureSettings/LoadSettings and RevertChanges to assign pendingReinit =
true, preserve originalSettings assignment, then call ApplyChanges() only.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/WeatherEditor/Widget.cpp`:
- Around line 279-292: The method ForceWeatherReinit(RE::TESWeather* weather)
unconditionally force-switches the sky to the passed weather without checking if
the passed weather matches the current sky weather, unlike
ForceCurrentWeatherReinit() which guards on sky->currentWeather being non-null.
To fix this, add a nullptr check for the weather parameter and add a condition
to only call sky->ForceWeather(weather, true) if the passed weather is non-null
and matches sky->currentWeather. This prevents unintended force-switching side
effects and aligns with existing usage patterns that gate ForceWeather calls.

---

Outside diff comments:
In `@src/WeatherEditor/Weather/WeatherWidget.cpp`:
- Around line 234-328: When ImageSpace or VolumetricLighting refs change they
must flag a weather reinit; add pendingReinit = true in the same places
PrecipitationData and ReferenceEffect do: inside the inherit-handler branches
where settings.imageSpaceRefs[i] and settings.volumetricLightingRefs[i] are set
from parent (the blocks that compare and assign from
parentWidget->settings.imageSpaceRefs[i] /
parentWidget->settings.volumetricLightingRefs[i]) and immediately after the
WeatherUtils::DrawFormPickerCached calls that return true for ImageSpace and
VolumetricLighting (the form-picker change handlers). This ensures pendingReinit
is set whenever imageSpaceRefs or volumetricLightingRefs are changed (symbols to
locate: settings.imageSpaceRefs, settings.volumetricLightingRefs, pendingReinit,
parentWidget, WeatherUtils::DrawFormPickerCached, and
SetWeatherValues/ForceWeatherReinit mentioned in the comment).

---

Nitpick comments:
In `@src/WeatherEditor/Weather/WeatherWidget.cpp`:
- Around line 498-505: The explicit call to Widget::ForceWeatherReinit(weather)
in LoadSettings (and the same in RevertChanges) duplicates reinit logic; instead
set pendingReinit = true and call ApplyChanges() so the reinit flows through the
single-path in ApplyChanges (which already checks pendingReinit), and remove the
direct Widget::ForceWeatherReinit(weather) calls; update
LoadFeatureSettings/LoadSettings and RevertChanges to assign pendingReinit =
true, preserve originalSettings assignment, then call ApplyChanges() only.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b8257574-e941-412a-b5cd-3e89568a8d87

📥 Commits

Reviewing files that changed from the base of the PR and between 4e1ea45 and dc548d2.

📒 Files selected for processing (8)
  • src/WeatherEditor/Weather/PrecipitationWidget.cpp
  • src/WeatherEditor/Weather/PrecipitationWidget.h
  • src/WeatherEditor/Weather/ReferenceEffectWidget.cpp
  • src/WeatherEditor/Weather/ReferenceEffectWidget.h
  • src/WeatherEditor/Weather/WeatherWidget.cpp
  • src/WeatherEditor/Weather/WeatherWidget.h
  • src/WeatherEditor/Widget.cpp
  • src/WeatherEditor/Widget.h

Comment thread src/WeatherEditor/Widget.cpp
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

♻️ Duplicate comments (1)
src/WeatherEditor/Widget.cpp (1)

279-282: ⚠️ Potential issue | 🟠 Major

Avoid force-switching non-active weather during reinit.

ForceWeatherReinit(weather) still calls ForceWeather(weather, true) for any non-null widget weather, so applying/reverting an inactive weather can switch the live sky to that weather as a side effect. Please gate this to the active weather, or confirm that force-switching edited inactive weather is intentional. This duplicates the earlier finding on this helper.

🔒 Proposed guard
 void Widget::ForceWeatherReinit(RE::TESWeather* weather)
 {
-	if (weather && globals::game::sky)
-		globals::game::sky->ForceWeather(weather, true);
+	auto* sky = globals::game::sky;
+	if (!weather || !sky || sky->currentWeather != weather)
+		return;
+
+	sky->ForceWeather(weather, true);
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/WeatherEditor/Widget.cpp` around lines 279 - 282,
Widget::ForceWeatherReinit currently force-applies any non-null weather and can
unintentionally switch the live sky; change it to first get the sky's
active/current weather from globals::game::sky (e.g., via its
currentWeather/GetActiveWeather accessor) and only call
globals::game::sky->ForceWeather(weather, true) when the passed-in weather
equals the active weather, otherwise skip (or add a clear comment if
force-switching inactive weather is intentionally desired and should remain).
Ensure you modify Widget::ForceWeatherReinit and document the intended behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/WeatherEditor/Widget.cpp`:
- Around line 458-463: The warning text and tooltip currently appear regardless
of the showApply parameter, which can mislead users if the Apply button is
hidden; update the conditional that renders the warning (the block using
RequiresManualApply(), editorWindow->settings.autoApplyChanges, and menu where
ImGui::TextColored and ImGui::SetTooltip are called) to also check the showApply
flag so the "(Changes require manual apply)" text and the "use the Apply button"
tooltip are only shown when showApply is true.

---

Duplicate comments:
In `@src/WeatherEditor/Widget.cpp`:
- Around line 279-282: Widget::ForceWeatherReinit currently force-applies any
non-null weather and can unintentionally switch the live sky; change it to first
get the sky's active/current weather from globals::game::sky (e.g., via its
currentWeather/GetActiveWeather accessor) and only call
globals::game::sky->ForceWeather(weather, true) when the passed-in weather
equals the active weather, otherwise skip (or add a clear comment if
force-switching inactive weather is intentionally desired and should remain).
Ensure you modify Widget::ForceWeatherReinit and document the intended behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cd9ba5c5-648f-4e24-afbf-5f6e47950a77

📥 Commits

Reviewing files that changed from the base of the PR and between dc548d2 and 8e26454.

📒 Files selected for processing (2)
  • src/WeatherEditor/Weather/WeatherWidget.cpp
  • src/WeatherEditor/Widget.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/WeatherEditor/Weather/WeatherWidget.cpp

Comment thread src/WeatherEditor/Widget.cpp Outdated
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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/WeatherEditor/Weather/WeatherWidget.cpp (1)

1498-1546: ⚠️ Potential issue | 🟠 Major

InheritAllFromParent copies record references but never sets pendingReinit.

Lines 1499-1504 copy imageSpaceRefs, volumetricLightingRefs, precipitationData, and referenceEffect from the parent, and line 1545 then calls ApplyChanges() (when auto-apply is enabled). However pendingReinit is not set, so ApplyChanges() will skip Widget::ForceWeatherReinit(weather) and the inherited precipitation/visual-effect/imagespace/volumetric-lighting records will not propagate live — exactly the case this PR was written to fix. The per-record inherit checkboxes in DrawWidget() correctly set pendingReinit = true alongside recordChanged; "Inherit All" should do the same.

🔧 Proposed fix
 	// Copy records (form references)
+	bool recordsChanged = false;
 	for (size_t i = 0; i < ColorTimes::kTotal; i++) {
+		if (settings.imageSpaceRefs[i] != parentWidget->settings.imageSpaceRefs[i] ||
+			settings.volumetricLightingRefs[i] != parentWidget->settings.volumetricLightingRefs[i])
+			recordsChanged = true;
 		settings.imageSpaceRefs[i] = parentWidget->settings.imageSpaceRefs[i];
 		settings.volumetricLightingRefs[i] = parentWidget->settings.volumetricLightingRefs[i];
 	}
+	if (settings.precipitationData != parentWidget->settings.precipitationData ||
+		settings.referenceEffect != parentWidget->settings.referenceEffect)
+		recordsChanged = true;
 	settings.precipitationData = parentWidget->settings.precipitationData;
 	settings.referenceEffect = parentWidget->settings.referenceEffect;
@@
 	// Apply the changes
+	if (recordsChanged) {
+		pendingReinit = true;
+	}
 	if (EditorWindow::GetSingleton()->settings.autoApplyChanges) {
 		ApplyChanges();
 	}

If a pendingReinit when records are unchanged is acceptable, the diff can be simplified to unconditionally setting pendingReinit = true; before the ApplyChanges() call.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/WeatherEditor/Weather/WeatherWidget.cpp` around lines 1498 - 1546, In
InheritAllFromParent, after copying parent records (imageSpaceRefs,
volumetricLightingRefs, precipitationData, referenceEffect) ensure the widget
marks itself for a full reinit so those live resources propagate: set
pendingReinit = true (the same flag set by individual per-record changes in
DrawWidget) before calling ApplyChanges() (so
Widget::ForceWeatherReinit(weather) runs); update the code path around the
ApplyChanges() call in InheritAllFromParent accordingly.
🧹 Nitpick comments (1)
src/WeatherEditor/Weather/WeatherWidget.cpp (1)

227-422: Minor: consolidate the recordChanged / pendingReinit dual assignment.

The pattern recordChanged = true; pendingReinit = true; is repeated at 8 call sites (lines 248-249, 261-262, 298-299, 311-312, 343-344, 356-357, 386-387, 399-400). Since every record change in this tab semantically requires a reinit, one of the two flags is redundant — either drop the separate recordChanged local and gate auto-apply on pendingReinit directly, or wrap the two writes in a small helper lambda. Non-blocking.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/WeatherEditor/Weather/WeatherWidget.cpp` around lines 227 - 422, Replace
the repeated "recordChanged = true; pendingReinit = true;" by consolidating to a
single change call: either remove the local recordChanged and gate the
auto-apply on pendingReinit only, or introduce a small helper (e.g. a lambda
named SetPendingReinit or MarkChanged) at the top of WeatherWidget::[the drawing
function] that sets both pendingReinit and recordChanged once; then replace all
eight duplicate sites to call that helper and update the final auto-apply check
to use pendingReinit (or the helper-updated flag) together with
EditorWindow::GetSingleton()->settings.autoApplyChanges and ApplyChanges().
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/WeatherEditor/Weather/WeatherWidget.cpp`:
- Around line 1498-1546: In InheritAllFromParent, after copying parent records
(imageSpaceRefs, volumetricLightingRefs, precipitationData, referenceEffect)
ensure the widget marks itself for a full reinit so those live resources
propagate: set pendingReinit = true (the same flag set by individual per-record
changes in DrawWidget) before calling ApplyChanges() (so
Widget::ForceWeatherReinit(weather) runs); update the code path around the
ApplyChanges() call in InheritAllFromParent accordingly.

---

Nitpick comments:
In `@src/WeatherEditor/Weather/WeatherWidget.cpp`:
- Around line 227-422: Replace the repeated "recordChanged = true; pendingReinit
= true;" by consolidating to a single change call: either remove the local
recordChanged and gate the auto-apply on pendingReinit only, or introduce a
small helper (e.g. a lambda named SetPendingReinit or MarkChanged) at the top of
WeatherWidget::[the drawing function] that sets both pendingReinit and
recordChanged once; then replace all eight duplicate sites to call that helper
and update the final auto-apply check to use pendingReinit (or the
helper-updated flag) together with
EditorWindow::GetSingleton()->settings.autoApplyChanges and ApplyChanges().

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a53fd528-7a90-41e3-840c-b8edc48470f6

📥 Commits

Reviewing files that changed from the base of the PR and between 75835bd and e649a01.

📒 Files selected for processing (1)
  • src/WeatherEditor/Weather/WeatherWidget.cpp

@SkrubbySkrubInAShrub
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 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.

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.

🧹 Nitpick comments (1)
src/WeatherEditor/Weather/WeatherWidget.cpp (1)

411-413: Persistent pendingReinit may defer reinit into an unrelated edit.

Unlike the previous local recordChanged, pendingReinit is a member flag that persists across frames. If autoApplyChanges is off when a record is edited (or records are edited outside the Records tab, e.g., via InheritAllFromParent / LoadSettings / RevertChanges paths that set it), the flag remains set until the next ApplyChanges() call. That next call may come from an unrelated change (a Fog/DALC slider in another tab), at which point Widget::ForceWeatherReinit will fire while the user is just moving a slider. ForceWeatherReinit does guard on sky->currentWeather == weather, so this is bounded — no harm, just a reinit attributed to the wrong interaction.

If you want to keep reinits tightly coupled to the record-change interaction, consider either (a) consuming the flag without gating on autoApplyChanges (always call ForceWeatherReinit once the flag is set, separate from SetWeatherValues), or (b) only setting pendingReinit at the moment ApplyChanges() is about to be invoked. Not a blocker — current behavior is safe due to the guard inside Widget::ForceWeatherReinit.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/WeatherEditor/Weather/WeatherWidget.cpp` around lines 411 - 413, The
member flag pendingReinit persists across frames and can trigger a reinit from
an unrelated UI action when ApplyChanges() is later invoked; fix by either: (A)
consume the flag immediately after the record-edit path by calling
Widget::ForceWeatherReinit(...) once pendingReinit is set (clear pendingReinit
afterward) so reinit is tied to the edit rather than waiting on
EditorWindow::GetSingleton()->settings.autoApplyChanges, or (B) stop setting
pendingReinit during the edit and instead set it only at the moment
ApplyChanges() is about to run (so pendingReinit is transient and only exists
for the intended ApplyChanges() call); update the logic around SetWeatherValues
/ ApplyChanges / ForceWeatherReinit to implement the chosen approach and ensure
pendingReinit is cleared after ForceWeatherReinit is invoked.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/WeatherEditor/Weather/WeatherWidget.cpp`:
- Around line 411-413: The member flag pendingReinit persists across frames and
can trigger a reinit from an unrelated UI action when ApplyChanges() is later
invoked; fix by either: (A) consume the flag immediately after the record-edit
path by calling Widget::ForceWeatherReinit(...) once pendingReinit is set (clear
pendingReinit afterward) so reinit is tied to the edit rather than waiting on
EditorWindow::GetSingleton()->settings.autoApplyChanges, or (B) stop setting
pendingReinit during the edit and instead set it only at the moment
ApplyChanges() is about to run (so pendingReinit is transient and only exists
for the intended ApplyChanges() call); update the logic around SetWeatherValues
/ ApplyChanges / ForceWeatherReinit to implement the chosen approach and ensure
pendingReinit is cleared after ForceWeatherReinit is invoked.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 121c9a38-dff8-4f17-9ac9-cbbee7983ae5

📥 Commits

Reviewing files that changed from the base of the PR and between e649a01 and acdd260.

📒 Files selected for processing (1)
  • src/WeatherEditor/Weather/WeatherWidget.cpp

@SkrubbySkrubInAShrub
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 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.

@alandtse alandtse changed the title fix(weather-editor): re-init weathers for certain record changes. fix(weather-editor): reinit weathers for record changes Apr 22, 2026
@alandtse alandtse merged commit e0d4460 into community-shaders:dev Apr 22, 2026
6 checks passed
ParticleTroned pushed a commit to ParticleTroned/skyrim-community-shaders that referenced this pull request May 2, 2026
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