Skip to content

Commit

Permalink
GUI startup : Add UsdPreviewSurface shaders to node menu
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhaddon committed Jul 7, 2023
1 parent fd70957 commit af0f34a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Features

- MeshNormals : Added a new node for adjusting mesh normals.
- VolumeScatter : Added a new node for scattering points throughout a volume.
- USDShader : Added a node for loading shaders from USD's `SdrRegistry`. This includes shaders such as `UsdPreviewSurface` and `UsdUVTexture`.
- USDShader : Added a node for loading shaders from USD's `SdrRegistry`. This includes shaders such as `UsdPreviewSurface` and `UsdUVTexture`, which are now available in the `USD/Shaders` section of the node menu.

Improvements
------------
Expand Down
22 changes: 22 additions & 0 deletions startup/gui/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,28 @@ def __shaderNodeCreator( nodeName, shaderName ) :
import GafferUSD
import GafferUSDUI

def __usdShaderCreator( shaderName ) :

node = GafferUSD.USDShader( name = shaderName )
node.loadShader( shaderName )
return node

for menuPath, shader in [
[ "Preview Surface", "UsdPreviewSurface" ],
[ "UV Texture", "UsdUVTexture" ],
[ "Transform 2D", "UsdTransform2d" ],
[ "Primvar Reader/Int", "UsdPrimvarReader_int" ],
[ "Primvar Reader/Float", "UsdPrimvarReader_float" ],
[ "Primvar Reader/Float2", "UsdPrimvarReader_float2" ],
[ "Primvar Reader/Float3", "UsdPrimvarReader_float3" ],
[ "Primvar Reader/Float4", "UsdPrimvarReader_float4" ],
[ "Primvar Reader/String", "UsdPrimvarReader_string" ],
[ "Primvar Reader/Point", "UsdPrimvarReader_point" ],
[ "Primvar Reader/Vector", "UsdPrimvarReader_vector" ],
[ "Primvar Reader/Normal", "UsdPrimvarReader_normal" ],
] :
nodeMenu.append( "/USD/Shader/{}".format( menuPath ), functools.partial( __usdShaderCreator, shader ), searchText = shader )

nodeMenu.append( "/USD/Attributes", GafferUSD.USDAttributes, searchText = "USDAttributes" )
nodeMenu.append( "/USD/Layer Writer", GafferUSD.USDLayerWriter, searchText = "USDLayerWriter" )

Expand Down

0 comments on commit af0f34a

Please sign in to comment.