Game Development Community

Terrain Texture Preview

by Tim Heldna · in Torque Game Engine · 08/28/2006 (7:26 am) · 8 replies

I have a lot of terrain textures and I hate the fact you can't preview a terrain texture prior to opening it.

I have taken this resource and adapted it to TGE 1.4.

Installation is easy:

- Download TerrainPreview.zip

- Add the two files from that zip to example\common\ui

- Open example\common\client\canvas.cs and add this:

Approx line 36
// Common GUI's
   exec("~/ui/ConsoleDlg.gui");
   exec("~/ui/LoadFileDlg.gui");
   exec("~/ui/TELoadFileDlg.gui");//added for terrain tex preview

- Open example\creator\editor\EditorGui.cs and modify the following two functions to look like this:

Approx line 842
function ETerrainEditor::changeMaterial(%this, %matIndex)
{
   EPainter.matIndex = %matIndex;
   //getLoadFilename("*.png\t*.jpg", EPainterChangeMat);
   TEgetLoadFilename("*.png\t*.jpg", EPainterChangeMat);//added for terrain tex preview
}
Approx line 1638
function Texture::addMaterialTexture()
{
   %root = filePath(terrain.terrainFile);
   //getLoadFilename("*.png\t*.jpg", addLoadedMaterial);
   TEgetLoadFilename("*.png\t*.jpg", addLoadedMaterial);//added for terrain tex preview
}

Enjoy!

i5.photobucket.com/albums/y189/fjs/terrainPreview.jpg

#1
08/28/2006 (8:01 am)
Thanks very nice. Drop in with no problems. Work perfectly.
#2
08/28/2006 (9:00 am)
Well done! Gonna have to give this a spin. Would be very useful.
#3
08/28/2006 (10:18 am)
Is this script only?
#4
08/28/2006 (10:31 am)
Yes. Script only. That's why I posted it in the public section so everyone can benefit.
#5
08/28/2006 (11:50 am)
Super cool! Thx Tim...

--Mike
#6
08/28/2006 (12:42 pm)
Wow thanks! great work Tim!
#7
08/28/2006 (12:59 pm)
If you really wanted to you could modify this so that all Open File... dialogs display a preview texture. I.e. scrolling through GUI bitmaps and the like. Maybe I need to submit a resource.
#8
11/15/2006 (2:22 pm)
^^ That would be insanely help full, and i don't know why it dosn't already do this.