Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions lib/usd/ui/editForward/editForwardDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <AdskUsdEditForwardUi/StageEntry.h>
#include <QtCore/QPointer>
#include <QtCore/QTimer>
#include <QtCore/QVariant>
#include <QtWidgets/QVBoxLayout>

#include <vector>
Expand Down Expand Up @@ -79,12 +80,20 @@ struct SelectionObserver : Ufe::Observer
} // namespace

EditForwardDialog::EditForwardDialog(const QString& title, QWidget* parent)
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint)
: QDialog(parent)
{
setAttribute(Qt::WA_DeleteOnClose);
setWindowTitle(title);
resize(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stop forcing the size everytime. Via size hint and with the other changes below, keeps the user size

static_cast<int>(MQtUtil::dpiScale(1250.0f)), static_cast<int>(MQtUtil::dpiScale(1000.0f)));
// Maya keys saved window preferences off the object name.
setObjectName("EditForwardConfigDialog");

// Tell Maya to treat this as a Maya-managed window. This is the same
// mechanism Maya uses internally to keep its own dialogs from going behind
// the main window.
// Per Maya dev guidance these two calls should be applied alone, without
// combining with any other Qt window flags.
setWindowFlags(Qt::Window);
setProperty("saveWindowPref", QVariant::fromValue(true));

_forwardWidget = new AdskUsdEditForwardUi::ForwardWidget(this);
_forwardWidget->setSourceLayerDefault(
Expand Down Expand Up @@ -127,6 +136,12 @@ EditForwardDialog::~EditForwardDialog()
}
}

QSize EditForwardDialog::sizeHint() const
{
return QSize(
static_cast<int>(MQtUtil::dpiScale(1250.0f)), static_cast<int>(MQtUtil::dpiScale(1000.0f)));
}

