Skip to content

Commit

Permalink
Merge pull request #6235 from murraystevenson/inspectorColumnEditEnabled
Browse files Browse the repository at this point in the history
InspectorColumn : Add Ctrl+Enter shortcut to popup an edit pre-enabled
  • Loading branch information
johnhaddon authored Jan 28, 2025
2 parents df6a6c4 + b2dccd7 commit a91cf53
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Improvements
------------

- AttributeEditor : Added "Select Affected Objects" menu item to the "Linked Lights" and Arnold "Shadow Group" columns.
- AttributeEditor, LightEditor, RenderPassEditor : Added <kbd>Ctrl</kbd> + <kbd>Enter</kbd> shortcut to edit the selected cells, enabling the edit if necessary.
- ScriptNode : Added support for serialising metadata registered on a ScriptNode.

Fixes
Expand Down
16 changes: 12 additions & 4 deletions python/GafferSceneUI/_InspectorColumn.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __toggleBoolean( pathListing, inspectors, inspections ) :

return True

def __editSelectedCells( pathListing, quickBoolean = True ) :
def __editSelectedCells( pathListing, quickBoolean = True, ensureEnabled = False ) :

global __inspectorColumnPopup

Expand Down Expand Up @@ -145,6 +145,13 @@ def __editSelectedCells( pathListing, quickBoolean = True ) :
if not quickBoolean or not __toggleBoolean( pathListing, inspectors, inspections ) :
edits = [ i.acquireEdit() for i in inspections ]
warnings = "\n".join( [ i.editWarning() for i in inspections if i.editWarning() != "" ] )

if ensureEnabled :
with Gaffer.UndoScope( pathListing.ancestor( GafferUI.Editor ).scriptNode() ) :
for edit in edits :
if isinstance( edit, ( Gaffer.NameValuePlug, Gaffer.OptionalValuePlug, Gaffer.TweakPlug ) ) :
edit["enabled"].setValue( True )

# The plugs are either not boolean, boolean with mixed values,
# or attributes that don't exist and are not boolean. Show the popup.
__inspectorColumnPopup = GafferUI.PlugPopup( edits, warning = warnings )
Expand Down Expand Up @@ -433,10 +440,11 @@ def __keyPress( column, pathListing, event ) :
if not __validateSelection( pathListing ) :
return

if event.key in ( "Return", "Enter" ) and event.modifiers in ( event.Modifiers.None_, event.modifiers.Control ):
__editSelectedCells( pathListing, ensureEnabled = event.modifiers == event.modifiers.Control )
return True

if event.modifiers == event.Modifiers.None_ :
if event.key in ( "Return", "Enter" ) :
__editSelectedCells( pathListing )
return True

if event.key == "D" :
inspections, nonEditableReason, _ = __toggleableInspections( pathListing )
Expand Down

0 comments on commit a91cf53

Please sign in to comment.