diff --git a/Changes.md b/Changes.md index 6e6ad0b6a4b..6b03d1e0e4f 100644 --- a/Changes.md +++ b/Changes.md @@ -1,10 +1,16 @@ 1.4.x.x (relative to 1.4.14.0) ======= +Improvements +------------ + +- USDLight : Append the (Renderman) suffix to any USD Lux plugs with `ri:light:` prefix. + Fixes ----- - ShaderView : Fixed crash caused by a SceneCreator returning `None`. +- USDShader : Fixed default preset values on IntPlugs that are intended to be enum indexes instead of string values. 1.4.14.0 (relative to 1.4.13.0) ======== diff --git a/python/GafferUSDUI/USDShaderUI.py b/python/GafferUSDUI/USDShaderUI.py index 086a4e92e83..b06d2cd984c 100644 --- a/python/GafferUSDUI/USDShaderUI.py +++ b/python/GafferUSDUI/USDShaderUI.py @@ -112,11 +112,23 @@ def __layoutSection( plug ) : def __label( plug ) : + # When the Prman USD plugin is included with OpenUSD, the API + # schema for Lux lights gets applied but to match how other + # renderers label their custom plugs, we need to add the + # (Renderman) suffix to the label here. + + suffix = "" + if plug.getName().startswith( "ri:light:" ) : + suffix = " (Renderman)" + property = __primProperty( plug ) if property : - return property.GetMetadata( "displayName" ) + return property.GetMetadata( "displayName" ) + suffix - return __sdrProperty( plug ).GetLabel() or None + label = __sdrProperty( plug ).GetLabel() or None + if label : + label += suffix + return label def __description( plug ) : @@ -190,12 +202,17 @@ def __presetValues( plug ) : property = __primProperty( plug ) if property : allowedTokens = property.GetMetadata( "allowedTokens" ) - return IECore.StringVectorData( allowedTokens ) if allowedTokens else None + if allowedTokens and isinstance( plug, Gaffer.IntPlug ) : + return IECore.IntVectorData( [ i for i in range( len( allowedTokens ) ) ] ) + else : + return IECore.StringVectorData( allowedTokens ) if allowedTokens else None property = __sdrProperty( plug ) options = property.GetOptions() if options : - if len( options ) > 1 and all( o[1] == "" for o in options ) : + if isinstance( plug, Gaffer.IntPlug ) : + return IECore.IntVectorData( [ i for i in range( len( options ) ) ] ) + elif len( options ) > 1 and all( o[1] == "" for o in options ) : # USD's `_CreateSdrShaderProperty` method in `shaderDefUtils.cpp` # always uses an empty string for the option value when converting # from `allowedTokens`. Ignore that, and use the names as the values