void EditForwardDialog::processNodeAdded(MObject& /*node*/)
{
QTimer::singleShot(0, this, &EditForwardDialog::refreshStages);
Expand Down
3 changes: 3 additions & 0 deletions lib/usd/ui/editForward/editForwardDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <maya/MMessage.h>
#include <ufe/observer.h>

#include <QtCore/QSize>
#include <QtWidgets/QDialog>

#include <memory>
Expand All @@ -46,6 +47,8 @@ class EditForwardDialog
void handleSelectionChanged();
void setActiveStage(PXR_NS::UsdStageRefPtr const& stage);

QSize sizeHint() const override;

private:
void refreshStages();

Expand Down
47 changes: 30 additions & 17 deletions lib/usd/ui/layerEditor/layerEditorWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ QLayout* LayerEditorWidget::setupLayout_toolbar()
_buttons._toggleEFButton = new QPushButton();
_buttons._toggleEFButton->setFlat(true);
_buttons._toggleEFButton->setFixedSize(buttonSize, buttonSize);
_buttons._toggleEFButton->setToolTip(
StringResources::getAsQString(StringResources::kToggleEditForwarding));
// Tooltip reflects the current edit forwarding state; set by updateButtons().
_buttons._toggleEFButton->setObjectName("LayerEditorToggleEFButton");
toolbar->addWidget(_buttons._toggleEFButton, 0, buttonAlignment);
connect(
Expand Down Expand Up @@ -524,9 +523,13 @@ void LayerEditorWidget::updateButtons()
_updateButtonsOnIdle = false;

#ifdef WANT_ADSK_USD_EDIT_FORWARD_BUILD
// Update the EF toolbar button icon to reflect the current edit forwarding active state.
// Update the EF toolbar button icon and tooltip to reflect the current edit forwarding
// active state.
if (_buttons._toggleEFButton) {
const bool efActive = _sessionState.isEditForwardMode();
_buttons._toggleEFButton->setToolTip(StringResources::getAsQString(
efActive ? StringResources::kEditForwardingTooltipEnabled
: StringResources::kEditForwardingTooltipDisabled));
const auto baseName = efActive ? ":/UsdLayerEditor/ef_on" : ":/UsdLayerEditor/ef_default";
_buttons._toggleEFButton->setStyleSheet(
QString("QPushButton { padding: %1px; background-image: url(%2); "
Expand Down Expand Up @@ -733,22 +736,32 @@ void LayerEditorWidget::onSplitterMoved(int pos, int index)
void LayerEditorWidget::openEditForwardDialog()
{
auto* ss = &_sessionState;
if (_editForwardDialog) {
if (!_editForwardDialog) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes here are also bascially the same as what was done in AR 3aa943c

_editForwardDialog = new UsdEditForwardConfig::EditForwardDialog(
StringResources::getAsQString(StringResources::kConfigureEditForwardingTitle),
MQtUtil::mainWindow());
// While the layer editor is open, follow its current stage.
QObject::connect(ss, &SessionState::currentStageChangedSignal, this, [this, ss]() {
if (_editForwardDialog) {
_editForwardDialog->setActiveStage(ss->stage());
}
});
}

// If the dialog was previously minimized, restore it before showing.
if (_editForwardDialog->isMinimized()) {
_editForwardDialog->setWindowState(
(_editForwardDialog->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
}

// Only show() a dialog that is actually hidden. Showing a saveWindowPref
// window re-applies its stored position, which would move an already-open
// dialog away from where the user last dragged it.
if (!_editForwardDialog->isVisible()) {
_editForwardDialog->show();
_editForwardDialog->raise();
_editForwardDialog->activateWindow();
return;
}
_editForwardDialog = new UsdEditForwardConfig::EditForwardDialog(
StringResources::getAsQString(StringResources::kConfigureEditForwardingTitle),
MQtUtil::mainWindow());
// While the layer editor is open, follow its current stage.
QObject::connect(ss, &SessionState::currentStageChangedSignal, this, [this, ss]() {
if (_editForwardDialog) {
_editForwardDialog->setActiveStage(ss->stage());
}
});
_editForwardDialog->show();
_editForwardDialog->raise();
_editForwardDialog->activateWindow();
}

#endif // WANT_ADSK_USD_EDIT_FORWARD_BUILD
Expand Down
15 changes: 12 additions & 3 deletions lib/usd/ui/layerEditor/stringResources.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,19 @@ const auto kAutoHideSessionLayer { create("kAutoHideSessionLayer", "Auto
const auto kDisplayLayerContents { create("kDisplayLayerContents", "Display Layer Content") };
const auto kDisplayLayerContentsEmpty { create("kDisplayLayerContentsEmpty", "Select a single layer to display the contents.\n\nLarge layers may take longer to load.") };
#ifdef WANT_ADSK_USD_EDIT_FORWARD_BUILD
const auto kToggleEditForwarding { create("kToggleEditForwarding", "Toggle Edit Forwarding") };
const auto kEditForwardingTooltipEnabled { create("kEditForwardingTooltipEnabled",
"Edit Forwarding (enabled)\n"
"When enabled, forwards scene edits to layers by rule. Unmatched edits go to the current target layer.\n"
"When disabled, all edits go to the current target layer.\n\n"
"Click to open configuration.") };
const auto kEditForwardingTooltipDisabled { create("kEditForwardingTooltipDisabled",
"Edit Forwarding (disabled)\n"
"When enabled, forwards scene edits to layers by rule. Unmatched edits go to the current target layer.\n"
"When disabled, all edits go to the current target layer.\n\n"
"Click to open configuration.") };
const auto kEchoEditForwarding { create("kEchoEditForwarding", "Echo Edit Forwarding in Script Editor") };
const auto kConfigureEditForwarding { create("kConfigureEditForwarding", "Configure Edit Forwarding...") };
const auto kConfigureEditForwardingTitle { create("kConfigureEditForwardingTitle", "Configure Edit Forwarding") };
const auto kConfigureEditForwarding { create("kConfigureEditForwarding", "Edit Forwarding Configuration") };
const auto kConfigureEditForwardingTitle { create("kConfigureEditForwardingTitle", "USD Edit Forwarding Configuration") };
#endif
const auto kDisplayLayerExpandAllValues { create("kDisplayLayerExpandAllValues", "Expand All Values") };
const auto kDisplayLayerExpandAllValuesTooltip { create("kDisplayLayerExpandAllValuesTooltip",
Expand Down
Loading