Skip to content

Commit

Permalink
PathListingWidget : Avoid blocking UI in setPath( rootPath )
Browse files Browse the repository at this point in the history
The root path is the only path that we ever display in fundamental UIs like the HierarchyView and RenderPassEditor. In this case we were needlessly invoking `Path.isLeaf()` and `Path.isValid()` on the UI thread, causing ScenePath and RenderPassPath to trigger arbitrary computation that could block the UI until complete. By taking an early-out for the root path can completely avoid that, with all the remaining work all happening in a BackgroundTask.
  • Loading branch information
johnhaddon committed Jul 9, 2024
1 parent bd88e03 commit 6207f97
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Improvements
- The `data_seed`, `proc_seed`, `obj_seed`, and `face_seed` parameters of the `color_jitter` shader.
- EditScope : Added summaries of set membership edits in the NodeEditor.
- LightEditor : Mute and solo columns now accurately reflect the presence of the `light:mute` attribute (for the Mute column) and membership in the `soloLights` set (for the Solo column) for all scene locations, not just for lights.
- HierarchyView, LightEditor, RenderPassEditor, SetEditor : Reduced potential UI stalls when first showing a scene.

Fixes
-----
Expand Down
12 changes: 7 additions & 5 deletions python/GafferUI/PathListingWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,9 @@ def __update( self ) :
def __dirPath( self ) :

p = self.__path.copy()
if not len( p ) :
return p

if p.isLeaf() :
# if it's a leaf then take the parent
del p[-1]
Expand All @@ -486,11 +489,10 @@ def __dirPath( self ) :
# it's not valid. if we can make it
# valid by trimming the last element
# then do that
if len( p ) :
pp = p.copy()
del pp[-1]
if pp.isValid() :
p = pp
pp = p.copy()
del pp[-1]
if pp.isValid() :
p = pp
else :
# it's valid and not a leaf, and
# that's what we want.
Expand Down

0 comments on commit 6207f97

Please sign in to comment.