Second Life Terrain Import and Export for The Gimp

Domino Marama's picture

Introduction

This python script allows the loading and saving of raw terrain files for Second Life® sims in The Gimp.

Installation

copy the file_slraw.py file to your Gimp plug-ins directory. Linux users should give it execute permissions.

Loading a raw file

If you have installed other raw file type handlers then automatic detection of the file type may not work. You must then select 'Second Life Terrain' manually. If gimpterrain is the only raw handler, you should just be able to select the file as normal.

Second Life Terrain Import in The Gimp

Saving a raw file

If gimpterrain is the only raw file type handler you can just add a .raw extension to the filename. If you have another raw handler then just putting .raw as the extension is not enough as there are different types of .raw file. You'll need to select "Second Life Terrain" as the file type.


Comments

I'm trying the script in Win7 and I'm not getting it to work.  I've checked that I'm using the right folder according to the Plug-Ins preferences.  I have Python 2.6.4 installed.  Is there anything additional I need to do?  The Terrain raw file type just never appears... (._.)

 

 

I want to firstly thank you for excellent tutorials (Blender) and for the tools you produce for download. Your site has enriched my SL experience considerably, so thank you again.

My only battle at the moment has been to get GIMP 2.6.6 to 'see' the plug-in, file_slraw.py, when it starts up. I run Windows Vista (shame, I know) and GIMP has not been able to see the Second Life RAW plug-in at all, even though I have now copied it to both GIMP locations on my drive - C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins - and - C:\Users\***USER***\.gimp-2.6\plug-ins.

Any ideas about what I am doing wrong?  I do notice that there are no Python files in GIMP folders at all, and wonder if I need to use import or something somewhere, after I simply copied it to these two locations (first the one, tested, no luck, then the other location, again, no luck).

Thank you in advance,

Johan

Hi, on Windows XP, Blender 2.49b, I copied the file_slraw.py in the folder "C:\Program Files\Blender Foundation\Blender\.blender\scripts"

and I launch Blender. No new entries are visible in the file import or export menus.

In the UV/Image editor, the "image open" menu don't show your dialog box. The "reset python modules search path" button does nothing. Could you say what is wrong in my installation ? Thank you !

Alain

Domino Marama's picture

Ermm... This is a script for The Gimp not Blender. It should be placed in C:\Document and Settings\<username>\.gimp-<version>\plug-ins\

I can't seem to access the interface to create a new issue, I get a Redirection error.

So, instead, I'll try reporting my bug here.  In gimp 2.6.6 on fedora 11 (i586), your script only works the first time I load gimp.  On second and subsequent loads, the 'Second Life Terrain' is not listed amongst the file types available.  A crude workaround is to 'touch ~/.gimp-2.6/plug-ins/file_slraw.py' before loading gimp.

I have fixed the issue, here's a patch; it may not be directly apply-able, since the pre tag isn't preserving whitespace as I would expect:

--- a/file_slraw.py      2009-08-20 14:31:08.799949945 -0400
+++ b/file_slraw.py    2009-08-21 14:19:20.786770540 -0400
@@ -102,7 +102,7 @@
        "Domino Designs Limited",
        "2008",
        "Second Life Terrain",
-       "GRAY", 
+       "", 
        [ 
                (PF_STRING, "filename", "File Name",""), 
                (PF_STRING, "raw-filename", "raw file name", "")

 

Since RAW files are already grayscale, this change doesn't actually hurt anything, and it clears up both the weird startup message ("file-slraw-load doesn't take the standard save handler parameters") and allows the script to work on successive starts of the gimp.

Thanks for the excellent tools Smile

Domino Marama's picture

You can avoid the redirection error by using the "Create new Issue" link on the Project's issue page.

There's an issue for this now, I've updated the download with the fix. Thanks for sending it, finding information on writing file open and save scripts in Python was virtually impossible and I didn't know what was wrong.

Another note - automatic detection works for me, both on load and save.  This is the only file type gimp is associating with .raw.  This may have something to do with the exact set of load/save handlers bundled with gimp in fedora, or it may be related to the gimp version (2.6.6)

Domino Marama's picture

I probably installed every raw file handler I could find before writing my own, so I've updated the instructions to reflect the two experiences. Thanks for the help Smile