From 542e7f21589e2d24876cdf6d8b668a6b742a12e8 Mon Sep 17 00:00:00 2001 From: John Haddon Date: Mon, 28 Oct 2024 15:33:14 +0000 Subject: [PATCH] CyclesShaderUI : Fix presets menus 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. --- Changes.md | 8 ++++++++ python/GafferCyclesUI/CyclesShaderUI.py | 9 ++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Changes.md b/Changes.md index 7c89d0d454a..d88974249a1 100644 --- a/Changes.md +++ b/Changes.md @@ -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) ======= diff --git a/python/GafferCyclesUI/CyclesShaderUI.py b/python/GafferCyclesUI/CyclesShaderUI.py index b2152371989..95a41e6c13d 100644 --- a/python/GafferCyclesUI/CyclesShaderUI.py +++ b/python/GafferCyclesUI/CyclesShaderUI.py @@ -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" @@ -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 :