Skip to content

fix(weather-editor): disable viewport when HDR Display enabled#2175

Merged
alandtse merged 4 commits into
community-shaders:devfrom
SkrubbySkrubInAShrub:viewport-HDR-disable
Apr 22, 2026
Merged

fix(weather-editor): disable viewport when HDR Display enabled#2175
alandtse merged 4 commits into
community-shaders:devfrom
SkrubbySkrubInAShrub:viewport-HDR-disable

Conversation

@SkrubbySkrubInAShrub
Copy link
Copy Markdown
Collaborator

@SkrubbySkrubInAShrub SkrubbySkrubInAShrub commented Apr 21, 2026

the viewport has compatibility issues with HDR

Summary by CodeRabbit

  • Bug Fixes
    • Viewport is automatically disabled when HDR Display is enabled to avoid rendering issues; the menu checkbox remains visible but cannot activate the viewport in HDR mode.
    • Hover tooltip explains why the Viewport is unavailable under HDR.
    • Background blur now correctly follows viewport availability.
    • Viewport/show-state updates while the editor is open are kept in sync with HDR toggles.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

📝 Walkthrough

Walkthrough

EditorWindow now uses an HDR-aware query IsViewportActive() to gate viewport UI, rendering, and lifecycle. The Viewport checkbox is disabled with a tooltip when HDR is active, and BackgroundBlur is kept in sync when the viewport-active state changes at draw time.

Changes

Cohort / File(s) Summary
Editor window implementation
src/WeatherEditor/EditorWindow.cpp
Added IsViewportActive() and replaced direct settings.showViewport checks with the HDR-aware query in RenderUI, Draw, and UpdateOpenState. Disabled the Viewport menu checkbox with a hover tooltip when HDR is enabled. Added runtime sync in Draw() to call BackgroundBlur::SetWeatherEditorActive(...) when viewport-active toggles.
Editor window header
src/WeatherEditor/EditorWindow.h
Declared public method bool IsViewportActive() const;.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant ImGui as ImGui (Menu/UI)
    participant Editor as EditorWindow
    participant HDR as Globals::HDR (enableHDR)
    participant Blur as BackgroundBlur
    participant Renderer as ViewportRenderer

    rect rgba(200,200,255,0.5)
    User->>ImGui: Toggle "Window → Viewport" checkbox
    ImGui->>Editor: Query IsViewportActive()
    Editor->>HDR: Read enableHDR
    HDR-->>Editor: enableHDR (true/false)
    Editor-->>ImGui: Return active = settings.showViewport && !enableHDR
    end

    rect rgba(200,255,200,0.5)
    Note over Editor,Blur: On open/close or HDR toggle
    Editor->>Editor: Draw() / UpdateOpenState() detects active change
    Editor->>Blur: SetWeatherEditorActive(IsViewportActive())
    Blur-->>Editor: ACK
    end

    rect rgba(255,200,200,0.5)
    Note over Renderer,Editor: Render loop
    Renderer->>Editor: Request viewport render
    Editor->>HDR: Check enableHDR
    Editor-->>Renderer: Render only if IsViewportActive()
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • doodlum
  • alandtse
  • davo0411

Poem

🐇
I hopped through menus, soft and neat,
HDR nudged me off the seat.
The viewport naps while blur stays true,
I twitch my nose and patch the view. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% 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.
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.
Title check ✅ Passed The title directly and clearly summarizes the main change: disabling the weather editor viewport when HDR Display is enabled, which matches the core objective of the PR.

✏️ 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.

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

🤖 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/EditorWindow.cpp`:
- Around line 1413-1414: UpdateOpenState currently forces settings.showViewport
= false when globals::features::hdrDisplay.settings.enableHDR is true, which
persists the change to disk; remove that assignment so user preference isn't
mutated. Instead, leave settings.showViewport untouched and gate actual viewport
activation and rendering on the HDR runtime flag (e.g., check hdrActive or
globals::features::hdrDisplay.settings.enableHDR) inside the code paths that
enable/draw the viewport — specifically modify RenderUI (the branch that renders
the viewport) and any viewport activation logic to short-circuit rendering when
HDR is active while preserving settings.showViewport for serialization.
🪄 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: 170af604-b8af-40ba-9372-c8687390ba82

📥 Commits

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

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

Comment thread src/WeatherEditor/EditorWindow.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/EditorWindow.cpp (1)

1415-1424: ⚠️ Potential issue | 🟠 Major

Keep background blur synced when HDR changes at runtime.

Line 1418 only runs on the open transition. If HDR is enabled/disabled while the editor stays open, Draw() and layout react via IsViewportActive(), but BackgroundBlur::weatherEditorActive keeps the old value until close/reopen.

🐛 Proposed fix
 	if (open && !wasOpen) {
 		DisableVanityCamera();
 		HideGameMenus();
-		BackgroundBlur::SetWeatherEditorActive(IsViewportActive());
-
-	} else if (!open && wasOpen) {
+	}
+
+	if (open) {
+		BackgroundBlur::SetWeatherEditorActive(IsViewportActive());
+	} else if (wasOpen) {
 		RestoreVanityCamera();
 		ShowGameMenus();
 		BackgroundBlur::SetWeatherEditorActive(false);
 	}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/WeatherEditor/EditorWindow.cpp` around lines 1415 - 1424, The background
