Compare commits
1 changed files with 4 additions and 13 deletions
17
api/tree.py
17
api/tree.py
|
|
@ -163,21 +163,12 @@ def tree(name):
|
||||||
# This lets @trees be used in other @trees via simple function calls.
|
# This lets @trees be used in other @trees via simple function calls.
|
||||||
def group_reference(*args, **kwargs):
|
def group_reference(*args, **kwargs):
|
||||||
if IS_BLENDER_4:
|
if IS_BLENDER_4:
|
||||||
result = State.current_node_tree.nodes.new('GeometryNodeGroup')
|
result = geometrynodegroup(node_tree=node_group, *args, **kwargs)
|
||||||
result.node_tree = node_group
|
|
||||||
enabled_inputs = [node_input for node_input in result.inputs if node_input.enabled]
|
|
||||||
for value, node_input in zip(args, enabled_inputs):
|
|
||||||
set_or_create_link(value, node_input)
|
|
||||||
for node_input in enabled_inputs[len(args):]:
|
|
||||||
argname = node_input.name.lower().replace(' ', '_')
|
|
||||||
if argname in kwargs:
|
|
||||||
set_or_create_link(kwargs[argname], node_input)
|
|
||||||
else:
|
else:
|
||||||
result = group(node_tree=node_group, *args, **kwargs)
|
result = group(node_tree=node_group, *args, **kwargs)
|
||||||
group_outputs = []
|
group_outputs = []
|
||||||
for group_output in result.outputs:
|
for group_output in result._socket.node.outputs:
|
||||||
if group_output.enabled:
|
group_outputs.append(Type(group_output))
|
||||||
group_outputs.append(Type(group_output))
|
|
||||||
if len(group_outputs) == 1:
|
if len(group_outputs) == 1:
|
||||||
return group_outputs[0]
|
return group_outputs[0]
|
||||||
else:
|
else:
|
||||||
|
|
@ -187,4 +178,4 @@ def tree(name):
|
||||||
return build_tree
|
return build_tree
|
||||||
else:
|
else:
|
||||||
tree_name = name.__name__
|
tree_name = name.__name__
|
||||||
return build_tree(name)
|
return build_tree(name)
|
||||||
Reference in a new issue