Skip to content

Commit

Permalink
TransformTool : Add target transform viewer tip
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl committed Dec 5, 2023
1 parent a8dc817 commit cd8cdc2
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/GafferSceneUI/LightPositionToolUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#
##########################################################################

import IECore

import Gaffer
import GafferUI
import GafferSceneUI
Expand All @@ -51,4 +53,5 @@
"order", 7,
"tool:exclusive", True,

"ui:tool:transformToolTips", IECore.StringVectorData( [ "Hold 'V' to place shadow target", "Hold 'Shift' + 'V' to place shadow pivot", ] ),
)
4 changes: 4 additions & 0 deletions python/GafferSceneUI/RotateToolUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#
##########################################################################

import IECore

import Gaffer
import GafferSceneUI

Expand All @@ -51,6 +53,8 @@
"viewer:shortCut", "E",
"order", 2,

"ui:tool:transformToolTips", IECore.StringVectorData( [ "Hold 'V' to place orientation target", ] ),

plugs = {

"orientation" : [
Expand Down
20 changes: 20 additions & 0 deletions python/GafferSceneUI/TransformToolUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
"toolbarLayout:customWidget:RightSpacer:section", "Bottom",
"toolbarLayout:customWidget:RightSpacer:index", -1,

"nodeToolbar:top:type", "GafferUI.StandardNodeToolbar.top",
"toolbarLayout:customWidget:TargetTipWidget:widgetType", "GafferSceneUI.TransformToolUI._TargetTipWidget",
"toolbarLayout:customWidget:TargetTipWidget:section", "Top",

)

class _LeftSpacer( GafferUI.Spacer ) :
Expand Down Expand Up @@ -101,6 +105,22 @@ def _distance( ancestor, descendant ) :

return result

class _TargetTipWidget( GafferUI.Frame ) :

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

GafferUI.Frame.__init__( self, borderWidth = 4, **kw )

labels = Gaffer.Metadata.value( tool, "ui:tool:transformToolTips" )

if labels is not None :
with self :
with GafferUI.ListContainer( orientation = GafferUI.ListContainer.Orientation.Vertical, spacing = 4 ) :
for label in labels:
GafferUI.Label( label )
else :
self.setVisible( False )

class _SelectionWidget( GafferUI.Frame ) :

def __init__( self, tool, **kw ) :
Expand Down
4 changes: 4 additions & 0 deletions python/GafferSceneUI/TranslateToolUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#
##########################################################################

import IECore

import Gaffer
import GafferSceneUI

Expand All @@ -51,6 +53,8 @@
"viewer:shortCut", "W",
"order", 1,

"ui:tool:transformToolTips", IECore.StringVectorData( [ "Hold 'V' to place translation target", ] ),

plugs = {

"orientation" : [
Expand Down
1 change: 1 addition & 0 deletions python/GafferUI/_StyleSheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,7 @@ def styleColor( key ) :
#gafferColorInspector,
*[gafferClass="GafferSceneUI.TransformToolUI._SelectionWidget"],
*[gafferClass="GafferSceneUI.CropWindowToolUI._StatusWidget"],
*[gafferClass="GafferSceneUI.TransformToolUI._TargetTipWidget"],
*[gafferClass="GafferUI.EditScopeUI.EditScopePlugValueWidget"] > QFrame,
*[gafferClass="GafferSceneUI.InteractiveRenderUI._ViewRenderControlUI"] > QFrame,
*[gafferClass="GafferSceneUI._SceneViewInspector"] > QFrame
Expand Down

0 comments on commit cd8cdc2

Please sign in to comment.