Script tg_find_nodes_in_project.py

Started by Kevin Kipper, January 08, 2025, 02:46:56 PM

Previous topic - Next topic

Kevin Kipper

There are occasions when it would be nice to be able to find a specific node in the active Terragen project, especially in large or complex projects.  This script does just that, and allows you to add or remove nodes from the currently selected nodes in the project.

tg_find_nodes_in_project_gui.jpg

When the script is first run the UI will present a list of all the nodes at the root level of the project. (It doesn't display nodes within the internal node network of another node). You can refine the items that are displayed in the list by entering characters in the "Search pattern" field.  Clicking the "Clear" button will clear the search pattern and redisplay all the nodes.

As I've mentioned in previous threads, these types of scripts will continue to run until closed by clicking on the Close Window button.  The "Refresh" button allows you to update the list of nodes to take into account any changes in the Terragen project while the script was left running.

You can quickly select all the nodes displayed in the list by clicking the "All" button, or deselect all the nodes displayed in the list by clicking "None". Clicking "Invert" will toggle the selection state of the displayed nodes in the list.

To add the selected nodes in the list to the currently selected nodes in the project click on the "Add to selection" button.  Similarly clicking the "Remove from selection" button deselects the nodes from the currently selected nodes in the project.

Now this version of the script works fine, but there is plenty of room for improvement and additional features.  In an earlier iteration of this idea, I had a function to step through the selected nodes, and I'm thinking that it might be nice to add that into this UI as well.  Here's an example of an earlier incarnation of the script with that feature.

tg_find_nodes_in_project_old_ui.jpg

Also, one feature I really want to include is to have the ability to center the Node Network on a selected item or items in the list.  This will require the terragen_rpc module to be updated, but when it does that feature is going in. 

What else can we add to the script?.  How about using the currently selected nodes in the Terragen project to drive the selection of the displayed nodes in the list?  That might make deselecting certain nodes quicker and easier.  How about overriding the current selection in the project with the selection from the list?  I'm still toying with the idea of a separate and simplified script that just presents a search pattern and buttons to advance to the previous or next node that matches the search pattern.  What do you think?

This script is now included with the redmaw-tg-toolkit repository.
 
Click the link below for download and installation information for the entire toolkit.
https://github.com/RedMawVFX/redmaw-tg-toolkit

Or, click the link below to go directly to the tg-find-nodes-in-project folder in the toolkit.
https://github.com/RedMawVFX/redmaw-tg-toolkit/tree/main/scripts/tg-find-nodes-in-project


Matt

Just because milk is white doesn't mean that clouds are made of milk.

Dune

This is a cool one too. I sometimes have to look hard for a node, which I know I made, know what it does. Centering it by your script would be great. But then you'd have to know the name given to that node. Mine are sometimes a bit longer descriptions, and I wouldn't be able to remember exactly what I wrote. Will one or two keywords work?

Kevin Kipper

Yes, the listbox of nodes will update as you type characters in the search pattern field, just like the Quick Node Palette does.