T2D Image Datablock Tool 1.2
by Chris Newman · 04/02/2005 (9:14 pm) · 7 comments
Download Code File

After using Torque 2D for a bit, I thought that it was getting repetitive typing all those datablocks for images. So I started work on a small tool to take care of this task for me.
This is version 1.2.
Unzip it to your T2D dir and edit the .bat file if you renamed the T2D.exe file.
To use it:
Make sure your game runs when you click on T2D.exe or have it listed as a mod in main.cs.
Either Start a new project or load an existing one.
Steps to start a new project:
1. Open the dir that you have all your images in.
2. Select an image, then edit its properties on the right.
3. Click "Save Image Info" button.
4. Repeat for each image (except for the full type because it is the default)
5. Press "Save to Script" button and choose where you want to save the script file
6. Add the script file to your game using the exec() function
7. Enjoy your time from not typing all these datablocks out. :)
Steps to load an existing project.
1. Load the script file you saved earlier.
2. If you added new images into your image dir, click the "Find New Images" button
3. Edit the properties of the new images and/or old ones.
4. Save the properties and the script file.
Let me know of any bugs and feature requests.
I'm open to suggestions on how to improve this tool further, especially the GUI.
*New to version 1.2
I updated the Image Preview function.
It now uses a T2D object and it can now show the image size and properly scales the images for preview.
If an image is 32 x 32, 512 x 512 etc... it will scale it to 256 x 256.
If the image is 256 x 512 it will scale it to 128 x 256. etc...
I used to use a guiBitmapControl and the best it could do was stretch and shrink the image to 200 x 200.

After using Torque 2D for a bit, I thought that it was getting repetitive typing all those datablocks for images. So I started work on a small tool to take care of this task for me.
This is version 1.2.
Unzip it to your T2D dir and edit the .bat file if you renamed the T2D.exe file.
To use it:
Make sure your game runs when you click on T2D.exe or have it listed as a mod in main.cs.
Either Start a new project or load an existing one.
Steps to start a new project:
1. Open the dir that you have all your images in.
2. Select an image, then edit its properties on the right.
3. Click "Save Image Info" button.
4. Repeat for each image (except for the full type because it is the default)
5. Press "Save to Script" button and choose where you want to save the script file
6. Add the script file to your game using the exec() function
7. Enjoy your time from not typing all these datablocks out. :)
Steps to load an existing project.
1. Load the script file you saved earlier.
2. If you added new images into your image dir, click the "Find New Images" button
3. Edit the properties of the new images and/or old ones.
4. Save the properties and the script file.
Let me know of any bugs and feature requests.
I'm open to suggestions on how to improve this tool further, especially the GUI.
*New to version 1.2
I updated the Image Preview function.
It now uses a T2D object and it can now show the image size and properly scales the images for preview.
If an image is 32 x 32, 512 x 512 etc... it will scale it to 256 x 256.
If the image is 256 x 512 it will scale it to 128 x 256. etc...
I used to use a guiBitmapControl and the best it could do was stretch and shrink the image to 200 x 200.
About the author
#2
04/26/2005 (3:53 am)
excellent stuff :D
#3
Nice work, btw.
07/16/2005 (12:42 pm)
How do you control what goes in the directory list? It comes up with the all of the folders except the fish demo, the space scroller, and the folder that I've created to start my project in. How do I add to the folders that it lists?Nice work, btw.
#4
You can set your game as the default game and it will see your game files, or you can increase the mod count by 1 and add your mod in like below. Names listed below are examples.
07/16/2005 (4:31 pm)
It cannot see any mods that are not listed in the main.cs file.You can set your game as the default game and it will see your game files, or you can increase the mod count by 1 and add your mod in like below. Names listed below are examples.
$runWithEditors = true; $modcount = 2; $defaultGame = "Tactics"; $userMods = "yourmodhere;" @ $defaultGame; $displayHelp = false;
#5
07/16/2005 (5:03 pm)
Fantastic! Thanks, that worked just fine :)
#7
I did wind up just using it as a dummy file and cutting and pasting into my target files, though. That's because I'm separating out player, enemy, and world datablocks for simplicity's sake. One thing I noticed, but admit I didn't test out, is that it added my sequential numbered files in decending order (5, 4, 3, 2, 1) and I would have preferred them in ascending order. It wasn't a huge deal since I was cutting and pasting, and I confess to being somewhat formatting / odering obsessed.
The other thing that I stumbled across is sort of related to the mods being in the main.cs issue. I ran the utility once, realized I couldn't browse to my folder, and then just moved my temp image folder into the T2D tree. The final file listed the full path, instead of what I have been considering the 'standard pathless' format of ~client/images/your_image. Again, I'm a bad user, I didn't test it out further. Frankly, it worked, and I'm one of those artists that's used to just accepting how something works, and being grateful that it saved me some time and tedious input.
Which it did, and I am thankful to you for making it available to us!
- Don
11/27/2005 (6:17 pm)
I used this for the first time just the other day, and was pleased with the results! I did wind up just using it as a dummy file and cutting and pasting into my target files, though. That's because I'm separating out player, enemy, and world datablocks for simplicity's sake. One thing I noticed, but admit I didn't test out, is that it added my sequential numbered files in decending order (5, 4, 3, 2, 1) and I would have preferred them in ascending order. It wasn't a huge deal since I was cutting and pasting, and I confess to being somewhat formatting / odering obsessed.
The other thing that I stumbled across is sort of related to the mods being in the main.cs issue. I ran the utility once, realized I couldn't browse to my folder, and then just moved my temp image folder into the T2D tree. The final file listed the full path, instead of what I have been considering the 'standard pathless' format of ~client/images/your_image. Again, I'm a bad user, I didn't test it out further. Frankly, it worked, and I'm one of those artists that's used to just accepting how something works, and being grateful that it saved me some time and tedious input.
Which it did, and I am thankful to you for making it available to us!
- Don

Torque 3D Owner Matthew Langley
Torque