From 05e0a672c640115899e2316ddf9029089708aab0 Mon Sep 17 00:00:00 2001 From: Talis Barbalho Date: Tue, 30 Jun 2026 13:09:59 -0400 Subject: [PATCH] Retain window size --- .../ui/debugTools/CompositionEditorCmd.cpp | 36 +++++++++++++++++-- .../ui/renderSetup/renderSetupWindowCmd.cpp | 1 - 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/lib/usd/ui/debugTools/CompositionEditorCmd.cpp b/lib/usd/ui/debugTools/CompositionEditorCmd.cpp index 3e2d4a148..b490e3784 100644 --- a/lib/usd/ui/debugTools/CompositionEditorCmd.cpp +++ b/lib/usd/ui/debugTools/CompositionEditorCmd.cpp @@ -41,6 +41,8 @@ #include #include +#include +#include #include #include #include @@ -124,8 +126,10 @@ class MayaCompositionEditorHost : public Adsk::UsdDebug::ApplicationHost switch (color) { case ThemeColors::DisabledForeground: return QApplication::palette().color(QPalette::Disabled, QPalette::WindowText); + default: + // All other roles use the base host's themed defaults. + return ApplicationHost::themeColor(color); } - return QColor(); } bool executeInCmd( @@ -148,8 +152,34 @@ class MayaCompositionEditorHost : public Adsk::UsdDebug::ApplicationHost return edit(); } + float uiScale() const override { return static_cast(MQtUtil::dpiScale(1.0f)); } + + QVariant loadPersistentData(const QString& group, const QString& key) const override + { + const MString varName = optionVarName(group, key); + if (!MGlobal::optionVarExists(varName)) { + return QVariant(); + } + + return QVariant(QString::fromUtf8(MGlobal::optionVarStringValue(varName).asChar())); + } + + void + savePersistentData(const QString& group, const QString& key, const QVariant& value) override + { + // Store every value as a string optionVar + const MString varName = optionVarName(group, key); + MGlobal::setOptionVarValue(varName, MString(value.toString().toUtf8().constData())); + } + protected: MayaCompositionEditorHost() { injectInstance(this); } + + static MString optionVarName(const QString& group, const QString& key) + { + const QString name = QStringLiteral("mayaUsd_CompositionEditor_%1_%2").arg(group, key); + return MString(name.toUtf8().constData()); + } }; bool workspaceControlExists() @@ -257,7 +287,9 @@ MStatus CompositionEditorCmd::doIt(const MArgList& args) // First invocation: create the workspace control wrapper, then create // the widget inside it. -retain false + -deleteLater false combined // with -uiScript matches the Layer Editor pattern so the widget is - // rebuilt on layout save/restore. + // rebuilt on layout save/restore. The workspace control persists its own + // size across sessions, so -initialWidth/-initialHeight only seed the + // first-launch geometry. MString createCmd; createCmd.format( "workspaceControl" diff --git a/lib/usd/ui/renderSetup/renderSetupWindowCmd.cpp b/lib/usd/ui/renderSetup/renderSetupWindowCmd.cpp index afec1b21e..b1e9301d4 100644 --- a/lib/usd/ui/renderSetup/renderSetupWindowCmd.cpp +++ b/lib/usd/ui/renderSetup/renderSetupWindowCmd.cpp @@ -18,7 +18,6 @@ #include "mayaEditCommitter.h" #include -#include #include #include