diff --git a/Changes.md b/Changes.md index 1d7f6cf9099..7a501ac5d6f 100644 --- a/Changes.md +++ b/Changes.md @@ -19,6 +19,7 @@ Improvements - Improved layout of Box node plug creator visibility toggles. - ArnoldShader : Moved the `toon` shader's `*_tonemap_hue_saturation` parameters to appropriate sections in the UI. - File Browser : The "Type" column can now be sorted. This sorts directories separately from files, which are sorted by their extension. +- NumericWidget : Added the ability to use the mouse wheel to adjust values in the same manner as Up and Down (#6009). Fixes ----- diff --git a/python/GafferUI/NumericWidget.py b/python/GafferUI/NumericWidget.py index 2ed1f2811f9..67b8c61f029 100644 --- a/python/GafferUI/NumericWidget.py +++ b/python/GafferUI/NumericWidget.py @@ -60,6 +60,7 @@ def __init__( self, value, **kw ) : self.__dragStart = None self.keyPressSignal().connect( Gaffer.WeakMethod( self.__keyPress ), scoped = False ) + self.wheelSignal().connect( Gaffer.WeakMethod( self.__wheel ), scoped = False ) self.buttonPressSignal().connect( Gaffer.WeakMethod( self.__buttonPress ), scoped = False ) self.dragBeginSignal().connect( Gaffer.WeakMethod( self.__dragBegin ), scoped = False ) self.dragEnterSignal().connect( Gaffer.WeakMethod( self.__dragEnter ), scoped = False ) @@ -141,6 +142,19 @@ def __keyPress( self, widget, event ) : return False + def __wheel( self, widget, event ) : + + assert( widget is self ) + + if not self.getEditable() : + return False + + scaleFactor = 15.0 + + self.__incrementIndex( self.getCursorPosition(), event.wheelRotation / scaleFactor ) + + return True + def __incrementIndex( self, index, increment ) : text = self.getText()