Script: node_network_layout.py

Started by Kevin Kipper, August 22, 2025, 12:42:56 AM

Previous topic - Next topic

Kevin Kipper

When adding a new node to a Terragen project via the Remote Procedure Call (RPC) feature, the default behavior is to position the new node at the current center of the Node Network view.  This can result in nodes overlapping or stacking on top of each other, especially when a script creates many nodes at once.

Blog_NodePlacement_02_RPC_Nodes_Centered.jpg

There's a new Python script in the commons folder of the Redmaw TG Toolkit called node_network_layout.py that attempts to position a newly created node in the UI without overlapping another node.  The script is not run by itself, rather it's imported into your script and called right after creating a new node and setting its parameters.

Here's an example of how the newly added nodes to the project were positioned in the Node Network view using the script.

Blog_NodePlacement_03_RPC_Nodes_Refreshed.jpg

We've written a blog post about using this script which you'll find here.
https://planetside.co.uk/blog/node-placement-via-rpc/

To download the Redmaw TG Toolkit, click here.
https://github.com/RedMawVFX/redmaw-tg-toolkit.git