Skip to content

Commit

Permalink
Merge pull request #3504 from Autodesk/bailp/EMSUSD-852/save-locked-l…
Browse files Browse the repository at this point in the history
…ayer

EMSUSD-852 allow saving locked layers
  • Loading branch information
seando-adsk authored Dec 11, 2023
2 parents d29fe30 + 9424e1e commit d01378b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 15 additions & 7 deletions lib/usd/ui/layerEditor/layerTreeItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/usd/ui/layerEditor/layerTreeView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down

0 comments on commit d01378b

Please sign in to comment.