Game Development Community

Reproduced: Organizing images causes image datablock to be defined incorrectly

by David Helmer · in iTorque 2D · 05/08/2012 (6:00 pm) · 8 replies

I'll provide more detail later, however I should be able to describe this accurately.

When I add sub-folders to projectfiles/data/images/ i.e. projectfiles/data/images/subfolder/image.png

The datablock will set the file path to projectfiles/data/images/image.png which will show up in the editor blank.

Is there a configuration error that I've experienced or is this something iTorque 2D. With Torque 2D 1.7.5 I've been able to have a structure of folders under my images folder that has worked.

Thanks for reading!

This issue only occurs on my iMac with OS X Lion installed.

#1
05/09/2012 (1:09 am)
you would want to set the path to ~/images/image I think

In general ensure to not apply your T2D structuring, iT2D is structured quite a bit different and you need to follow its proposed folders
#2
05/09/2012 (1:22 am)
So any image you add has to be in the ~/data/images/ folder?
#3
05/09/2012 (7:00 am)
~/data/images/player/sword_pirate.png
~/data/images/enemies/lobster.png
~/data/images/environment/barrels_and_crates/crate_dark.png


You can sub categorize them into folders the above is an example of how we have our images categorized into folders inside the images folder.
#4
05/09/2012 (3:21 pm)
Great, I can't reproduce this. Weird.
#5
05/11/2012 (11:54 pm)
Ok so I have reproduced this on my Lion Mac.

I've added the image main_menu_bg.png to my level and the manage/datablocks.cs has the below in it.

Mind you the file is located at data/images/menu/main_menu_bg.png
new t2dImageMapDatablock(main_menu_bgImageMap) {
      imageName = "data/images/main_menu_bg";
      imageMode = "FULL";
      useHDImage = "0";
      frameCount = "-1";
      filterMode = "SMOOTH";
      filterPad = "1";
      preferPerf = "1";
      cellRowOrder = "1";
      cellOffsetX = "0";
      cellOffsetY = "0";
      cellStrideX = "0";
      cellStrideY = "0";
      cellCountX = "-1";
      cellCountY = "-1";
      cellWidth = "0";
      cellHeight = "0";
      preload = "1";
      allowUnload = "0";
      compressPVR = "0";
      optimised = "0";
      force16bit = "0";
   };
#6
05/12/2012 (5:34 am)
No matter where you put it folder wise when you add a new image tgb wants to make a copy and drop it in data/images its annoying we physically had to add the image in through the editor then move it to the correct folder and change the location in the datablock. another option is to physically copy and paste a working datablock in the datablocks.cs and change the location and image name to point to the correct folder.

Here is an example of one of our images

new t2dImageMapDatablock(pirate_swordImageMap) {
      imageName = "data/images/characters/pirate_sword";
      imageMode = "CELL";
      useHDImage = "0";
      frameCount = "-1";
      filterMode = "NONE";
      filterPad = "0";
      preferPerf = "1";
      cellRowOrder = "1";
      cellOffsetX = "0";
      cellOffsetY = "0";
      cellStrideX = "0";
      cellStrideY = "0";
      cellCountX = "-1";
      cellCountY = "-1";
      cellWidth = "128";
      cellHeight = "128";
      preload = "1";
      allowUnload = "0";
      compressPVR = "0";
      optimised = "0";
      force16bit = "0";
   };

this image was located in the data/image/characters folder and when we added it , tgb dropped it in data/images so we manually had to go in and edit the managed/datablocks.cs file and change the location back to the correct folder. after that it worked.
#7
05/13/2012 (4:26 pm)
Yeah I'm guessing there is something that happens that causes it to change over to this behavior.
#8
05/27/2012 (12:56 am)
Just wanted to point out that after adding the image, using "browse" will set the image path correctly.

Appears to only be an issue when adding images, not editing them.