Can't seem to make a valid linked image map
by Stephen Triche · in Torque Game Builder · 06/11/2008 (8:58 am) · 8 replies
I'm trying to create a linked image map, but either the documention on TDN for doing so is incomplete, or they just don't work.
linkedImageMap is always invalid, linkedIMageMap.getFrameCount() evaluates to 0 rather than 3, and setting frameCount to an incorrect number in the linkedImageMap definition is not throwing a warning to the console.
new t2dImageMapDatablock(imagemap1) {
imageName = "~/path/image1";
imageMode = "FULL";
filterMode = "SMOOTH";
filterPad = "1";
preferPerf = "1";
};
new t2dImageMapDatablock(imagemap2) {
imageName = "~/path/image2";
imageMode = "FULL";
filterMode = "SMOOTH";
filterPad = "1";
preferPerf = "1";
};
new t2dImageMapDatablock(imagemap3) {
imageName = "~/path/image3";
imageMode = "FULL";
filterMode = "SMOOTH";
filterPad = "1";
preferPerf = "1";
};
new t2dImageMapDatablock(linkedImageMap) {
imageMode = "LINK";
linkImageMaps = "imagemap1" SPC "imagemap2" SPC "imagemap3";
frameCount = 17;
};linkedImageMap is always invalid, linkedIMageMap.getFrameCount() evaluates to 0 rather than 3, and setting frameCount to an incorrect number in the linkedImageMap definition is not throwing a warning to the console.
#2
The doucment you wrote is, in fact, the one I read to learn more about linked image maps. However
This is creating a datablock with a getFrameCount() of 0 and a getIsValid() of false. Imagemaps 1-3 are all valid and work fine.
I added the incorrect frameCount assignment to illustrate that it is also, apparently, ignoring this as well. If I add an incorrect frameCount assignment to a non-linked datablock the console throws errors as expected. However, when I added it to the linked image map it did not complain.
I suppose it's possible something we've changed in the engine is the culprit, but I've checked t2dImageMapDatablock.h and t2dImageMapDatablock.cc and the only change we've made is the addition of a new console function that's not even being used.
06/12/2008 (2:22 pm)
Hey Melv, thanks for the response.The doucment you wrote is, in fact, the one I read to learn more about linked image maps. However
new t2dImageMapDatablock(linkedImageMap)
{
imageMode = "LINK";
linkImageMaps = "imagemap1" SPC "imagemap2" SPC "imagemap3";
}; This is creating a datablock with a getFrameCount() of 0 and a getIsValid() of false. Imagemaps 1-3 are all valid and work fine.
I added the incorrect frameCount assignment to illustrate that it is also, apparently, ignoring this as well. If I add an incorrect frameCount assignment to a non-linked datablock the console throws errors as expected. However, when I added it to the linked image map it did not complain.
I suppose it's possible something we've changed in the engine is the culprit, but I've checked t2dImageMapDatablock.h and t2dImageMapDatablock.cc and the only change we've made is the addition of a new console function that's not even being used.
#3
melv (dot) may [at] gmail |.| com
Melv.
06/12/2008 (11:34 pm)
Hmm, very odd. Could you send me the associated images for this setup in case they are the source of the issue somehow?melv (dot) may [at] gmail |.| com
Melv.
#4
This has been fixed in the pending release. If you have the source-code I would be glad to email you the required modification.
Please note that due to this not being posted in the private forums I cannot post it here. For the future, you might want to post issues in the private forums; you'll definately get a quicker turn-around there. :)
Thanks for the bug report!
Melv.
06/17/2008 (1:39 am)
Stephen,This has been fixed in the pending release. If you have the source-code I would be glad to email you the required modification.
Please note that due to this not being posted in the private forums I cannot post it here. For the future, you might want to post issues in the private forums; you'll definately get a quicker turn-around there. :)
Thanks for the bug report!
Melv.
#6
For each separate image, try adding "preload = "1";"
If I remember well, this is needed for the linked image to work at all.
Then, for the linked image itself, do it this way:
06/23/2008 (8:58 pm)
Strange... I have no trouble using a lot of linked images.For each separate image, try adding "preload = "1";"
If I remember well, this is needed for the linked image to work at all.
Then, for the linked image itself, do it this way:
new t2dImageMapDatablock(linkedImageMap)
{
imageName = "~/managed/";
imageMode = "LINK";
frameCount = "-1";
linkImageMaps = "imagemap1 imagemap2 imagemap3";
};I cant try right now, but I think it is either "imageName = "~/managed/";" that was necessary, or the presence of "SPC" in the linkImageMaps field that was troublesome. Maybe you also need to activate preload on the linked image.
#7
It was the check for the "imageName" which is supposed to be the source art file. There was a check added (at some point by someone) to check that the name is valid. Unfortunately, this field is not required when the mode is "LINK". This meant that if you don't specify the "imageName" field, the image-map doesn't work.
You are spot on though; just specify anything in there for a "LINK" mode image-map and it will work. I've modified the source so that you won't need to do that as of the next release.
Melv.
06/24/2008 (11:12 am)
Benjamin,It was the check for the "imageName" which is supposed to be the source art file. There was a check added (at some point by someone) to check that the name is valid. Unfortunately, this field is not required when the mode is "LINK". This meant that if you don't specify the "imageName" field, the image-map doesn't work.
You are spot on though; just specify anything in there for a "LINK" mode image-map and it will work. I've modified the source so that you won't need to do that as of the next release.
Melv.
#8
It seems my problem was two fold.
1) The datablocks being created weren't valid because of the check for the source art file Melv mentioned above.
2)Even with a valid linked image Map I couldn't seem to make static or animated sprites out of it. Setting preload to true on the image maps being linked has solved the problem.
Thanks Melv and Ben!
06/24/2008 (11:33 am)
Problem solved! Thanks to both of you guys.It seems my problem was two fold.
1) The datablocks being created weren't valid because of the check for the source art file Melv mentioned above.
2)Even with a valid linked image Map I couldn't seem to make static or animated sprites out of it. Setting preload to true on the image maps being linked has solved the problem.
Thanks Melv and Ben!
Associate Melv May
From what I can see the problem is that you expect three frames from the combined image-maps (3 x full-frame image-maps) but you've told it to expect 17.
I just tried that here and I get the warning...
... in the console.
Of course it will fail if you get any errors for imageMap1/2/3.
It won't affect the results but it will ignore "filterPad = 1" if you use the FULL image-mode as it's not needed.
Also, I don't know what documentation you're looking at specifically but the document I wrote a long time ago here goes into great detail about it with pictures and everything. I found it by typing "imagemaps" in TDN (third entry down).
Hope this helps,
Melv.