T2dImageMapDatablock
by Odiel · in Torque Game Builder · 11/04/2008 (11:53 am) · 4 replies
Hi guys,
how i load many *.PNGs files to build one t2dImageMapDatablock by script...
from this:
new t2dImageMapDatablock(manzanaImageMap0) {
imageName = "~/data/images/dolphin/manzana_movi0000.png";
imageMode = "FULL";
frameCount = "-1";
filterMode = "SMOOTH";
filterPad = "0";
preferPerf = "1";
cellRowOrder = "1";
cellOffsetX = "0";
cellOffsetY = "0";
cellStrideX = "0";
cellStrideY = "0";
cellCountX = "-1";
cellCountY = "-1";
cellWidth = "0";
cellHeight = "0";
preload = "1";
allowUnload = "0";
};
new t2dImageMapDatablock(manzanaImageMap1) {
imageName = "~/data/images/dolphin/manzana_movi0001.png";
imageMode = "FULL";
frameCount = "-1";
filterMode = "SMOOTH";
filterPad = "0";
preferPerf = "1";
cellRowOrder = "1";
cellOffsetX = "0";
cellOffsetY = "0";
cellStrideX = "0";
cellStrideY = "0";
cellCountX = "-1";
cellCountY = "-1";
cellWidth = "0";
cellHeight = "0";
preload = "1";
allowUnload = "0";
};
new t2dImageMapDatablock(manzanaImageMap2) {
imageName = "~/data/images/dolphin/manzana_movi0002.png";
imageMode = "FULL";
frameCount = "-1";
filterMode = "SMOOTH";
filterPad = "0";
preferPerf = "1";
cellRowOrder = "1";
cellOffsetX = "0";
cellOffsetY = "0";
cellStrideX = "0";
cellStrideY = "0";
cellCountX = "-1";
cellCountY = "-1";
cellWidth = "0";
cellHeight = "0";
preload = "1";
allowUnload = "0";
};
.
.
. ...etc
//to build the LINK image mode in ImageMapDatablock
new t2dImageMapDatablock(manzanaAllImageMap) {
imageMode = "LINK";
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";
linkImageMaps = "manzanaImageMap0 manzanaImageMap1 manzanaImageMap2 .....";
preload = "1";
allowUnload = "0";
};
//and them the t2dAnimationDatablock:
new t2dAnimationDatablock(manzanaAnimation) {
imageMap = "manzanaAllImageMap";
animationFrames = "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15";
animationTime = "1";
animationCycle = "1";
randomStart = "0";
startFrame = "0";
};
saluti...
how i load many *.PNGs files to build one t2dImageMapDatablock by script...
from this:
new t2dImageMapDatablock(manzanaImageMap0) {
imageName = "~/data/images/dolphin/manzana_movi0000.png";
imageMode = "FULL";
frameCount = "-1";
filterMode = "SMOOTH";
filterPad = "0";
preferPerf = "1";
cellRowOrder = "1";
cellOffsetX = "0";
cellOffsetY = "0";
cellStrideX = "0";
cellStrideY = "0";
cellCountX = "-1";
cellCountY = "-1";
cellWidth = "0";
cellHeight = "0";
preload = "1";
allowUnload = "0";
};
new t2dImageMapDatablock(manzanaImageMap1) {
imageName = "~/data/images/dolphin/manzana_movi0001.png";
imageMode = "FULL";
frameCount = "-1";
filterMode = "SMOOTH";
filterPad = "0";
preferPerf = "1";
cellRowOrder = "1";
cellOffsetX = "0";
cellOffsetY = "0";
cellStrideX = "0";
cellStrideY = "0";
cellCountX = "-1";
cellCountY = "-1";
cellWidth = "0";
cellHeight = "0";
preload = "1";
allowUnload = "0";
};
new t2dImageMapDatablock(manzanaImageMap2) {
imageName = "~/data/images/dolphin/manzana_movi0002.png";
imageMode = "FULL";
frameCount = "-1";
filterMode = "SMOOTH";
filterPad = "0";
preferPerf = "1";
cellRowOrder = "1";
cellOffsetX = "0";
cellOffsetY = "0";
cellStrideX = "0";
cellStrideY = "0";
cellCountX = "-1";
cellCountY = "-1";
cellWidth = "0";
cellHeight = "0";
preload = "1";
allowUnload = "0";
};
.
.
. ...etc
//to build the LINK image mode in ImageMapDatablock
new t2dImageMapDatablock(manzanaAllImageMap) {
imageMode = "LINK";
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";
linkImageMaps = "manzanaImageMap0 manzanaImageMap1 manzanaImageMap2 .....";
preload = "1";
allowUnload = "0";
};
//and them the t2dAnimationDatablock:
new t2dAnimationDatablock(manzanaAnimation) {
imageMap = "manzanaAllImageMap";
animationFrames = "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15";
animationTime = "1";
animationCycle = "1";
randomStart = "0";
startFrame = "0";
};
saluti...
About the author
#2
11/04/2008 (2:46 pm)
Thanks man, it's work....!!!!!
#3
Did you have to change any of that code, or did you just copy and paste and it worked without fixing anything?
actually, I see you might have needed to mod the number of 0's in the file name as it starts at 0000 and would go to 0009 then 0010 (only two 0's instead of 3). The code I gave you wouldn't provide that - it'd put 00010 instead. However, you've got it working, probably by renaming some files, so I guess that was the goal.
11/04/2008 (7:28 pm)
Glad to hear it :)Did you have to change any of that code, or did you just copy and paste and it worked without fixing anything?
actually, I see you might have needed to mod the number of 0's in the file name as it starts at 0000 and would go to 0009 then 0010 (only two 0's instead of 3). The code I gave you wouldn't provide that - it'd put 00010 instead. However, you've got it working, probably by renaming some files, so I guess that was the goal.
#4
11/07/2008 (2:55 pm)
Yes Shaz i rename the files from manzana_movi000X to manzana_moviX and works fine....!!!!
Torque Owner Shaz
%links = ""; %frames = ""; for (%img = 0; %img <= 15; %img++) { // check the syntax here - might need to be reformatted // create a new image map new t2dImageMapDatablock(manzanaImageMap @ %img) { imageName = "~/data/images/dolphin/manzana_movi000" @ %img @ ".png"; imageMode = "FULL"; frameCount = "-1"; filterMode = "SMOOTH"; filterPad = "0"; preferPerf = "1"; cellRowOrder = "1"; cellOffsetX = "0"; cellOffsetY = "0"; cellStrideX = "0"; cellStrideY = "0"; cellCountX = "-1"; cellCountY = "-1"; cellWidth = "0"; cellHeight = "0"; preload = "1"; allowUnload = "0"; }; // update links and frames // check the syntax here - I'm pretty sure what's below won't work properly (will keep resetting // %links and %frames, but you might be able to use some kind of 'setWord' function instead %links = %links SPC manzanaImageMap @ %img; %frames = %frames SPC %img; } //to build the LINK image mode in ImageMapDatablock new t2dImageMapDatablock(manzanaAllImageMap) { imageMode = "LINK"; 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"; linkImageMaps = %links; preload = "1"; allowUnload = "0"; }; //and them the t2dAnimationDatablock: new t2dAnimationDatablock(manzanaAnimation) { imageMap = "manzanaAllImageMap"; animationFrames = %frames; animationTime = "1"; animationCycle = "1"; randomStart = "0"; startFrame = "0"; };