Skip to content

Commit

Permalink
Merge branch '1.3_maintenance'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhaddon committed Feb 29, 2024
2 parents e759040 + a980bfe commit 5623819
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ Build
1.3.x.x (relative to 1.3.12.0)
=======

Improvements
------------

- Viewer : Added <kbd>Ctrl</kbd>+<kbd>PgUp</kbd> shortcut for displaying the RGBA image layer (or the first available layer if RGBA doesn't exist).

1.3.12.0 (relative to 1.3.11.0)
========
Expand Down
1 change: 1 addition & 0 deletions doc/source/Interface/ControlsAndShortcuts/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ Isolate alpha channel | {kbd}`A`
View luminance of RGB | {kbd}`L`
Previous layer | {kbd}`PgUp`
Next layer | {kbd}`PgDn`
First layer (RGBA) | {kbd}`Ctrl` + {kbd}`PgUp`
Previous view | {kbd}`[`
Next view | {kbd}`]`
Center image at 1:1 scale | {kbd}`Home`
Expand Down
17 changes: 16 additions & 1 deletion python/GafferImageUI/ImageViewUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,12 +910,27 @@ def _menuDefinition( self ) :
}
)

firstValue = next( iter( self._rgbaChannels().values() ), None )
result.append(
"/First",
{
"command" : functools.partial( Gaffer.WeakMethod( self.__setValue ), value = firstValue ),
"shortCut" : "Ctrl+PgUp",
"active" : firstValue is not None and firstValue != currentValue,
}
)

return result

def __keyPress( self, gadget, event ) :

if event.key in ( "PageUp", "PageDown" ) :
value = self.__incrementedValue( -1 if event.key == "PageUp" else 1 )
if event.key == "PageDown" :
value = self.__incrementedValue( 1 )
elif event.modifiers == event.Modifiers.Control :
value = next( iter( self._rgbaChannels().values() ), None )
else :
value = self.__incrementedValue( -1 )
if value is not None :
self.__setValue( value )
return True
Expand Down

0 comments on commit 5623819

Please sign in to comment.