Open Syndaryl opened 8 months ago
Creating a script to calculate theta=atan2(Input[y],Input[x]),phi=acos(input[z])
produces
Python: Traceback (most recent call last):
File "C:\Users\Owner\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\expression-nodes.py", line 158, in execute
self.parse_expressions(scene.custom_expression_nodes_props)
File "C:\Users\Owner\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\expression-nodes.py", line 148, in parse_expressions
module = ast.parse(props.expression)
File "D:\Blender\stable\blender-4.0.0-windows-x64\4.0\python\lib\ast.py", line 50, in parse
return compile(source, filename, mode, flags,
File "<unknown>", line 1
theta=atan2(Input[y],Input[x]),phi=acos(input[z])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
In this case, the same error is output to console.
Just inputting atan2(Input[y],Input[x])
produces:
Python: Traceback (most recent call last):
File "C:\Users\Owner\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\expression-nodes.py", line 158, in execute
self.parse_expressions(scene.custom_expression_nodes_props)
File "C:\Users\Owner\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\expression-nodes.py", line 150, in parse_expressions
root = self.create_nodes(expression.value, self.init_position)
File "C:\Users\Owner\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\expression-nodes.py", line 145, in create_nodes
return creator(value, location)
File "C:\Users\Owner\AppData\Roaming\Blender Foundation\Blender\4.0\scripts\addons\expression-nodes.py", line 115, in create_call
self.node_tree.links.new(node.inputs[idx], arg.outputs[0])
AttributeError: 'NoneType' object has no attribute 'outputs'
Hi. Thanks for reporting these issues - I've not had time recently to keep up with this and so hadn't tried it against the latest release. I'll have a look when I get the chance and see if I can spot the issue. Presumably Blender 4.0 has some API changes that have caused the problems; I did manage to test it on 3.6 and that seems to be OK.... I'll let you know what I find and when an update is available.
No problem, 4.0 is a pretty big release and there's been a lot of work in and around Geometry Nodes. In particular the way node groups inputs and outputs are wrangled has definitely changed quite a bit in the GUI, so there's probably related changes under the hood.
I use the addon pretty extensively in 3.6 and haven't had any issues, so it's something that's shifted for 4.0
Ignoring the parsing error above the culprit seems to be the code working on a the node tree instead of the group object:
D.materials['Material'].node_tree.nodes[9].bl_idname # 'ShaderNodeGroup'
D.materials['Material'].node_tree.nodes[9].node_tree.bl_idname # 'ShaderNodeTree'
The group does have outputs collection while the node_tree associated to it does not (probably because it can be the root tree too).
Going into the tree from the group node is as shown above pretty straightforward, the other way around probably requires various changes that at the moment I don't have time to contribute, in case this changes I'll let you know
Dynamic Maths Expressions (Paid version) hasn't survived the change to 4.0 unscathed. If I try to create an instance of the Test script, it creates an empty geometry group with no inputs or outputs, and the status bar shows the following error:
Build of node tree failed : 'GeometryNodeTree' object has no attribute 'outputs'
while the console shows
various errors occur with other use cases as well.