SpectralVectors / TransMat

Recreate Blender Materials as Unreal Materials
MIT License
57 stars 3 forks source link

transmat crashing on the emission settings and when the emission node is in the material #2

Open darthron1975 opened 1 year ago

darthron1975 commented 1 year ago

I wanted to export few materials that were created by the kotorblender plugin and some of those use the emission node in place of the Principled BSDF shader. Every time i hit translate material it throws the following errors:

Python: Traceback (most recent call last): File "C:\Users\luke\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\TransMat.py", line 614, in execute to_socket = str(f"'{socket_translate[ID][socket]}'") KeyError: 'ShaderNodeEmission'

location: :-1

and

Python: Traceback (most recent call last): File "C:\Users\luke\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\TransMat.py", line 485, in execute nodedata['pln_create'].append( str(f"{nodename}{socket_translate[ID][input.name]} = create_expression({material.name}, unreal.MaterialExpressionConstant, {nodedata['pln_location']}") ) KeyError: 'Emission Strength'

location: :-1 .

here is also the node layout of 2 of the materials if needed Screenshot (10)

Screenshot (11)

SpectralVectors commented 1 year ago

Unfortunately, I'm not sure what support to offer in this case, it has been a few years since I worked on this addon, and I have since stopped working on Epic/Unreal related projects.

I agree with your assessment that there is an issue with translating the Emission node, and I can tell you that the whole addon works via strings in dictionaries, so if there was a change made to one of the strings (e.g. it used to be 'Emission Strength' and now it's just 'Strength') it could cause the errors you are encountering.

I know that's not much help, but there is also an alternative implementation, one that actually inspired this project to begin with, but has been updated more recently: https://github.com/angjminer/blueman

If you want to try and get the code working I can try and help with error codes or explanations, but no longer being an Unreal user that might be the best I can do.