Skip to content

Commit ea56f39

Browse files
TMHSDigitalclaude
andcommitted
fix(skills): full Principled BSDF v2 socket table; drop dead 3.x socket fallbacks
The procedural-materials skill documented only Specular -> Specular IOR Level, and taught a set_specular shim whose 3.x branch never runs on a supported version. 17 examples carried the same dead pattern, inputs.get("Emission Color") or inputs["Emission"]. The skill now has the full 3.x -> 4.0+ table, measured on 4.5.14 and 5.2.1: - Emission, Subsurface, Clearcoat, Sheen and Transmission renames; - Subsurface Color and Transmission Roughness removed; - Specular Tint and Sheen Tint are now RGBA; - the v2-only inputs, and Thin Wall, which is 5.2 only. It quotes the exact KeyError and adds a common-mistakes entry. The 22 fallbacks in examples now use the 4.0+ name directly. The swatch-grid shim stays, because witnessing the rename is that example's contract. Mix-node Factor/Fac fallbacks also stay: ShaderNodeMixRGB still names it Fac, so those branches are live. Verified on 5.2.1 and 4.5.14: mesh-hygiene-audit --output (cycles), sky-texture-sun-elevation and uv-layer-grid all exit 0. Closes #382 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: TMHSDigital <154358121+TMHSDigital@users.noreply.github.com>
1 parent f62501d commit ea56f39

18 files changed

Lines changed: 62 additions & 39 deletions

File tree

‎examples/cross-version-property-delete/cross_version_property_delete.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def principled(name, color, metallic, roughness, emission=None, strength=4.5):
215215
bsdf.inputs["Metallic"].default_value = metallic
216216
bsdf.inputs["Roughness"].default_value = roughness
217217
if emission is not None:
218-
sock = bsdf.inputs.get("Emission Color") or bsdf.inputs["Emission"]
218+
sock = bsdf.inputs["Emission Color"]
219219
sock.default_value = emission
220220
bsdf.inputs["Emission Strength"].default_value = strength
221221
return mat

‎examples/degenerate-bevel-weld/degenerate_bevel_weld.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def make_material(name, rgb, rough=0.45, metallic=0.35, emit=None, estr=0.0):
232232
b.inputs["Roughness"].default_value = rough
233233
b.inputs["Metallic"].default_value = metallic
234234
if emit is not None:
235-
sock = b.inputs.get("Emission Color") or b.inputs["Emission"]
235+
sock = b.inputs["Emission Color"]
236236
sock.default_value = (*emit, 1.0)
237237
b.inputs["Emission Strength"].default_value = estr
238238
return mat

‎examples/export-preset-axis/export_preset_axis.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def build():
287287
principled("CabinetPaint", (0.20, 0.30, 0.25, 1.0), 0.0, 0.5),
288288
)
289289
bsdf = mats[MAT_LAMP].node_tree.nodes["Principled BSDF"]
290-
sock = bsdf.inputs.get("Emission Color") or bsdf.inputs["Emission"]
290+
sock = bsdf.inputs["Emission Color"]
291291
sock.default_value = (1.0, 0.012, 0.006, 1.0)
292292
bsdf.inputs["Emission Strength"].default_value = 3.0
293293
for m in mats:
@@ -566,7 +566,7 @@ def light(scene, name, loc, energy, size, col, target):
566566
def gizmo_material(name, color):
567567
mat = principled(name, color, 0.0, 0.35)
568568
bsdf = mat.node_tree.nodes["Principled BSDF"]
569-
sock = bsdf.inputs.get("Emission Color") or bsdf.inputs["Emission"]
569+
sock = bsdf.inputs["Emission Color"]
570570
sock.default_value = color
571571
bsdf.inputs["Emission Strength"].default_value = 0.25
572572
return mat

‎examples/gltf-export-roundtrip/gltf_export_roundtrip.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def pbr(name, base, metallic, roughness, emission=None, strength=0.0):
172172
b.inputs["Metallic"].default_value = metallic
173173
b.inputs["Roughness"].default_value = roughness
174174
if emission is not None:
175-
sock = b.inputs.get("Emission Color") or b.inputs["Emission"]
175+
sock = b.inputs["Emission Color"]
176176
sock.default_value = (*emission, 1.0)
177177
b.inputs["Emission Strength"].default_value = strength
178178
return mat

‎examples/gltf-skin-roundtrip/gltf_skin_roundtrip.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ def pbr(name, base, metallic, roughness, emission=None, strength=0.0):
803803
b.inputs["Metallic"].default_value = metallic
804804
b.inputs["Roughness"].default_value = roughness
805805
if emission is not None:
806-
sock = b.inputs.get("Emission Color") or b.inputs["Emission"]
806+
sock = b.inputs["Emission Color"]
807807
sock.default_value = (*emission, 1.0)
808808
b.inputs["Emission Strength"].default_value = strength
809809
return mat

