From 50b5b856ed1c871db8321e40fcd42e4eabff2ac9 Mon Sep 17 00:00:00 2001 From: Pierre Baillargeon Date: Fri, 13 Sep 2024 10:44:43 -0400 Subject: [PATCH] EMSUSD-1619 fix removal on multiple layers When removing multiple layers the removal must not be delayed. This is due to the low-level implementation of layer removal: it uses the parent layer and the index of the sub-layer to be removed instead of its name. Wehn commands are delayed, the index would become incorrect. By not delaying command, the index is properly calculated. --- lib/usd/ui/layerEditor/layerTreeView.cpp | 5 +++++ lib/usd/ui/layerEditor/layerTreeView.h | 1 + lib/usd/ui/layerEditor/mayaLayerEditorWindow.cpp | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/usd/ui/layerEditor/layerTreeView.cpp b/lib/usd/ui/layerEditor/layerTreeView.cpp index 8763659891..927c5228f9 100644 --- a/lib/usd/ui/layerEditor/layerTreeView.cpp +++ b/lib/usd/ui/layerEditor/layerTreeView.cpp @@ -420,6 +420,11 @@ void LayerTreeView::callMethodOnSelection(const QString& undoName, simpleLayerMe { DelayAbstractCommandHook delayed(*_model->sessionState()->commandHook()); + callMethodOnSelectionNoDelay(undoName, method); +} + +void LayerTreeView::callMethodOnSelectionNoDelay(const QString& undoName, simpleLayerMethod method) +{ CallMethodParams params; auto selection = getSelectedLayerItems(); params.selection = &selection; diff --git a/lib/usd/ui/layerEditor/layerTreeView.h b/lib/usd/ui/layerEditor/layerTreeView.h index b364fe0ddd..ebbd7a352b 100644 --- a/lib/usd/ui/layerEditor/layerTreeView.h +++ b/lib/usd/ui/layerEditor/layerTreeView.h @@ -100,6 +100,7 @@ class LayerTreeView // calls a given method on all items in the selection, with the given string as the undo chunk // name void callMethodOnSelection(const QString& undoName, simpleLayerMethod method); + void callMethodOnSelectionNoDelay(const QString& undoName, simpleLayerMethod method); // menu callbacks void onAddParentLayer(const QString& undoName) const; diff --git a/lib/usd/ui/layerEditor/mayaLayerEditorWindow.cpp b/lib/usd/ui/layerEditor/mayaLayerEditorWindow.cpp index c7ba90af1b..142814dd77 100644 --- a/lib/usd/ui/layerEditor/mayaLayerEditorWindow.cpp +++ b/lib/usd/ui/layerEditor/mayaLayerEditorWindow.cpp @@ -173,7 +173,7 @@ std::string MayaLayerEditorWindow::proxyShapeName() const void MayaLayerEditorWindow::removeSubLayer() { QString name = "Remove"; - treeView()->callMethodOnSelection(name, &LayerTreeItem::removeSubLayer); + treeView()->callMethodOnSelectionNoDelay(name, &LayerTreeItem::removeSubLayer); } void MayaLayerEditorWindow::saveEdits()