Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions node_to_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Node to Python",
"description": "Convert Geometry Node Groups to a Python add-on",
"author": "Brendan Parmer",
"version": (1, 2, 2),
"version": (1, 2, 4),
"blender": (3, 0, 0),
"location": "Node",
"category": "Node",
Expand Down Expand Up @@ -222,12 +222,14 @@ def process_node_group(node_group, level):
f"name = \"{node_group.name}\")\n"))
file.write("\n")

inputs_set = False

#initialize nodes
file.write(f"{inner}#initialize {ng_name} nodes\n")
for node in node_group.nodes:
if node.bl_idname == 'GeometryNodeGroup':
process_node_group(node.node_tree, level + 1)
elif node.bl_idname == 'NodeGroupInput':
elif node.bl_idname == 'NodeGroupInput' and not inputs_set:
file.write(f"{inner}#{ng_name} inputs\n")
for i, input in enumerate(node.outputs):
if input.bl_idname != "NodeSocketVirtual":
Expand Down Expand Up @@ -264,6 +266,7 @@ def process_node_group(node_group, level):
f"{socket.max_value}\n"))
file.write("\n")
file.write("\n")
inputs_set = True
elif node.bl_idname == 'NodeGroupOutput':
file.write(f"{inner}#{ng_name} outputs\n")
for output in node.inputs:
Expand Down