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:
@@ -17,6 +17,19 @@
|
||||
|
||||
namespace UsdLayerManager {
|
||||
|
||||
/// Serialisable snapshot of all per-tile render settings.
|
||||
struct ViewportTileSettings {
|
||||
std::string renderDelegate; ///< TfToken string, empty = default (Storm)
|
||||
bool showGrid = true;
|
||||
bool aaEnabled = false;
|
||||
float bgColorR = 0.15f;
|
||||
float bgColorG = 0.15f;
|
||||
float bgColorB = 0.15f;
|
||||
int bboxMode = 0; ///< BBoxMode cast to int
|
||||
bool ambientLightOnly = false;
|
||||
bool domeLightEnabled = false;
|
||||
};
|
||||
|
||||
/// Named orthographic view directions.
|
||||
/// When m_orthoView != None the tile renders an orthographic camera locked to
|
||||
/// that world-space direction; the free-camera orbital state (center + dist)
|
||||
@@ -87,6 +100,11 @@ public:
|
||||
|
||||
void FrameScene();
|
||||
|
||||
/// Snapshot all current render settings into a portable struct.
|
||||
ViewportTileSettings GetSettings() const;
|
||||
/// Apply a previously-saved settings snapshot (safe to call before first Render).
|
||||
void ApplySettings(const ViewportTileSettings& s);
|
||||
|
||||
private:
|
||||
// ── Render sub-functions ─────────────────────────────────────────────────
|
||||
pxr::GfCamera ResolveCamera();
|
||||
|
||||
Reference in New Issue
Block a user