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:
@@ -547,23 +547,25 @@ void UsdSceneRenderer::InitRenderer() {
|
||||
if (!hasCycles)
|
||||
LOG_WARNING("HdCyclesPlugin not available (see startup log for DLL load errors).");
|
||||
|
||||
pxr::TfToken currentPlugin = m_renderer->GetCurrentRendererId();
|
||||
if (currentPlugin.IsEmpty() && !plugins.empty()) {
|
||||
// Apply the requested plugin. m_currentRendererPlugin is set from global
|
||||
// preferences before InitRenderer runs; always honour it rather than
|
||||
// checking whether the engine already chose something by default.
|
||||
if (!m_currentRendererPlugin.IsEmpty()) {
|
||||
pxr::TfToken cur = m_renderer->GetCurrentRendererId();
|
||||
if (cur != m_currentRendererPlugin)
|
||||
m_renderer->SetRendererPlugin(m_currentRendererPlugin);
|
||||
} else if (!plugins.empty()) {
|
||||
// Fallback heuristic: prefer Storm/GL
|
||||
pxr::TfToken best;
|
||||
// If a plugin was previously selected, honour it
|
||||
if (!m_currentRendererPlugin.IsEmpty()) {
|
||||
best = m_currentRendererPlugin;
|
||||
} else {
|
||||
for (const auto& p : plugins) {
|
||||
std::string n(p.GetText());
|
||||
if (n.find("Storm") != std::string::npos ||
|
||||
n.find("GL") != std::string::npos) { best = p; break; }
|
||||
}
|
||||
if (best.IsEmpty()) best = plugins[0];
|
||||
for (const auto& p : plugins) {
|
||||
std::string n(p.GetText());
|
||||
if (n.find("Storm") != std::string::npos ||
|
||||
n.find("GL") != std::string::npos) { best = p; break; }
|
||||
}
|
||||
if (best.IsEmpty()) best = plugins[0];
|
||||
m_renderer->SetRendererPlugin(best);
|
||||
LOG_INFO("Selected renderer: " + std::string(m_renderer->GetCurrentRendererId().GetText()));
|
||||
}
|
||||
LOG_INFO("Selected renderer: " + std::string(m_renderer->GetCurrentRendererId().GetText()));
|
||||
|
||||
// Enable AOV "color" (matches stageView._handleRendererChanged)
|
||||
m_renderer->SetRendererAov(pxr::TfToken("color"));
|
||||
|
||||
@@ -313,7 +313,7 @@ private:
|
||||
|
||||
pxr::UsdStageRefPtr m_stage;
|
||||
std::shared_ptr<pxr::UsdImagingGLEngine> m_renderer;
|
||||
pxr::TfToken m_currentRendererPlugin; ///< Active plugin ID (empty = default)
|
||||
pxr::TfToken m_currentRendererPlugin; ///< empty = use Storm/GL heuristic on init
|
||||
pxr::GlfDrawTargetRefPtr m_drawTarget;
|
||||
|
||||
pxr::UsdImagingGLRenderParams m_renderParams;
|
||||
|
||||
Reference in New Issue
Block a user