diff --git a/lib/usd/ui/layerEditor/layerTreeItem.cpp b/lib/usd/ui/layerEditor/layerTreeItem.cpp index a6039e22d6..67464f0cc6 100644 --- a/lib/usd/ui/layerEditor/layerTreeItem.cpp +++ b/lib/usd/ui/layerEditor/layerTreeItem.cpp @@ -267,13 +267,21 @@ bool LayerTreeItem::isIncoming() const { return _isIncomingLayer; } bool LayerTreeItem::needsSaving() const { - if (_layer) { - if (!isSessionLayer() && !isReadOnly() - && (_isSharedStage || parentLayerItem() != nullptr)) { - return isDirty() || isAnonymous(); - } - } - return false; + // If for any reason we don't hold a layer, then we cannot save it. + if (!_layer) + return false; + + // Session layers are managed by Maya, not the Layer Editor, + // so their dirty state does not count. + if (isSessionLayer()) + return false; + + // The stage is not shared, layers are assumed to be managed + // somewhere else and do not get saved here. + if (!_isSharedStage) + return false; + + return isDirty() || isAnonymous(); } // delegate Action API for command buttons diff --git a/lib/usd/ui/layerEditor/layerTreeView.cpp b/lib/usd/ui/layerEditor/layerTreeView.cpp index 41855b8c74..561fe4ff37 100644 --- a/lib/usd/ui/layerEditor/layerTreeView.cpp +++ b/lib/usd/ui/layerEditor/layerTreeView.cpp @@ -130,7 +130,7 @@ void LayerTreeView::onItemDoubleClicked(const QModelIndex& index) { if (index.isValid()) { auto layerTreeItem = layerItemFromIndex(index); - if (layerTreeItem->isAnonymous()) { + if (layerTreeItem->needsSaving()) { layerTreeItem->saveEdits(); } }