Skip to content

Commit

Permalink
EditScopeUI : Fix bug handling read-only ScriptNodes
Browse files Browse the repository at this point in the history
In this case `relativeName()` was throwing due to the ScriptNode not being a child of itself. I wasn't really sure what name to use here - the node name itself isn't really meaningful, and `ScriptNode` might not mean much to a user. In practice ScriptNodes are only read-only when the file on the filesystem is read-only, so I went with "File" as hopefully being the most self-explanatory.
  • Loading branch information
johnhaddon committed Dec 12, 2024
1 parent 4558478 commit e839409
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Fixes
- Widget : Fixed `event.sourceWidget` for DragDropEvents generated from a Qt native drag within the same Gaffer process. This will now reference the `GafferUI.Widget` that the Qt source widget belongs to, if any.
- Catalogue : Fixed bug which "stole" drags that crossed the image listing but which were destined elsewhere, for instance a drag from the HierarchyView to a PathFilter in the GraphEditor.
- GadgetWidget : Fixed signal handling bug in `setViewportGadget()`. This could cause the widget to attempt to redraw unnecessarily when the _old_ viewport requested a redraw.
- EditScope : Fixed error updating the Global Edit Target in read-only files.

API
---
Expand Down
6 changes: 4 additions & 2 deletions python/GafferUI/EditScopeUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,9 +600,11 @@ def __unusableReason( self, editScope ) :

def __readOnlyReason( self, editScope ) :

if Gaffer.MetadataAlgo.readOnly( editScope ) :
readOnlyReason = Gaffer.MetadataAlgo.readOnlyReason( editScope )
if readOnlyReason is not None :
return "{} is locked.".format(
Gaffer.MetadataAlgo.readOnlyReason( editScope ).relativeName( editScope.scriptNode() )
"File" if isinstance( readOnlyReason, Gaffer.ScriptNode )
else readOnlyReason.relativeName( readOnlyReason.scriptNode() )
)

return None
Expand Down

0 comments on commit e839409

Please sign in to comment.