Recent posts

#1
Tools, Utilities / Using Creative Consoles to acc...
Last post by Kevin Kipper - January 21, 2025, 03:05:43 PM
For my final trick, I want to share another way of putting these Python scripts for Terragen at your fingertips.

On Black Friday I was seduced by an advertisement for the TourBox Elite. 

Tuorbox.jpg

I'd never really seen one before, it's basically a little box with lots of cool buttons and dials.  Each mechanical widget can be assigned to perform a specific action on a software-by-software basis.  The software for the TourBox even ships with presets for programs like Photoshop, Blender, Gimp, and many more.  It automatically detects a switch between software packages and swaps button assignments accordingly.  Apparently editors use this tool a lot, by-passing the normal keyboard and mouse workflow.  The general term for these devices is a Creative Console.

I got to thinking, wouldn't this be cool to use in Terragen.  For example, I usually work in Terragen at my monitor's full resolution on a decent sized screen and always felt a little put out when I needed to scrub through the timeline because I had to move my mouse so far across the screen.  I hoped that I could somehow use one of the dials on the Tourbox to handle this task. And it works, mostly.  I still have to click the timeline in order to focus the program on that area, but then I can use one of the dials to move the timeline to the left or right.  It's pretty cool, and I'm sure that as my muscle memory gets used to using the gizmo it will get much faster.

You can assign any existing keyboard shortcut that's been defined in a program to any button or dial on the TourBox.  Currently, I've got Terragen's Measuring tool assigned to one button, and the Animation Panel on another one.  Clicking either of those buttons immediately brings up that feature in Terragen.

Both those examples are pretty much things you can already do with the keyboard and mouse, but here's where it starts getting interesting.  You can create macros for the TourBox, and run them in sequence like you might do with Photoshop's Actions.  Of course this partially depends on the commands made available by the software package.  But, you can also make your own macro which might be as simple as creating a name for the macro and telling it to run a particular Python script that's on your hard drive.  Presto! Your Python script is now one button click away anytime you need it. 

Tourbox_Macros.jpg

But wait there's even more!  You can create menus too. 

Tourbox_TourMenu.jpg

A "TourMenu" can list all of the macros you've defined; one  for each of your Python scripts.  Then you assign the TourMenu to one of the buttons on the Tourbox.  When you press the button the menu opens up and you can use the Tourbox dials to select and run individual macros.  Basically, every script you have is now at your fingertips.  You could create a TourMenu for your Python "Utility" scripts, your Python "Cloud" scripts, etc.  or one TourMenu for all your scripts.  I'm hoping that future versions of the Tourbox software will allow a TourMenu to call another TourMenu, so you could create a sort of cascading menu system.

Tourbox_TourMenu_Cropped.jpg

Here's a link to the TourBox web site: https://www.tourboxtech.com/en/

And there you have it.  Two ways to increase your productivity workflow in Terragen by being able to access your Python scripts quicker and in one place. 
#2
Tools, Utilities / Re: Script tg_find_nodes_in_pr...
Last post by Kevin Kipper - January 21, 2025, 12:08:00 PM
Yes, the listbox of nodes will update as you type characters in the search pattern field, just like the Quick Node Palette does.
#3
Tools, Utilities / Re: Script tg_splatter_craters...
Last post by Dune - January 21, 2025, 02:27:24 AM
Don't wait for me, as I hardly ever make cratery terrains. I just like to see how it worked, and have it at hand.

One thing springs to mind regarding all your scripts: it would be perfect if they could somehow be integrated into the program itself, for even easier access. An extra button somewhere to get a popup with all your inventions/additions.
#4
Tools, Utilities / Re: Script tg_find_nodes_in_pr...
Last post by Dune - January 21, 2025, 02:22:42 AM
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?
#5
Tools, Utilities / Re: Script tg_dashboard.py
Last post by Dune - January 21, 2025, 02:15:38 AM
Interesting. I was just thinking about this yesterday; where to put a shortcut to quickly acces it. I made one (for the only script I have so far), and put it on the desktop. But I don't like any clutter there (I only have full TG renders showing off :P ), so I tried attaching it to the taskbar or startup area. But I didn't succeed thus far.
#6
Tools, Utilities / Re: Script tg_dashboard.py
Last post by Kevin Kipper - January 20, 2025, 06:24:24 PM
Also, I've just added an icon image file to the repository in the images folder just in case you want to add a shortcut to the tg_dashboard.pyw script to your desktop.  Then you just have to click once to launch the dashboard script.
#7
Tools, Utilities / Re: Script tg_dashboard.py
Last post by Kevin Kipper - January 20, 2025, 06:21:24 PM
I was thinking about making the "suite" of plugins, so there would only be one download of everything and in one folder structure.  But your suggestion would still be worthwhile and I'll look into it.
#8
Tools, Utilities / Re: Script tg_dashboard.py
Last post by Matt - January 20, 2025, 06:11:26 PM
Excellent! Could it be made to support relative path names, so your default configuration actually will work for most people as long as they put the scripts in the same folder as the dashboard, or perhaps a subfolder?
#9
Tools, Utilities / Re: Script tg_find_nodes_in_pr...
Last post by Matt - January 20, 2025, 06:08:55 PM
Fixing Terragen. I like it!
#10
Tools, Utilities / Script tg_dashboard.py
Last post by Kevin Kipper - January 20, 2025, 05:22:17 PM
The point of writing and sharing many of these Python scripts has been to automate certain repetitive tasks in Terragen, reducing them down to one or two button clicks.  There's currently seventeen scripts available on the Planetside Software Forums; and there will be more!

