From 4c75beeca2d712409130a4cd2665250478267041 Mon Sep 17 00:00:00 2001 From: Julien Frantz Date: Tue, 3 Dec 2024 19:02:17 +0100 Subject: [PATCH] LayerManager: Prevent unintended overwriting of unmodified USD layers. --- lib/mayaUsd/nodes/layerManager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/mayaUsd/nodes/layerManager.cpp b/lib/mayaUsd/nodes/layerManager.cpp index 35d418bc9..16964c4bd 100644 --- a/lib/mayaUsd/nodes/layerManager.cpp +++ b/lib/mayaUsd/nodes/layerManager.cpp @@ -1022,7 +1022,8 @@ BatchSaveResult LayerDatabase::saveUsdToUsdFiles() const auto& allLayers = info.stage->GetUsedLayers(true); for (auto layer : allLayers) { if (TF_VERIFY(layer)) { - if (layer != sessionLayer && layer->PermissionToSave()) { + if (layer != sessionLayer && layer->PermissionToSave() + && layer->IsDirty()) { if (!MayaUsd::utils::saveLayerWithFormat(layer)) { MString errMsg; MString layerName(layer->GetDisplayName().c_str());