From 7819e7b6b6c7aac9401c474f3f81f5ba918602cf Mon Sep 17 00:00:00 2001
From: Murray Stevenson <50844517+murraystevenson@users.noreply.github.com>
Date: Mon, 10 Jul 2023 11:29:36 -0700
Subject: [PATCH] fixup! HierarchyView : Add `F` shortcut to frame last
selected path
---
Changes.md | 2 +-
python/GafferSceneUI/HierarchyView.py | 15 +++++----------
2 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/Changes.md b/Changes.md
index 032685e977a..8264f462330 100644
--- a/Changes.md
+++ b/Changes.md
@@ -52,7 +52,7 @@ Improvements
- Added red wireframe colour to the bounding box of locations excluded from the Visible Set.
- HierarchyView :
- Added support for inclusion and exclusion of leaf level locations to the Visible Set.
- - Added F shortcut to expand the ancestors of all selected paths and frame the last path selected.
+ - Added F shortcut to expand ancestors and frame selected paths.
Fixes
-----
diff --git a/python/GafferSceneUI/HierarchyView.py b/python/GafferSceneUI/HierarchyView.py
index c60cb1b08da..fdaeb5a2b91 100644
--- a/python/GafferSceneUI/HierarchyView.py
+++ b/python/GafferSceneUI/HierarchyView.py
@@ -196,7 +196,7 @@ def __keyPressSignal( self, widget, event ) :
return True
elif event.key == "F" :
- self.__frameLastSelectedPath()
+ self.__frameSelectedPaths()
return True
return False
@@ -230,17 +230,12 @@ def __copySelectedPaths( self, *unused ) :
data = IECore.StringVectorData( selection.paths() )
self.__plug.ancestor( Gaffer.ApplicationRoot ).setClipboardContents( data )
- def __frameLastSelectedPath( self ) :
+ def __frameSelectedPaths( self ) :
selection = self.__pathListing.getSelection()
- if selection.isEmpty() :
- return
-
- self.__pathListing.expandAncestorsOfSelection()
-
- lastSelectedPath = ContextAlgo.getLastSelectedPath( self.getContext() )
- if selection.match( lastSelectedPath ) & IECore.PathMatcher.Result.ExactMatch :
- self.__pathListing.scrollToFirst( IECore.PathMatcher( [ lastSelectedPath ] ) )
+ if not selection.isEmpty() :
+ self.__pathListing.expandToSelection()
+ self.__pathListing.scrollToFirst( selection )
@GafferUI.LazyMethod( deferUntilPlaybackStops = True )
def __transferExpansionFromContext( self ) :