Skip to content

Commit

Permalink
CyclesShaderUI : Fix presets menus
Browse files Browse the repository at this point in the history
This was broken in #6082, where we switched the storage from Python dicts to CompoundData.

Also moved the `label` variable closer to the point of usage and omitted the `flags` variable since it wasn't really helpful. The `label` variable actually worked without the `.value` part, but I added it to avoid any future surprises.
  • Loading branch information
johnhaddon committed Oct 28, 2024
1 parent b2dcf77 commit 542e7f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 8 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
1.5.x.x (relative to 1.5.0.0)
=======

Fixes
-----

- CyclesShader : Fixed broken presets menus.

1.5.0.0 (relative to 1.4.15.0)
=======

Expand Down
9 changes: 4 additions & 5 deletions python/GafferCyclesUI/CyclesShaderUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,13 @@ def __getSocketToComponents( socketType ) :

def __translateParamMetadata( nodeTypeName, socketName, value ) :
paramPath = nodeTypeName + ".parameters." + socketName
socketType = value["type"]
label = value["ui_name"]
flags = value["flags"]
socketType = value["type"].value
if socketType == "enum" :
presetNames = IECore.StringVectorData()
presetValues = IECore.StringVectorData()
for enumName, enumValues in value["enum_values"].items() :
presetNames.append(enumName)
presetValues.append(enumValues)
presetValues.append( enumValues.value )
__metadata[paramPath]["presetNames"] = presetNames
__metadata[paramPath]["presetValues"] = presetValues
__metadata[paramPath]["plugValueWidget:type"] = "GafferUI.PresetsPlugValueWidget"
Expand All @@ -94,10 +92,11 @@ def __translateParamMetadata( nodeTypeName, socketName, value ) :
__metadata[paramPath]["fileSystemPath:extensionsLabel"] = "Show only image files"

__metadata[paramPath]["noduleLayout:visible"] = True
label = value["ui_name"].value
__metadata[paramPath]["label"] = label
__metadata[paramPath]["noduleLayout:label"] = label
# Linkable
linkable = bool( flags.value & ( 1 << 0 ) )
linkable = bool( value["flags"].value & ( 1 << 0 ) )
__metadata[paramPath]["nodule:type"] = "" if not linkable else None # "" disables the nodule, and None falls through to the default

if "category" in value :
Expand Down

0 comments on commit 542e7f2

Please sign in to comment.