Skip to content

Commit

Permalink
fixup! HierarchyView : Add F shortcut to frame last selected path
Browse files Browse the repository at this point in the history
  • Loading branch information
murraystevenson committed Jul 10, 2023
1 parent 091035c commit 7819e7b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <kbd>F</kbd> shortcut to expand the ancestors of all selected paths and frame the last path selected.
- Added <kbd>F</kbd> shortcut to expand ancestors and frame selected paths.

Fixes
-----
Expand Down
15 changes: 5 additions & 10 deletions python/GafferSceneUI/HierarchyView.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def __keyPressSignal( self, widget, event ) :
return True

elif event.key == "F" :
self.__frameLastSelectedPath()
self.__frameSelectedPaths()
return True

return False
Expand Down Expand Up @@ -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 ) :
Expand Down

0 comments on commit 7819e7b

Please sign in to comment.