Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 5 additions & 4 deletions python/GafferArnoldUI/ArnoldAOVShaderUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,26 @@
import Gaffer
import GafferUI
import GafferArnold
from GafferUI.i18n import _

Gaffer.Metadata.registerNode(

GafferArnold.ArnoldAOVShader,

"description",
"""
_("""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems unfortunate that every single metadata registration needs to be wrapped like this. As well as being a little ugly, it feels like the sort of thing that will be easily forgotten, and I wonder what the overhead of translating during startup is.

I wonder if it might be cleaner to store non-translated metadata, and then for the consumer of the metadata to perform the translation on the fly. Perhaps that might also open the door to being able to change language without restarting Gaffer?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a code review perspective, it would have been really useful to have changes like this in a separate commit. With everything in one commit, it's hard to discern the important structural changes from the noise of the _( changes.

Sets up global shaders in the Arnold options which can be used to populate global AOVs.
""",
"""),

plugs = {

"optionSuffix" : {

"description" :
"""
_("""
This suffix defines where the aov shader is stored in the render options. If you use
an existing suffix, you will overwrite instead of creating a new AOV shader.
""",
"""),
},

}
Expand Down
5 changes: 3 additions & 2 deletions python/GafferArnoldUI/ArnoldAtmosphereUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,18 @@

import Gaffer
import GafferArnold
from GafferUI.i18n import _

Gaffer.Metadata.registerNode(

GafferArnold.ArnoldAtmosphere,

"description",
"""
_("""
Assigns a global atmosphere shader that applies to all objects in
the scene. This is stored as an "ai:atmosphere" option in Gaffer's
globals, and translated onto the `options.atmosphere` parameter
in Arnold.
""",
"""),

)
49 changes: 25 additions & 24 deletions python/GafferArnoldUI/ArnoldAttributesUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import Gaffer
import GafferUI
import GafferArnold
from GafferUI.i18n import _

def __visibilitySummary( plug ) :

Expand All @@ -57,10 +58,10 @@ def __visibilitySummary( plug ) :

) :
if plug["ai:visibility:" + childName]["enabled"].getValue() :
info.append( label + ( " On" if plug["ai:visibility:" + childName]["value"].getValue() else " Off" ) )
info.append( label + ( " " + _("On") if plug["ai:visibility:" + childName]["value"].getValue() else " " + _("Off") ) )

if plug["ai:visibility:shadow_group"]["enabled"].getValue() :
info.append( "ShadowGroup Applied" )
info.append( _("ShadowGroup Applied") )

return ", ".join( info )

Expand All @@ -83,7 +84,7 @@ def __autoBumpVisibilitySummary( plug ) :

) :
if plug["ai:autobump_visibility:" + childName]["enabled"].getValue() :
info.append( label + ( " On" if plug["ai:autobump_visibility:" + childName]["value"].getValue() else " Off" ) )
info.append( label + ( " " + _("On") if plug["ai:autobump_visibility:" + childName]["value"].getValue() else " " + _("Off") ) )

return ", ".join( info )

Expand All @@ -92,7 +93,7 @@ def __transformSummary( plug ) :
info = []

if plug["ai:transform_type"]["enabled"].getValue() :
info.append( "Transform Type " + __transformTypeEnumNames[ plug["ai:transform_type"]["value"].getValue() ] )
info.append( _("Transform Type") + " " + __transformTypeEnumNames[ plug["ai:transform_type"]["value"].getValue() ] )

return ", ".join( info )

Expand All @@ -106,20 +107,20 @@ def __shadingSummary( plug ) :
( "ai:self_shadows", "Self Shadows" ),
) :
if plug[childName]["enabled"].getValue() :
info.append( label + ( " On" if plug[childName]["value"].getValue() else " Off" ) )
info.append( label + ( " " + _("On") if plug[childName]["value"].getValue() else " " + _("Off") ) )

if plug["ai:sss_setname"]["enabled"].getValue() :
info.append( "SSS Set Name " + plug["ai:sss_setname"]["value"].getValue() )
info.append( _("SSS Set Name") + " " + plug["ai:sss_setname"]["value"].getValue() )

return ", ".join( info )

def __subdivisionSummary( plug ) :

