View Full Version : Trying to create a material with a jpg sequence bitmap in diffuse
I'm writing a script and got stuck trying to create a material with an image sequence.
When I create one manually, when I select the JPG it gives me a checkbox to determine if it's going to be a sequence or not, and then the following pop-up asks me start and end frame information. However when it's done the only code it spits out is for assigning the bitmap, but it doesn't setup the sequence. If I run the script, it simply assigns it as a regular bitmap material and doesn't change when you change the frame.
meditMaterials.diffuseMap = Bitmaptexture fileName:jpgPath
The first time I create an image sequence manually it creates an IFL file in the same folder. If I load that file with my script instead of the JPG, the sequence works and the material image changes with each frame. But I can't get an IFL until I create a sequence initially. So, I either need a way to create the IFL, or find a work-around to get the sequence to work through the script. Any ideas?
01-08-2009, 06:47 PM
Definitly easier to create the .ifl file.
If you open an .ifl in note pad, you'll see it's just a list of files...
In MaxScript you can get all the files in a directory, open a file to write text and write the array of filenames, one at a time to the file and close...
tnFiles= getfiles <your directory>
FileStrm = createfile <filename.ifl>
for F in tnFiles do
format "%\n" F to:FileStrm
something like this...
Then assign the filename in the bitmap to the ifl and it "should" work...
01-08-2009, 06:54 PM
make sure you call sort() on tnFiles, just so the files are in the correct order (presuming they're zero-padded), as sometimes files get collected out of order when using getFiles()
Great, that worked, thanks a lot guys.
Would anyone mind helping me format the path into just the directory?
I'm getting "C:\path\file_0000.jpg" from my input, and when I run getFiles it's only giving me that one, so I assume I have to change this into just the containing directory in order to get the full list of files. Not sure how to do that though..
edit: getFilenamePath, figured it out, thanks!
01-09-2009, 02:14 AM
You can also use wildcards.
GetFiles = "C:\test\*.png"
Cool, good to know! This ended up working out perfectly. Thanks again for the help.
01-09-2009, 07:19 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.