diff --git a/Changes.md b/Changes.md index d9bd6aae3b..032687e724 100644 --- a/Changes.md +++ b/Changes.md @@ -18,6 +18,7 @@ Fixes - Cycles : Fixed rendering to the Catalogue using the batch Render node (#5905). Note that rendering a mixture of Catalogue and file outputs is still not supported, and in this case any file outputs will be ignored. - CodeWidget : Fixed bug that could prevent changes from being committed while the completion menu was visible. - Loop : Fixed handling of empty `indexVariable`. This now disables the Loop instead of creating an unnamed context variable. +- ColorChooser : Fixed emission of `colorChangedSignal()` while the widget was in an inconsistent internal state. API --- diff --git a/python/GafferUI/ColorChooser.py b/python/GafferUI/ColorChooser.py index 0d641cbc82..18ed5cfaae 100644 --- a/python/GafferUI/ColorChooser.py +++ b/python/GafferUI/ColorChooser.py @@ -257,15 +257,12 @@ def __setColorInternal( self, color, reason, hsv = False ) : GafferUI.NumericWidget.ValueChangedReason.DragEnd, ) - previousColor = self.__colorHSV if hsv else self.__color + colorChanged = color != ( self.__colorHSV if hsv else self.__color ) - if color != previousColor or dragBeginOrEnd : - # we never optimise away drag begin or end, because it's important - # that they emit in pairs. + if colorChanged : colorRGB = color.hsv2rgb() if hsv else color self.__color = colorRGB self.__colorSwatch.setColor( colorRGB ) - self.__colorChangedSignal( self, reason ) hsv = color if hsv else color.rgb2hsv() @@ -281,6 +278,11 @@ def __setColorInternal( self, color, reason, hsv = False ) : # in NumericWidget. self.__updateUIFromColor() + if colorChanged or dragBeginOrEnd : + # We never optimise away drag begin or end, because it's important + # that they emit in pairs. + self.__colorChangedSignal( self, reason ) + def __updateUIFromColor( self ) : with Gaffer.Signals.BlockedConnection( self.__componentValueChangedConnections ) :