info = []
if plug["ai:polymesh:subdiv_iterations"]["enabled"].getValue() :
info.append( "Iterations %d" % plug["ai:polymesh:subdiv_iterations"]["value"].getValue() )
info.append( _("Iterations %d") % plug["ai:polymesh:subdiv_iterations"]["value"].getValue() )
if plug["ai:polymesh:subdiv_adaptive_error"]["enabled"].getValue() :
info.append( "Error %s" % GafferUI.NumericWidget.valueToString( plug["ai:polymesh:subdiv_adaptive_error"]["value"].getValue() ) )
info.append( _("Error %s") % GafferUI.NumericWidget.valueToString( plug["ai:polymesh:subdiv_adaptive_error"]["value"].getValue() ) )
if plug["ai:polymesh:subdiv_adaptive_metric"]["enabled"].getValue() :
info.append( string.capwords( plug["ai:polymesh:subdiv_adaptive_metric"]["value"].getValue().replace( "_", " " ) ) + " Metric" )
if plug["ai:polymesh:subdiv_adaptive_space"]["enabled"].getValue() :
Expand All @@ -134,11 +135,11 @@ def __subdivisionSummary( plug ) :
}.get( plug["ai:polymesh:subdiv_uv_smoothing"]["value"].getValue() )
)
if plug["ai:polymesh:subdiv_smooth_derivs"]["enabled"].getValue() :
info.append( "Smooth Derivs " + ( "On" if plug["ai:polymesh:subdiv_smooth_derivs"]["value"].getValue() else "Off" ) )
info.append( _("Smooth Derivs") + " " + ( _("On") if plug["ai:polymesh:subdiv_smooth_derivs"]["value"].getValue() else _("Off") ) )
if plug["ai:polymesh:subdiv_frustum_ignore"]["enabled"].getValue() :
info.append( "Frustum Ignore " + ( "On" if plug["ai:polymesh:subdiv_frustum_ignore"]["value"].getValue() else "Off" ) )
info.append( _("Frustum Ignore") + " " + ( _("On") if plug["ai:polymesh:subdiv_frustum_ignore"]["value"].getValue() else _("Off") ) )
if plug["ai:polymesh:subdivide_polygons"]["enabled"].getValue() :
info.append( "Subdivide Polygons " + ( "On" if plug["ai:polymesh:subdivide_polygons"]["value"].getValue() else "Off" ) )
info.append( _("Subdivide Polygons") + " " + ( _("On") if plug["ai:polymesh:subdivide_polygons"]["value"].getValue() else _("Off") ) )

return ", ".join( info )

Expand All @@ -148,45 +149,45 @@ def __curvesSummary( plug ) :
if plug["ai:curves:mode"]["enabled"].getValue() :
info.append( string.capwords( plug["ai:curves:mode"]["value"].getValue() ) )
if plug["ai:curves:min_pixel_width"]["enabled"].getValue() :
info.append( "Min Pixel Width %s" % GafferUI.NumericWidget.valueToString( plug["ai:curves:min_pixel_width"]["value"].getValue() ) )
info.append( _("Min Pixel Width %s") % GafferUI.NumericWidget.valueToString( plug["ai:curves:min_pixel_width"]["value"].getValue() ) )

return ", ".join( info )

def __pointsSummary( plug ) :

info = []
if plug["ai:points:min_pixel_width"]["enabled"].getValue() :
info.append( "Min Pixel Width {}".format( GafferUI.NumericWidget.valueToString( plug["ai:points:min_pixel_width"]["value"].getValue() ) ) )
info.append( _("Min Pixel Width {}").format( GafferUI.NumericWidget.valueToString( plug["ai:points:min_pixel_width"]["value"].getValue() ) ) )

return ", ".join( info )

def __volumeSummary( plug ) :

info = []
if plug["ai:volume:step_scale"]["enabled"].getValue() :
info.append( "Volume Step Scale %s" % GafferUI.NumericWidget.valueToString( plug["ai:volume:step_scale"]["value"].getValue() ) )
info.append( _("Volume Step Scale %s") % GafferUI.NumericWidget.valueToString( plug["ai:volume:step_scale"]["value"].getValue() ) )
if plug["ai:volume:step_size"]["enabled"].getValue() :
info.append( "Volume Step Size %s" % GafferUI.NumericWidget.valueToString( plug["ai:volume:step_size"]["value"].getValue() ) )
info.append( _("Volume Step Size %s") % GafferUI.NumericWidget.valueToString( plug["ai:volume:step_size"]["value"].getValue() ) )
if plug["ai:shape:step_scale"]["enabled"].getValue() :
info.append( "Shape Step Scale %s" % GafferUI.NumericWidget.valueToString( plug["ai:shape:step_scale"]["value"].getValue() ) )
info.append( _("Shape Step Scale %s") % GafferUI.NumericWidget.valueToString( plug["ai:shape:step_scale"]["value"].getValue() ) )
if plug["ai:shape:step_size"]["enabled"].getValue() :
info.append( "Shape Step Size %s" % GafferUI.NumericWidget.valueToString( plug["ai:shape:step_size"]["value"].getValue() ) )
info.append( _("Shape Step Size %s") % GafferUI.NumericWidget.valueToString( plug["ai:shape:step_size"]["value"].getValue() ) )
if plug["ai:shape:volume_padding"]["enabled"].getValue() :
info.append( "Padding %s" % GafferUI.NumericWidget.valueToString( plug["ai:shape:volume_padding"]["value"].getValue() ) )
info.append( _("Padding %s") % GafferUI.NumericWidget.valueToString( plug["ai:shape:volume_padding"]["value"].getValue() ) )
if plug["ai:volume:velocity_scale"]["enabled"].getValue() :
info.append( "Velocity Scale %s" % GafferUI.NumericWidget.valueToString( plug["ai:volume:velocity_scale"]["value"].getValue() ) )
info.append( _("Velocity Scale %s") % GafferUI.NumericWidget.valueToString( plug["ai:volume:velocity_scale"]["value"].getValue() ) )
if plug["ai:volume:velocity_fps"]["enabled"].getValue() :
info.append( "Velocity FPS %s" % GafferUI.NumericWidget.valueToString( plug["ai:volume:velocity_fps"]["value"].getValue() ) )
info.append( _("Velocity FPS %s") % GafferUI.NumericWidget.valueToString( plug["ai:volume:velocity_fps"]["value"].getValue() ) )
if plug["ai:volume:velocity_outlier_threshold"]["enabled"].getValue() :
info.append( "Velocity Outlier Threshold %s" % GafferUI.NumericWidget.valueToString( plug["ai:volume:velocity_outlier_threshold"]["value"].getValue() ) )
info.append( _("Velocity Outlier Threshold %s") % GafferUI.NumericWidget.valueToString( plug["ai:volume:velocity_outlier_threshold"]["value"].getValue() ) )

