ross-g / io_pdx_mesh

Import/Export files for the Clausewitz game engine
GNU General Public License v3.0
88 stars 11 forks source link

Incompatibility with new Principled BSDF in Blender 4.0 #86

Closed Tetrino closed 2 months ago

Tetrino commented 1 year ago

Describe the bug With Blender 4.0 on the horizon, the tool now breaks with the changes to Principled BSDF.

To Reproduce Just try to import any mesh.

Witness the following error:

Python: Traceback (most recent call last):
  File "C:\Users\Moose\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\io_pdx_mesh\pdx_blender\blender_ui.py", line 383, in execute
    import_meshfile(
  File "C:\Users\Moose\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\io_pdx_mesh\library.py", line 47, in wrapper
    value = func(*args, **kwargs)
  File "C:\Users\Moose\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\io_pdx_mesh\pdx_blender\blender_import_export.py", line 1249, in import_meshfile
    create_material(pdx_material, mesh, os.path.split(meshpath)[0])
  File "C:\Users\Moose\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\io_pdx_mesh\pdx_blender\blender_import_export.py", line 753, in create_material
    shader = create_shader(PDX_material, shader_name, texture_path)
  File "C:\Users\Moose\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\io_pdx_mesh\pdx_blender\blender_import_export.py", line 718, in create_shader
    links.new(separate_rgb.outputs["G"], shader_root.inputs["Specular"])
KeyError: 'bpy_prop_collection[key]: key "Specular" not found'

If you check the material you'll see that it hasn't finished its linking. Of course this means it isn't attached to the imported mesh either.

Software (please complete the following information): Latest version of Blender 4.0 Beta.

Additional context Blender release notes have a whole thing on Principled BSDF changes. They're now a locked-in feature.

Tetrino commented 1 year ago

I have added a PR to fix this issue while maintaining support for previous versions of Blender #87