From 163165a9bad28622b2760935f62ae9f97bf36034 Mon Sep 17 00:00:00 2001 From: Pierre Baillargeon Date: Wed, 11 Dec 2024 11:32:13 -0500 Subject: [PATCH] EMSUSD_1917 lock layer shoudl preserve the selection No longer change the selection in the lock layer command. --- lib/mayaUsd/commands/layerEditorCommand.cpp | 33 --------------------- 1 file changed, 33 deletions(-) diff --git a/lib/mayaUsd/commands/layerEditorCommand.cpp b/lib/mayaUsd/commands/layerEditorCommand.cpp index a30fbfd687..27e63a67de 100644 --- a/lib/mayaUsd/commands/layerEditorCommand.cpp +++ b/lib/mayaUsd/commands/layerEditorCommand.cpp @@ -825,8 +825,6 @@ class LockLayer : public BaseCmd if (!stage) return false; - saveSelection(); - std::set layersToUpdate; if (_includeSublayers) { // If _includeSublayers is True, we attempt to refresh the system lock status of all @@ -896,7 +894,6 @@ class LockLayer : public BaseCmd _proxyShapePath, _layers[layerIndex], _previousStates[layerIndex], true); } } - restoreSelection(); if (_updateEditTarget) { updateEditTarget(stage); @@ -919,36 +916,6 @@ class LockLayer : public BaseCmd return stage; } - void saveSelection() - { - // Make a copy of the global selection, to restore it on unlock. - auto globalSn = Ufe::GlobalSelection::get(); - _savedSn.replaceWith(*globalSn); - // Filter the global selection, removing items below our proxy shape. - // We know the path to the proxy shape has a single segment. Not - // using Ufe::PathString::path() for UFE v1 compatibility, which - // unfortunately reveals leading "world" path component implementation - // detail. - Ufe::Path path( - Ufe::PathSegment("world" + _proxyShapePath, MayaUsd::ufe::getMayaRunTimeId(), '|')); - globalSn->replaceWith(UsdUfe::removeDescendants(_savedSn, path)); - } - - void restoreSelection() - { - // Restore the saved selection to the global selection. If a saved - // selection item started with the proxy shape path, re-create it. - // We know the path to the proxy shape has a single segment. Not - // using Ufe::PathString::path() for UFE v1 compatibility, which - // unfortunately reveals leading "world" path component implementation - // detail. - Ufe::Path path( - Ufe::PathSegment("world" + _proxyShapePath, MayaUsd::ufe::getMayaRunTimeId(), '|')); - auto globalSn = Ufe::GlobalSelection::get(); - globalSn->replaceWith(UsdUfe::recreateDescendants(_savedSn, path)); - } - - Ufe::Selection _savedSn; std::vector _previousStates; SdfLayerHandleVector _layers; };