But how do we easily access these scripts in the first place?  Here's a teaser to where this post is heading:

tg_dashboard_gui.jpg

To start with, my computer has a folder where I put all my Terragen scripts.  Within that folder is a subfolder for each script and any supporting files.  This is nice in terms of organization, but the idea of having to navigate to the scripts folder, then the subscripts folder, then double clicking on the Python file to run it makes me tired just thinking about it.

So I made an image to use as an icon, and added a shortcut to the Python script and placed it on my desktop.  This was great, because now I could just click the icon like any other program and the script would run.  But as time went on and I added more and more icons, my desktop became cluttered and confusing.

Then I thought to myself, why not make one script that has a bunch of buttons that will run all the other scripts?  This too worked great, for a time, but I was listing each button one above the other and soon ran out of vertical real estate.

tg_desktop_launcher_stacked_version.jpg  

So I changed the layout of the UI to use tabs instead, and this brought peace of mind, at least until I decided to share the setup on the forums.

tg_desktop_launcher_tab_version.jpg

The problem is that it works fine on my system, but not necessarily anyone else's.  For example, you may or may not have a drive mapped as "P:" on your system that contains all your scripts.  And that my friends, has led to the latest incarnation of the script, in which I decided to get ChatGPT involved just for fun.

The idea behind this script is that when you run it, it will automatically create a User Interface with buttons for all your scripts.  It's based on the information you provide in a config file, which is a simple text file and can be easily edited.  Instead of reinventing the wheel for the config file, I chose to use the Tom's Obvious, Minimal Language (TOML) file format because it comes highly recommended for Python programming and works on all major operating systems.

The TOML format allows you to customize your UI.  For example, the default config file shown at the top of this post includes tabs that mirror Terragen's toolbar, plus a Utility tab.  Some of these tabs don't have any scripts yet, so to remove those tabs you can simply "comment" out that line of code in the config file using a hash "#" symbol.  That will give you a UI that looks like this:

tg_dashboard_config_no_empty_tabs.JPG

If you don't like lots of tabs, you can just as easily put all the scripts under one tab.

tg_dashboard_config_MyScripts.jpg

I admit that the layout of the config file itself isn't pretty, but on the other hand, it's not too difficult to understand either.  Let's quickly break it down so you can start customizing it for your own system (which you will need to do).  Here's a portion of the config file as an example:

[[category]]
name = "Cameras"
scripts = [
    { path = "P:/Git_Repo/tg-camera-bookmarks/tg_camera_bookmarks.py", label = "Camera Bookmarks", shortcut = "<b>" },
    { path = "P:/Git_Repo/tg-crop-region-presets/tg_crop_regions_presets.py", label = "Crop Regions", shortcut = "Shift-c" }
]

[[category]]
name = "Clouds"
scripts = [
    {path = "P:/Git_Repo/tg-add-random-cloud/tg_add_random_cloud.py", label = "Add Random Cloud", shortcut = "Control-c"}
]

You can see that each section starts with [[category]].  Use this any time you want to add something new to your UI.  In our Python script these categories will show up as tabs on the interface with the label you provide in quotes, for example "Camera" or "Clouds".

Enclosed in the scripts[] section are any scripts that you want included under this category. 

Each script and its options are enclosed within braces {}. The options include full file path, label and shortcut.

Set the path option to the full path of your script. 
The label option is used for the button name.  If you don't include this option, the Python script name is used.
The shortcut option defines a keyboard shortcut.  This is optional, but a game changer too. You can use a single key, or combinations with the Shift and Control key but NOT the ALT key.  Think of the ALT key as reserved for operating system stuff, i.e. other system programs are already using it, so it's best just to avoid that key.  When assigning a single key, enclose it within angle brackets like this "<g>", but when assigning keyboard combinations like Shift and Control, just put the combination inside quotes like this "Control-k".

When the script's UI has focus, you can use the keyboard shortcuts.  This means that your scripts are only one or two button clicks away at any time.  One click to focus the computer on the script's UI, and one click to run the script or press the keyboard shortcut.  If focus is already set to the script's UI, then you're just one click away! 

Using ChatGPT, it took about 20 iterations for me to get the script where it needed to be.  I made a few aesthetic modifications to make the UI more readable, but for the most part I left the code as it had been generated so you can read the explanatory comments that ChatGPT writes when it creates code. 

This script is one of the two ways that I know how to get your scripts closer to your fingertips, and increase productivity in Terragen.  I like it because it's free and can be customized fairly easily.  I'll be posting the other method shortly.  Until then, don't forget to smash the Like button and subscribe... oh wait, wrong venue...here's the script:
https://github.com/RedMawVFX/tg-dashboard.git