From 88eea089bf667d9af9a09753787108261ea82390 Mon Sep 17 00:00:00 2001 From: John Haddon Date: Mon, 5 Aug 2024 16:31:11 +0100 Subject: [PATCH] CatalogueUI : Fix update when first image added and last image removed In this case, the `index` plug doesn't change value, but whether or not it maps to an actual image does change. And we use that mapping in `_updateFromValues()`, so the first image added wasn't connected to the `__descriptionWidget` and `__nameWidget`, and the last image removed wasn't disconnected. --- Changes.md | 4 +++- python/GafferImageUI/CatalogueUI.py | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Changes.md b/Changes.md index dea2108aa8..18735152fc 100644 --- a/Changes.md +++ b/Changes.md @@ -16,7 +16,9 @@ Fixes - Arnold : Fixed bug preventing UI metadata for Imagers from being loaded for Arnold 7.3. - WidgetAlgo : Fixed issue preventing `grab()` from capturing popup menus on Windows. - ShowURL : Fixed opening of "file://" URLs on Windows (#5861). -- Catalogue : Fixed bug which allowed locked Catalogues to be edited. +- Catalogue : + - Fixed bug which allowed locked Catalogues to be edited. + - Fixed NodeEditor update when the first image is added or the last image is removed. - NameWidget : Fixed bug which allowed plugs on locked nodes to be renamed. API diff --git a/python/GafferImageUI/CatalogueUI.py b/python/GafferImageUI/CatalogueUI.py index 7f31307dec..1c0945ecd9 100644 --- a/python/GafferImageUI/CatalogueUI.py +++ b/python/GafferImageUI/CatalogueUI.py @@ -753,6 +753,9 @@ def __init__( self, plug, **kw ) : self.__pathListing.dropSignal().connect( Gaffer.WeakMethod( self.__pathListingDrop ), scoped = False ) + self.__pathListing.getPath().pathChangedSignal().connect( + Gaffer.WeakMethod( self.__pathChanged ), scoped = False + ) self.keyPressSignal().connect( Gaffer.WeakMethod( self.__keyPress ), scoped = False ) with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing = 4 ) as self.__buttonRow : @@ -838,6 +841,12 @@ def _updateFromEditable( self ) : # `self.__descriptionWidget` because they deal with that # internally. + def __pathChanged( self, path ) : + + # `_updateFromValues()` is sensitive to the contents of the image path so + # we need to do an update when it changes. + self._requestUpdateFromValues() + def __plugMetadataValueChanged( self, plug, key, reason ) : if key == _columnsMetadataKey and plug == self.getPlug() :