Skip to content

Commit

Permalink
Merge pull request #5847 from BrianHanke/cycles_ui_final
Browse files Browse the repository at this point in the history
Cycles UI Improvements for 1.4
  • Loading branch information
johnhaddon authored May 10, 2024
2 parents 246c731 + 155c22c commit f1a0da3
Show file tree
Hide file tree
Showing 5 changed files with 1,066 additions and 12 deletions.
5 changes: 5 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ Improvements
-----------

- Arnold : If it exists, an `ai:volume` attribute is preferred over an `ai:surface` attribute when resolving shaders for volumes.
- Cycles :
- Updated the UI of Cycles shaders and lights for ease of use and to match Blender conventions.
- Hide certain parameters based on UI selections.
- Renamed and reordered parameters and created sections to match Blender.
- Changed all the Cycles items in the Gaffer tab menu to title case.

Fixes
-----
Expand Down
6 changes: 5 additions & 1 deletion python/GafferCyclesUI/ShaderMenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ def appendShaders( menuDefinition, prefix="/Cycles" ) :
# Build a list of menu items we want to create.

menuItems = []
original = [ "Hsv", "Rgb", "Xyz", "Bw", " To ", "Aov", "Uvmap", "Ies", "Bsdf", "Non Uniform" ]
replacement = [ "HSV", "RGB", "XYZ", "BW", " to ", "AOV", "UV Map", "IES", "BSDF", "Nonuniform" ]

for shader in GafferCycles.shaders :
shaderName = str( shader )
displayName = " ".join( [ IECore.CamelCase.toSpaced( x ) for x in shaderName.split( "_" ) ] )
for x, y in zip( original, replacement ) :
displayName = displayName.replace( x, y )
category = GafferCycles.shaders[shader]["category"]
menuPath = "Shader"

Expand All @@ -72,7 +76,7 @@ def appendShaders( menuDefinition, prefix="/Cycles" ) :
nodeCreator = functools.partial( __lightCreator, lightName, GafferCycles.CyclesLight )
menuItems.append( MenuItem( "%s/%s" % ( menuPath, displayName ), nodeCreator ) )

menuItems.append( MenuItem( "%s/%s" % ( "Light", "MeshLight" ), GafferCycles.CyclesMeshLight ) )
menuItems.append( MenuItem( "%s/%s" % ( "Light", "Mesh Light" ), GafferCycles.CyclesMeshLight ) )

# Create the actual menu items.

Expand Down
4 changes: 0 additions & 4 deletions startup/GafferCycles/principledBSDFCompatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,3 @@ def getItem( self, key ) :
return getItem

GafferCycles.CyclesShader.__getitem__ = __cyclesShaderGetItem( GafferCycles.CyclesShader.__getitem__ )

# The parameter defaults advertised by Cycles do not always match the actual defaults used by Blender.
# Register user defaults with Blender's values where it makes sense.
Gaffer.Metadata.registerValue( "cycles:surface:principled_bsdf:specular_ior_level", "userDefault", 0.5 )
7 changes: 0 additions & 7 deletions startup/GafferCycles/userDefaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,3 @@
##########################################################################

import Gaffer

# Correction for Blender's Z-up default mapping.

Gaffer.Metadata.registerValue( "cycles:surface:environment_texture:tex_mapping__scale.x", "userDefault", -1.0 )
Gaffer.Metadata.registerValue( "cycles:surface:environment_texture:tex_mapping__y_mapping", "userDefault", "z" )
Gaffer.Metadata.registerValue( "cycles:surface:environment_texture:tex_mapping__z_mapping", "userDefault", "y" )

Loading

0 comments on commit f1a0da3

Please sign in to comment.