TreeBuilder
TreeBuilder(
tree='Geometry Nodes',
*,
tree_type='GeometryNodeTree',
collapse=False,
arrange='sugiyama',
fake_user=False,
ignore_visibility=False,
)Builder for creating Blender node trees with a clean Python API.
Supports geometry, shader, and compositor node trees.
Attributes
| Name | Description |
|---|---|
collapse |
|
fake_user |
|
ignore_visibility |
|
inputs |
|
node_positions |
A {node name: (x, y)} snapshot of every node’s location. |
nodes |
|
outputs |
|
tree |
Methods
| Name | Description |
|---|---|
| activate_tree | Make this tree the active tree for all new node creation. |
| add | |
| arrange | |
| compositor | Create a compositor node tree. |
| deactivate_tree | Whatever tree was previously active is set to be the active one (or None if no previously active tree). |
| disable_arrange | Disable the auto-layout that otherwise runs when this tree’s context |
| geometry | Create a geometry node tree. |
| link | |
| shader | Create a shader node tree. |
| to_mermaid | Generate a Mermaid diagram that represents this tree. |
| to_python | Generate Python source that recreates this tree using nodebpy. |
activate_tree
activate_tree()Make this tree the active tree for all new node creation.
add
add(name)arrange
arrange()compositor
compositor(
name='Compositor Nodes',
*,
collapse=False,
arrange='sugiyama',
fake_user=False,
)Create a compositor node tree.
deactivate_tree
deactivate_tree()Whatever tree was previously active is set to be the active one (or None if no previously active tree).
disable_arrange
disable_arrange()Disable the auto-layout that otherwise runs when this tree’s context exits, so explicitly assigned node locations are preserved.
geometry
geometry(
name='Geometry Nodes',
*,
collapse=False,
arrange='sugiyama',
fake_user=False,
)Create a geometry node tree.
link
link(socket1, socket2)shader
shader(
name='Shader Nodes',
*,
collapse=False,
arrange='sugiyama',
fake_user=False,
)Create a shader node tree.
to_mermaid
to_mermaid(fenced=True)Generate a Mermaid diagram that represents this tree.
This can be used for documentation or visualization purposes. The Mermaid syntax is supported by many tools, including GitHub and Jupyter notebooks.
Arguments
fenced:
Whether to wrap the output in a fenced code block with mermaid syntax highlighting.
Returns
| Name | Type | Description |
|---|---|---|
| A string containing the Mermaid diagram syntax representing this node tree. |
to_python
to_python(
min_chain_length=3,
strict=True,
max_inline_width=88,
snapshot_positions=False,
keep_reroutes=False,
top_level='with',
format=True,
)Generate Python source that recreates this tree using nodebpy.
See :func:nodebpy.codegen.to_python for parameter details.