blur flag is only updated on open/close transitions, so when HDR toggles while
the editor remains open BackgroundBlur::weatherEditorActive is stale; update the
blur state whenever the editor is open and viewport activity can change (e.g. on
each Draw() or in the HDR-change handler) by calling
BackgroundBlur::SetWeatherEditorActive(IsViewportActive()) when the window is
open (in addition to the existing transition code in the block containing
DisableVanityCamera/RestoreVanityCamera), ensuring you reference the existing
functions BackgroundBlur::SetWeatherEditorActive and IsViewportActive() to keep
the blur state in sync.
🧹 Nitpick comments (1)
src/WeatherEditor/EditorWindow.h (1)

1-1: Shorten the PR title and add an issue reference if one exists.

The title is conventional, but it exceeds the 50-character guideline. Consider: fix(weather-editor): disable HDR viewport. If this fixes a tracked bug, add Fixes #<id> to the PR description.

As per coding guidelines, “Conventional Commit Titles… Length: 50 characters limit for title” and “Issue References… Suggest adding appropriate GitHub keywords.”

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

In `@src/WeatherEditor/EditorWindow.h` at line 1, Shorten the pull request title
to follow the 50-character conventional-commit guideline (for example:
"fix(weather-editor): disable HDR viewport") and, if this change resolves a
tracked bug, add an issue reference line in the PR description using GitHub
keywords (e.g., "Fixes #<id>"). Update the PR title field and the PR description
(not source files) accordingly so the commit/PR metadata adheres to the
project's Conventional Commits and issue reference rules.
🤖 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/EditorWindow.cpp`:
- Around line 1415-1424: The background blur flag is only updated on open/close
transitions, so when HDR toggles while the editor remains open
BackgroundBlur::weatherEditorActive is stale; update the blur state whenever the
editor is open and viewport activity can change (e.g. on each Draw() or in the
HDR-change handler) by calling
BackgroundBlur::SetWeatherEditorActive(IsViewportActive()) when the window is
open (in addition to the existing transition code in the block containing
DisableVanityCamera/RestoreVanityCamera), ensuring you reference the existing
functions BackgroundBlur::SetWeatherEditorActive and IsViewportActive() to keep
the blur state in sync.

---

Nitpick comments:
In `@src/WeatherEditor/EditorWindow.h`:
- Line 1: Shorten the pull request title to follow the 50-character
conventional-commit guideline (for example: "fix(weather-editor): disable HDR
viewport") and, if this change resolves a tracked bug, add an issue reference
line in the PR description using GitHub keywords (e.g., "Fixes #<id>"). Update
the PR title field and the PR description (not source files) accordingly so the
commit/PR metadata adheres to the project's Conventional Commits and issue
reference rules.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5a7a8cea-d34c-4505-8fe0-a5f308a9ec78

📥 Commits

Reviewing files that changed from the base of the PR and between a7db391 and 0be334c.

📒 Files selected for processing (2)
  • src/WeatherEditor/EditorWindow.cpp
  • src/WeatherEditor/EditorWindow.h

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 (1)
src/WeatherEditor/EditorWindow.cpp (1)

1-1: PR metadata suggestion: shorten the title and add an issue link if available.

Suggested title: fix(weather-editor): gate viewport for hdr. If this fixes a tracked bug, add Fixes #<issue> or Closes #<issue> to the PR body. As per coding guidelines, conventional commit titles should use type(scope): description and stay within the 50-character title limit, and bug-fix PRs should include GitHub issue keywords where applicable.

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

In `@src/WeatherEditor/EditorWindow.cpp` at line 1, The PR title is too long and
missing an issue reference; update the PR title to a concise conventional-commit
style like "fix(weather-editor): gate viewport for hdr" and, if this change
fixes a tracked bug, add an issue-closing keyword in the PR body such as "Fixes
#<issue>" or "Closes #<issue>" so maintainers can auto-link and close the issue;
apply this change to the PR that modifies src/WeatherEditor/EditorWindow.cpp and
ensure the title stays within ~50 characters and follows type(scope):
description format.
🤖 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/EditorWindow.cpp`:
- Around line 998-1008: The viewport disable logic uses
globals::features::hdrDisplay.settings.enableHDR only; change it to check the
feature is loaded and enabled (globals::features::hdrDisplay.loaded &&
globals::features::hdrDisplay.settings.enableHDR) before calling
ImGui::BeginDisabled()/EndDisabled() and before any IsViewportActive-style
checks so the viewport isn't blocked when HDR is configured but not actually
active; update the block around the ImGui::Checkbox("Viewport",
&settings.showViewport) and the other similar block in EditorWindow.cpp that
uses hdrDisplay.settings.enableHDR so both use hdrDisplay.loaded &&
hdrDisplay.settings.enableHDR and keep calls to
BackgroundBlur::SetWeatherEditorActive and Save() unchanged.

---

Nitpick comments:
In `@src/WeatherEditor/EditorWindow.cpp`:
- Line 1: The PR title is too long and missing an issue reference; update the PR
title to a concise conventional-commit style like "fix(weather-editor): gate
viewport for hdr" and, if this change fixes a tracked bug, add an issue-closing
keyword in the PR body such as "Fixes #<issue>" or "Closes #<issue>" so
maintainers can auto-link and close the issue; apply this change to the PR that
modifies src/WeatherEditor/EditorWindow.cpp and ensure the title stays within
~50 characters and follows type(scope): description format.
🪄 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: 2a287a23-3f9d-4cea-b848-616dfd6a0fe9

📥 Commits

Reviewing files that changed from the base of the PR and between 0be334c and c213369.

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

Comment thread src/WeatherEditor/EditorWindow.cpp Outdated
@alandtse alandtse changed the title fix(weather-editor): disable viewport when HDR Display is enabled fix(weather-editor): disable viewport when HDR Display enabled Apr 22, 2026
@alandtse alandtse merged commit c4f9405 into community-shaders:dev Apr 22, 2026
6 checks passed
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