Monday, November 3, 2014

Scripting GIMP to speed kitbashing

I had always been meaning to learn how to script GIMP, and I finally broke down and did enough searching on the web to figure out the bits that were holding me back. So, now I'm trying to take notes as I work on kitbashes so that I can build up a best practices document and a set of scripts that will streamline the process of creating kitbash artifacts.

So far, I've got a simple script that will walk layers given some naming convention and it will generate all of the anchors for me.You can grab it here, though I won't promise this link will last forever:

EDIT: I've removed the old files. Check out more recent posts - I converted the scripts to an actual plugin.


This script assumes:
1) There are at least two top-level groups. The first is for anchors, the second is for tiles.
2) The anchors are formatted using a template crafted from The Garden.
3) All of the layers containing tile textures to make anchors for - and ONLY those layers - begin with "Tile "
4) The placement of the 6" tile textures follow the positioning from TLX templates.

As a best practice, my layers start like this:

 + Anchors
     . Annotated Tile Textures
 + 6" Tiles
     . 6" Anchor Spots
     . 6" Tile Template
     . Grid - 1" - Tile 1
     . Grid - 1.5" - Tile 1
     . Tile 1
     . ...
 . Kitbash Base


When I work, there is typically one file that is my work area. It has all the bits for all the layers
broken apart so I can arrange things as I like. I then take 1800px by 1800px images and paste them into
"Tile " layers in my staging file. This staging file is where I run the script that will generate the
anchors.

To run the script, first save your work! The script shouldn't save any changes, so if it messes things up completely, you won't have lost anything. You can then paste the contents of the script into the Python-Fu console. From the Filters menu, select Python-Fu > Console.  In the console window, paste the script and hit enter a couple times (twice I think). That'll get the script running, and it'll start hopping around like mad copying all the bits and pieces.

This was my first script. I plan on enhancing it a lot, and I plan on publishing it as a full-blown plug-in for GIMP, so eventually you'll have nice menus to pick from and you won't have to even see the script or console. But, if you're an early adopter, or you want to learn some GIMP scripting, here's a starting point.

No comments:

Post a Comment