Skip to content

Commit

Permalink
Merge pull request #5892 from murraystevenson/sceneInspectorDrag
Browse files Browse the repository at this point in the history
Scene Inspector : Support dragging of inspector labels
  • Loading branch information
johnhaddon authored Jun 14, 2024
2 parents 9a36550 + cd2c82c commit e40be84
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Improvements
- Added support for middle-dragging from the widget to access the current Edit Scope node.
- ArnoldAttributes : Added syntax highlighting and auto-complete for set expressions on the `shadowGroup` plug.
- OpenColorIO : When a script-level OpenColorIO variable contains a Gaffer `${contextVariable}` reference, its evaluation is now deferred to the point of use. This allows it to pick up overrides introduced by nodes such as ContextVariables and Wedge.
- SceneInspector :
- Added support for dragging inspector labels, such as those containing the names of attributes, options, output parameters, parameters, primitive variables, and sets.
- Set names beginning with "__" such as "__lights" or "__cameras" are now displayed as-is, rather than being transformed to "Lights" or "Cameras".

Fixes
-----
Expand Down
30 changes: 22 additions & 8 deletions python/GafferSceneUI/SceneInspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,10 @@ def __init__( self, inspector, diffCreator = TextDiff, alternate = False, **kw )
menu = GafferUI.Menu( Gaffer.WeakMethod( self.__menuDefinition ) )
)

label.buttonPressSignal().connect( Gaffer.WeakMethod( self.__buttonPress ), scoped = False )
label.dragBeginSignal().connect( Gaffer.WeakMethod( self.__dragBegin ), scoped = False )
label.dragEndSignal().connect( Gaffer.WeakMethod( self.__dragEnd ), scoped = False )

self.__inspector = inspector
self.__diffCreator = diffCreator

Expand Down Expand Up @@ -1008,6 +1012,22 @@ def __showShader( self, targets ) :
self.ancestor( GafferUI.Window ).addChildWindow( w, removeOnClose = True )
w.setVisible( True )

def __buttonPress( self, widget, event ) :

return event.buttons == event.Buttons.Left

def __dragBegin( self, widget, event ) :

if event.buttons != event.Buttons.Left :
return None

GafferUI.Pointer.setCurrent( "values" )
return self.__inspector.name() if self.__inspector else ""

def __dragEnd( self, widget, event ) :

GafferUI.Pointer.setCurrent( None )

##########################################################################
# DiffColumn
##########################################################################
Expand Down Expand Up @@ -2262,10 +2282,7 @@ def __init__( self, setName = None ) :

def name( self ) :

if self.__setName.startswith( "__" ) :
return IECore.CamelCase.toSpaced( self.__setName[2:] )
else :
return self.__setName or ""
return self.__setName or ""

def supportsInheritance( self ) :

Expand Down Expand Up @@ -2570,10 +2587,7 @@ def __init__( self, setName = None ) :

def name( self ) :

if self.__setName.startswith( "__" ) :
return IECore.CamelCase.toSpaced( self.__setName[2:] )
else :
return self.__setName or ""
return self.__setName or ""

def __call__( self, target ) :

Expand Down

0 comments on commit e40be84

Please sign in to comment.