Skip to content

Commit 2b9cb73

Browse files
tweak docs for positions
1 parent 902ec9f commit 2b9cb73

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

docs/nodes-to-code.qmd

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,20 +195,32 @@ By default the generated code lets `nodebpy` lay the tree out automatically when
195195
Pass `snapshot_positions=True` to instead capture each node's authored `location` and restore it, so the rebuilt tree matches the original layout.
196196
The tree is built with `arrange=None` (auto-layout off) and a `tree.node_positions = {...}` mapping is appended:
197197

198+
::: {.panel-tabset}
199+
## Hand-written
200+
198201
```{python}
199-
with TreeBuilder("Wave Deform", arrange=None) as tree:
202+
with TreeBuilder("Wave Deform") as tree:
200203
geo = tree.inputs.geometry("Geometry")
201204
out = tree.outputs.geometry("Geometry")
202205
geo >> g.SetPosition(offset=g.CombineXYZ(z=g.Position().o.position.x)) >> out
206+
```
203207

208+
## Generated code
209+
````{python}
204210
code = tree.to_python(snapshot_positions=True)
205-
```
211+
````
206212

207213
```{python}
208214
#| echo: false
209215
#| output: asis
210216
print(f"```python\n{code}\n```")
211217
```
218+
:::
219+
220+
```{python}
221+
#| echo: false
222+
tree
223+
```
212224

213225
Positions are applied by name, so a node a rebuild does not recreate (a reroute) or renames is skipped rather than erroring.
214226
Positions inside nested groups are preserved too.

0 commit comments

Comments
 (0)