Add global Preferences dialog and per-viewport render delegate

Preferences (Edit > Preferences, tabbed General/Animation/Viewport):
- Viewport tab: Default Render Delegate and Color Correction settings
- Persisted to %APPDATA%\UsdLayerManager\preferences.ini
- Render delegate: startup default only (not live-applied to running tiles)
- Color correction: global, applied live to all viewports on change

Render delegate per-viewport:
- Each tile toolbar switches its own delegate independently
- Saved per-tile in viewport_settings.ini; restored on next launch
- Tiles with no saved delegate get the pref default on startup

Color correction global:
- Removed from gear popup; lives in Preferences > Viewport only
- Applied to all tiles on init and on live change from Preferences

Fix InitRenderer always applying m_currentRendererPlugin when set,
rather than skipping when UsdImagingGLEngine auto-selects a default.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-28 11:43:32 +08:00
parent b02a736da0
commit cb0d72d980
8 changed files with 376 additions and 216 deletions
+11 -2
View File
@@ -52,7 +52,7 @@ public:
// ── Main render (called from Application::RenderUI) ──────────────────────
void Render(bool* p_open = nullptr);
// ── Pick callbacks (wired by Application after construction) ─────────────
// ── Callbacks (wired by Application after construction) ──────────────────
std::function<void(const std::string&)> OnPrimPicked;
std::function<void(const std::vector<std::string>&)> OnPrimsPickedRect;
@@ -65,9 +65,18 @@ public:
LayoutMode GetLayout() const { return m_layout; }
int GetFocusedTileIndex() const { return m_focusedTileIndex; }
// ── Global preferences ────────────────────────────────────────────────────
/// Set render delegate on tiles that have no saved delegate yet (empty token).
/// Called once on startup so the pref default applies to fresh tiles.
void ApplyDefaultDelegate(const std::string& delegate);
/// Apply color correction to every tile (always global).
void ApplyGlobalColorCorrection(int ccMode, const std::string& ocioDisplay,
const std::string& ocioView,
const std::string& ocioColorSpace,
const std::string& ocioLook);
// ── 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;