0xafbf / blender-datasmith-export

Blender addon to export UE4 Datasmith format
GNU General Public License v3.0
387 stars 49 forks source link

Error when export in Blender 4.0 #67

Open fherx opened 4 months ago

fherx commented 4 months ago
Datasmith export error:
'bpy_prop_collection[key]: key "Specular" not found'
Traceback (most recent call last):
  File "C:\Users\PC\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\blender-datasmith-export-master\__init__.py", line 101, in execute
    return export_datasmith.save(context, **keywords)
  File "C:\Users\PC\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\blender-datasmith-export-master\export_datasmith.py", line 2458, in save
    collect_and_save(context, kwargs, basepath)
  File "C:\Users\PC\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\blender-datasmith-export-master\export_datasmith.py", line 2345, in collect_and_save
    material_nodes = [collect_pbr_material(mat) for mat in unique_materials]
  File "C:\Users\PC\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\blender-datasmith-export-master\export_datasmith.py", line 2345, in <listcomp>
    material_nodes = [collect_pbr_material(mat) for mat in unique_materials]
  File "C:\Users\PC\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\blender-datasmith-export-master\export_datasmith.py", line 1462, in collect_pbr_material
    return pbr_nodetree_material(material)
  File "C:\Users\PC\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\blender-datasmith-export-master\export_datasmith.py", line 1388, in pbr_nodetree_material
    expressions = get_expression(surface_field, exp_list)
  File "C:\Users\PC\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\blender-datasmith-export-master\export_datasmith.py", line 961, in get_expression
    return_exp = get_expression_inner(field, exp_list)
  File "C:\Users\PC\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\blender-datasmith-export-master\export_datasmith.py", line 1017, in get_expression_inner
    "Specular": get_expression(node.inputs['Specular'], exp_list),
KeyError: 'bpy_prop_collection[key]: key "Specular" not found'

datasmith blender 4 error

harshstv commented 3 months ago

Screenshot 2024-03-14 123630

Same error, I am also getting in blender 4.0 while exporting datasmith file with textures.

harshstv commented 3 months ago

Problem solved, you can older version 3.1.0 then add on will work.

hodoer commented 3 weeks ago

Using Blender 4.1 here. I changed and commented out some parts of the scripts to get it to export successfully. Changed the method to read normals to m.corner_normals. Commented out lines where they're trying to read specular and transmission, cause I Found out that the way blender reads and stores specular and transmission/opacity changed after 4.0. Don't know what's the correct way to edit these lines so I just commented them out and I'm able to export as datasmith successfully.

blackcarbon99 commented 2 days ago

Hi, can i get the .py file if you've edited it?