Skip to content

shader_MOUNTAIN incompatible with Blender 4.0+ (positional BSDF arguments) #477

@elfenlieds7

Description

@elfenlieds7

Description

The shader_MOUNTAIN function in infinigen/assets/materials/terrain/mountain.py uses positional arguments for ShaderNodeBsdfPrincipled, which breaks in Blender 4.0+ due to input socket reordering.

Error

ValueError: bpy_struct: item.attr = val: sequence expected at dimension 1, not 'int'
  In call to configurable 'shader' (<function shader_MOUNTAIN at 0x7f2040ac7ba0>)

Traceback

File ".../infinigen/assets/materials/terrain/mountain.py", line 376, in shader_MOUNTAIN
    bsdf_mountain = nw.new_node(
                    ^^^^^^^^^^^^
File ".../infinigen/core/nodes/node_wrangler.py", line 141, in new_node
    return compat_map(self, node_type, input_args, attrs, input_kwargs)
...
ValueError: bpy_struct: item.attr = val: sequence expected at dimension 1, not 'int'

Root Cause

Line 376-379 in mountain.py:

bsdf_mountain = nw.new_node(
    "ShaderNodeBsdfPrincipled",
    [color_, None, None, None, None, None, None, None, None, shader_roughness],
)

The 10th positional argument (shader_roughness, a float) is being passed to a socket that expects an RGB color tuple in Blender 4.0+.

Suggested Fix

Use keyword arguments for Blender 4.0+ compatibility:

bsdf_mountain = nw.new_node(
    "ShaderNodeBsdfPrincipled",
    input_kwargs={"Base Color": color_, "Roughness": shader_roughness},
)

Reproduction

This occurs when generating indoor scenes with NatureShelfTrinketsFactory which creates boulder/rock decorations that use the mountain shader.

Environment

  • Blender 4.2
  • Infinigen latest (commit 69211e1)
  • Ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions