tg_go_to_frame.pyw - Sets the current frame in the Terragen project.
When first executed the Entry widget value is set to the current frame in the project.
Certain keyboard bindings can be used as shortcuts to modify the value of the Entry widget.
- Up arrow - step to next frame
- Down arrow - step to previous frame
- Escape - resets Entry widget to initial value
- MouseWheel up - steps to next frames (must press Enter key to accept)
- MouseWheel down -steps to previous frames (must press Enter key to accept)
I admit it. I've become somewhat habituated over the years to using keyboard shortcuts. Especially to advance to a particular frame number in a project or scene file of a 2D or 3D application.
So I tapped into Terragen's remote procedure call feature (RPC) and coded a short Python script that can set the project's current frame number. In keeping with the naming convention used for other scripts I've written it's called tg_go_to_frame.py.
While this version of the script is relatively simple, it does have a few features. When run, it presents a single parameter "Go to frame". By default the value is the current frame number, and this value can be retrieved at any time by pressing the "Escape" key.
As the value of the parameter changes the current frame position and the timeline are updated. If you want to go to frame 50, type in 50...you get the idea. It's best to use
integer values too.
When the script's UI has the focus, you can use the "Up arrow" and "Down arrow" keys to advance forward and backwards one frame at a time. You can even scroll up or down with the middle mouse button to quickly advance the parameter's value, but you need to press another key, like "Enter", to actually set the current frame and update the timeline.
An interesting factoid about scripts is that they'll remain running until they're explicitly closed. So you can actually leave the UI open if you want while working in Terragen. Just remember two things. First, that only the original current frame value was stored when the script was first run. Second, while the script is running it is not aware of any changes made within the Terragen UI itself, for example, changing the value of the "Current frame" parameter or scrubbing the timeline.
And that leads to some good questions like "maybe it should be aware of changes" and "what else could this script do?" Perhaps there needs to be a button to retrieve the current frame, or to store the value to the clipboard or memory? I was toying with the idea of adding a slider to the UI as an alternate way of changing the parameter value. The slider range could be limited to the start and end frames of the project file. But who knows, maybe it would be cool to be able to change the slider range values and update the project's start and end frames too. Let me know what you think.
You can download this script for absolutely free and increase your productivity by multitudes. Enjoy!
https://github.com/RedMawVFX/tg-go-to-frame.git