Add per-viewport render settings persistence (delegate, grid, AA, bg, bbox, lighting)

ViewportTileSettings struct captures: render delegate, show grid, AA, background
color, bbox mode, ambient-light-only, dome-light flags.

ViewportPanel::SaveSettings() writes a simple INI file (layout + one [TileN]
section per tile) to %APPDATA%\UsdLayerManager\viewport_settings.ini on
Application::Shutdown().

ViewportPanel::LoadSettings() is called at the end of Application::Initialize()
— after the viewport panel is constructed but before the first frame — so the
saved render delegate is picked up by UsdSceneRenderer::InitRenderer() on the
first Render() call.  Layout (Single/HSplit/VSplit/Quad) and split ratios are
also restored, creating the correct number of tiles before settings are applied.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-25 09:34:00 +08:00
parent 4b7323c24c
commit 9d8840ced6
6 changed files with 172 additions and 0 deletions
+7
View File
@@ -65,6 +65,13 @@ public:
LayoutMode GetLayout() const { return m_layout; }
int GetFocusedTileIndex() const { return m_focusedTileIndex; }
// ── Settings persistence ─────────────────────────────────────────────────
/// Load layout and per-tile render settings from a simple INI file.
/// Safe to call immediately after construction (before any Render call).
void LoadSettings(const std::string& path);
/// Save current layout and per-tile render settings to a simple INI file.
void SaveSettings(const std::string& path) const;
private:
// ── Tile rect helper ─────────────────────────────────────────────────────