Skip to content

Commit

Permalink
VisualiserToolUI : Untransformed vector color
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl committed Feb 26, 2025
1 parent dd7f913 commit 03df46b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Improvements
- The `vectorScale` plug can be used to scale the vector line. The <kbd>Shift</kbd> + <kbd>+</kbd> and <kbd>Shift</kbd> + <kbd>-</kbd> keyboard shortcuts can also be used to change the scale.
- The `vectorColor` plug can be used to change the color of the vector line.
- The vector value being visualised for the vertex nearest the cursor is shown next to the vertex.
- ColorSwatchPlugValueWidget : Changed the display transform of the color chooser dialogue to match that of the `ColorSwatchPlugValueWidget` creating it instead of the script window.

Fixes
-----
Expand Down
10 changes: 10 additions & 0 deletions python/GafferSceneUI/VisualiserToolUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,21 @@
"toolbarLayout:visibilityActivator", "modeIsAuto",
"colorPlugValueWidget:colorChooserButtonVisible", False,

"plugValueWidget:type", "GafferSceneUI.VisualiserToolUI._UntransformedColorWidget",

],

},
)

class _UntransformedColorWidget( GafferUI.ColorPlugValueWidget ) :

def __init__( self, plugs, **kw ) :

GafferUI.ColorPlugValueWidget.__init__( self, plugs, **kw )

self.setDisplayTransform( GafferUI.Widget.identityDisplayTransform )

class _DataNameChooser( GafferUI.PlugValueWidget ) :

__primitiveVariablePrefix = "primitiveVariable:"
Expand Down
11 changes: 6 additions & 5 deletions python/GafferUI/ColorSwatchPlugValueWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def __buttonRelease( self, widget, event ) :
if not self._editable() :
return False

_ColorPlugValueDialogue.acquire( self.getPlugs() )
_ColorPlugValueDialogue.acquire( self.getPlugs(), self.displayTransform() )

return True

Expand All @@ -125,11 +125,12 @@ def _colorFromPlugs( plugs ) :
# actually be functionality of CompoundEditor?
class _ColorPlugValueDialogue( GafferUI.ColorChooserDialogue ) :

def __init__( self, plugs, parentWindow ) :
def __init__( self, plugs, parentWindow, displayTransform ) :

GafferUI.ColorChooserDialogue.__init__(
self,
color = _colorFromPlugs( plugs )
color = _colorFromPlugs( plugs ),
displayTransform = displayTransform
)

# we use these to decide which actions to merge into a single undo
Expand Down Expand Up @@ -192,7 +193,7 @@ def __init__( self, plugs, parentWindow ) :
parentWindow.addChildWindow( self, removeOnClose = True )

@classmethod
def acquire( cls, plugs ) :
def acquire( cls, plugs, displayTransform ) :

plug = next( iter( plugs ) )

Expand All @@ -212,7 +213,7 @@ def acquire( cls, plugs ) :
window.setVisible( True )
return window

window = _ColorPlugValueDialogue( plugs, scriptWindow )
window = _ColorPlugValueDialogue( plugs, scriptWindow, displayTransform )
window.setVisible( True )
return False

Expand Down

0 comments on commit 03df46b

Please sign in to comment.