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:
@@ -138,6 +138,15 @@ bool Application::Initialize(const std::string& windowTitle, int width, int heig
|
||||
RefreshManagers();
|
||||
}
|
||||
|
||||
// Load per-viewport settings (render delegate, grid, AA, etc.) from AppData.
|
||||
if (const char* appData = getenv("APPDATA")) {
|
||||
namespace fs = std::filesystem;
|
||||
fs::path dir = fs::path(appData) / "UsdLayerManager";
|
||||
fs::create_directories(dir);
|
||||
m_viewportSettingsPath = (dir / "viewport_settings.ini").string();
|
||||
m_viewportPanel->LoadSettings(m_viewportSettingsPath);
|
||||
}
|
||||
|
||||
LOG_INFO("Application initialized successfully");
|
||||
return true;
|
||||
}
|
||||
@@ -155,6 +164,9 @@ void Application::Run() {
|
||||
}
|
||||
|
||||
void Application::Shutdown() {
|
||||
if (m_viewportPanel && !m_viewportSettingsPath.empty())
|
||||
m_viewportPanel->SaveSettings(m_viewportSettingsPath);
|
||||
|
||||
m_viewportPanel.reset();
|
||||
m_sceneHierarchyPanel.reset();
|
||||
m_propertyPanel.reset();
|
||||
|
||||
Reference in New Issue
Block a user