‎examples/gn-socket-rename/gn_socket_rename.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def principled(name, color, metallic, roughness, emission=None):
249249
bsdf.inputs["Metallic"].default_value = metallic
250250
bsdf.inputs["Roughness"].default_value = roughness
251251
if emission is not None:
252-
sock = bsdf.inputs.get("Emission Color") or bsdf.inputs["Emission"]
252+
sock = bsdf.inputs["Emission Color"]
253253
sock.default_value = emission
254254
bsdf.inputs["Emission Strength"].default_value = 0.12
255255
return mat
@@ -405,7 +405,7 @@ def dress_gauge(copper, steel):
405405
enabled_sock(base, "inputs", "A").default_value = (0.93, 0.42, 0.08, 1.0)
406406
enabled_sock(base, "inputs", "B").default_value = (0.05, 0.018, 0.006, 1.0)
407407
nt.links.new(enabled_sock(base, "outputs", "Result"), bsdf.inputs["Base Color"])
408-
emit = bsdf.inputs.get("Emission Color") or bsdf.inputs["Emission"]
408+
emit = bsdf.inputs["Emission Color"]
409409
nt.links.new(enabled_sock(base, "outputs", "Result"), emit)
410410
# Brushed, the copper reflects less of the key and went brown at
411411
# thumbnail size; a little more of its own colour keeps it copper.

‎examples/light-link-studio/light_link_studio.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _principled(name, rgb, rough, metallic=0.0, emit=None, estr=0.0):
8080
b.inputs["Roughness"].default_value = rough
8181
b.inputs["Metallic"].default_value = metallic
8282
if emit is not None:
83-
sock = b.inputs.get("Emission Color") or b.inputs["Emission"]
83+
sock = b.inputs["Emission Color"]
8484
sock.default_value = (*emit, 1.0)
8585
b.inputs["Emission Strength"].default_value = estr
8686
return mat

‎examples/lightmap-uv-channel/lightmap_uv_channel.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ def make_material(name, rgb, rough=0.6, metallic=0.0, emit=None, estr=0.0,
698698
b.inputs["Roughness"].default_value = rough
699699
b.inputs["Metallic"].default_value = metallic
700700
if emit is not None:
701-
sock = b.inputs.get("Emission Color") or b.inputs["Emission"]
701+
sock = b.inputs["Emission Color"]
702702
sock.default_value = (*emit, 1.0)
703703
b.inputs["Emission Strength"].default_value = estr
704704
if grain or bump:

‎examples/lod-decimate-chain/lod_decimate_chain.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ def pbr(name, base, metallic, roughness, emission=None, strength=0.0):
427427
b.inputs["Metallic"].default_value = metallic
428428
b.inputs["Roughness"].default_value = roughness
429429
if emission is not None:
430-
sock = b.inputs.get("Emission Color") or b.inputs["Emission"]
430+
sock = b.inputs["Emission Color"]
431431
sock.default_value = (*emission, 1.0)
432432
b.inputs["Emission Strength"].default_value = strength
433433
return mat

‎examples/mesh-hygiene-audit/mesh_hygiene_audit.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,11 @@ def make_material(name, rgb, rough=0.45, metallic=0.0, emit=None, estr=0.0,
235235
b.inputs["Roughness"].default_value = rough
236236
b.inputs["Metallic"].default_value = metallic
237237
if coat:
238-
sock = b.inputs.get("Coat Weight") or b.inputs.get("Clearcoat")
238+
sock = b.inputs["Coat Weight"]
239239
if sock is not None:
240240
sock.default_value = coat
241241
if emit is not None:
242-
sock = b.inputs.get("Emission Color") or b.inputs["Emission"]
242+
sock = b.inputs["Emission Color"]
243243
sock.default_value = (*emit, 1.0)
244244
b.inputs["Emission Strength"].default_value = estr
245245
return mat
@@ -261,7 +261,7 @@ def add_backface_witness(mat, rgb=(0.85, 0.002, 0.004), strength=0.35):
261261
back = nt.nodes.new("ShaderNodeBsdfPrincipled")
262262
back.inputs["Base Color"].default_value = (*rgb, 1.0)
263263
back.inputs["Roughness"].default_value = 0.5
264-
sock = back.inputs.get("Emission Color") or back.inputs["Emission"]
264+
sock = back.inputs["Emission Color"]
265265
sock.default_value = (*rgb, 1.0)
266266
back.inputs["Emission Strength"].default_value = strength
267267
mix = nt.nodes.new("ShaderNodeMixShader")

0 commit comments

Comments
 (0)