return ", ".join( info )

def __toonSummary( plug ) :

info = []
if plug["ai:toon_id"]["enabled"].getValue() :
info.append( "Toon Id " + plug["ai:toon_id"]["value"].getValue() )
info.append( _("Toon Id") + " " + plug["ai:toon_id"]["value"].getValue() )

return ", ".join( info )

Expand All @@ -195,9 +196,9 @@ def __toonSummary( plug ) :
GafferArnold.ArnoldAttributes,

"description",
"""
_("""
Applies Arnold attributes to objects in the scene.
""",
"""),

plugs = {

Expand Down
5 changes: 3 additions & 2 deletions python/GafferArnoldUI/ArnoldBackgroundUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@

import Gaffer
import GafferArnold
from GafferUI.i18n import _

Gaffer.Metadata.registerNode(

GafferArnold.ArnoldBackground,

"description",
"""
_("""
Assigns a background shader. This is stored as an "ai:background" option
in Gaffer's globals, and translated onto the `options.background` parameter
in Arnold.
""",
"""),

)
13 changes: 7 additions & 6 deletions python/GafferArnoldUI/ArnoldCameraShadersUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@

import Gaffer
import GafferArnold
from GafferUI.i18n import _

Gaffer.Metadata.registerNode(

GafferArnold.ArnoldCameraShaders,

"description",
"""
_("""
Creates shaders for use with Arnold cameras. Use a ShaderAssignment
node to assign the shaders to the cameras they should affect.
""",
"""),

plugs = {

Expand All @@ -58,14 +59,14 @@
"filterMap" : {

"description" :
"""
_("""
A shader used to weight the samples taken by an
Arnold camera. This can be used to create vignetting effects
or to completely mask out areas of the render, causing no
rays to be fired for those pixels. The shader is evaluated
across a 0-1 UV range that is mapped to the camera's screen
space.
""",
"""),

"nodule:type" : "GafferUI::StandardNodule",
"noduleLayout:section" : "left",
Expand All @@ -75,12 +76,12 @@
"uvRemap" : {

"description" :
"""
_("""
A shader used to simulate lens distortion effects. The shader
is evaluated across a 0-1 UV range that is mapped to the camera's
screen space, and should output a red/green UV image of distorted
UV positions.
""",
"""),

"nodule:type" : "GafferUI::StandardNodule",
"noduleLayout:section" : "left",
Expand Down
9 changes: 5 additions & 4 deletions python/GafferArnoldUI/ArnoldColorManagerUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import GafferUI
import GafferImageUI
import GafferArnold
from GafferUI.i18n import _

def __parameterUserDefault( plug ) :

Expand Down Expand Up @@ -97,10 +98,10 @@ def __colorSpacePlugValueWidget( plug ) :
GafferArnold.ArnoldColorManager,

"description",
"""
_("""
Specifies the colour manager to be used in Arnold renders. This is represented
in the scene as an option called `ai:color_manager`.
""",
"""),

plugs = {

Expand All @@ -109,9 +110,9 @@ def __colorSpacePlugValueWidget( plug ) :
"plugValueWidget:type" : "GafferUI.LayoutPlugValueWidget",

"description" :
"""
_("""
The parameters for the colour manager.
""",
"""),

},

Expand Down
Loading