BrendanParmer / NodeToPython

Convert Blender node groups to a Python add-on
MIT License
236 stars 21 forks source link

Can't convert Node Groups in Blender 4.0 #77

Closed trmhtk2 closed 8 months ago

trmhtk2 commented 9 months ago

I tried to use the NodeToPython add-on to convert Material Node Groups in Blender 4.0, but it gives the following error:

Python: Traceback (most recent call last):
   File "C:\ [...] \Blender Foundation\Blender\4.0\scripts\addons\NodeToPython\materials.py", line 246, in execute
     process_mat_node_group(nt, level, node_vars, used_vars)
   File "C:\ [...] \Blender Foundation\Blender\4.0\scripts\addons\NodeToPython\materials.py", line 192, in process_mat_node_group
     process_mat_node_group(node_nt, level + 1, node_vars,
   File "C:\ [...] \Blender Foundation\Blender\4.0\scripts\addons\NodeToPython\materials.py", line 212, in process_mat_node_group
     group_io_settings(node, file, inner, "output", nt_var, node_tree)
   File "C:\Users\Golden Dragon\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\NodeToPython\utils.py", line 276, in group_io_settings
     ntio = node_tree.outputs
AttributeError: 'ShaderNodeTree' object has no attribute 'outputs'

I'm pretty sure it's because of Blender 4.0's new NodeTrees system.

I would love to have it fixed. (By the way, thanks for the great add-on, it really helps me!)

BrendanParmer commented 9 months ago

(Traveling right now and typing on mobile) Hi @trmhtk2, thanks for submitting an issue. You're right, this is an issue with the new node tree representation. There's a Blender 4.0 Breaking Changes branch that I've been working in that should solve at least this problem. I'd consider it experimental for now, but so far it seems to be working fine with 3.6 node groups brought over to 4.0. Right now the branch still won't support new 4.0 features/nodes like node panels or repeat zones, but I'm targeting those for the next NodeToPython release, hopefully this upcoming month (see #59)

Happy New Year! 🎉