Skip to content

Commit

Permalink
fixup! ColorChooser : Static colors on color field
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl committed Nov 1, 2024
1 parent fcbb9c3 commit a5f7301
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions python/GafferUI/ColorChooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def _displayTransformChanged( self ) :

class _ColorField( GafferUI.Widget ) :

def __init__( self, color = imath.Color3f( 1.0 ), staticComponent = "v", dynamicColors = False, **kw ) :
def __init__( self, color = imath.Color3f( 1.0 ), staticComponent = "v", dynamicBackground = False, **kw ) :

GafferUI.Widget.__init__( self, QtWidgets.QWidget(), **kw )

Expand All @@ -263,7 +263,7 @@ def __init__( self, color = imath.Color3f( 1.0 ), staticComponent = "v", dynamic
self.__colorFieldToDraw = None
self.setColor( color, staticComponent )

self.setDynamicColors( dynamicColors )
self.setDynamicBackground( dynamicBackground )

# Sets the color and the static component. `color` is in
# RGB space for RGB static components, HSV space for
Expand All @@ -277,15 +277,15 @@ def getColor( self ) :

return self.__color, self.__staticComponent

def setDynamicColors( self, dynamic ) :
def setDynamicBackground( self, dynamicBackground ) :

self.__dynamicColors = dynamic
self.__dynamicBackground = dynamicBackground
self.__colorFieldToDraw = None
self._qtWidget().update()

def getDynamicColors( self ) :
def getDynamicBackground( self ) :

return self.__dynamicColors
return self.__dynamicBackground

## A signal emitted whenever a value has been changed. Slots should
# have the signature slot( _ColorField, GafferUI.Slider.ValueChangedReason )
Expand Down Expand Up @@ -316,8 +316,8 @@ def __setColorInternal( self, color, staticComponent, reason ) :
zIndex = self.__zIndex()
if (
staticComponent != self.__staticComponent or
( self.__dynamicColors and color[zIndex] != self.__color[zIndex] ) or
( not self.__dynamicColors and staticComponent == "h" )
( self.__dynamicBackground and color[zIndex] != self.__color[zIndex] ) or
( not self.__dynamicBackground and staticComponent == "h" )
) :
self.__colorFieldToDraw = None

Expand Down Expand Up @@ -478,7 +478,7 @@ def __drawBackground( self, painter ) :
zIndex = self.__zIndex()

c = imath.Color3f()
if self.__dynamicColors or self.__staticComponent == "h" :
if self.__dynamicBackground or self.__staticComponent == "h" :
c[zIndex] = self.__color[zIndex]
elif self.__staticComponent in "rgbtm" :
c[zIndex] = 0.0
Expand Down Expand Up @@ -979,7 +979,7 @@ def setDynamicSliderBackgrounds( self, dynamic ) :

for component, slider in self.__sliders.items() :
slider.setDynamicBackground( dynamic )
self.__colorField.setDynamicColors( dynamic )
self.__colorField.setDynamicBackground( dynamic )

self.__dynamicSliderBackgroundsChangedSignal( self )

Expand Down

0 comments on commit a5f7301

Please sign in to comment.