CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 01-08-2009, 06:26 PM   #1
JayG
Spartan
 
JayG's Avatar
portfolio
Jay Grenier
Technical Artist
Faceware Tech
Venice, USA
 
Join Date: Nov 2006
Posts: 134
Send a message via AIM to JayG Send a message via MSN to JayG
Trying to create a material with a jpg sequence bitmap in diffuse

Hi all!

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.

Code:
meditMaterials[1].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?

Thanks!
__________________
ScriptSwell
 
Old 01-08-2009, 06:47 PM   #2
Kramsurfer
Don't Know-it-All.
 
Kramsurfer's Avatar
portfolio
Keith R Morrison
Custom Tools Developer
Focus360
San Diego, USA
 
Join Date: Sep 2002
Posts: 426
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...

Code:
tnFiles= getfiles <your directory> FileStrm = createfile <filename.ifl> for F in tnFiles do format "%\n" F to:FileStrm close FileStrm


something like this...

Then assign the filename in the bitmap to the ifl and it "should" work...

good luck
__________________
Keith R Morrison
www.focus360.com

XP Pro x64, Win 7 - Max 2009, Max 2013 - Vray 2.30.01 - Backburner (uhg)
 
Old 01-08-2009, 06:54 PM   #3
ZeBoxx2
Lord of the posts
 
ZeBoxx2's Avatar
Richard Annema
Caustic Graphics / SplutterFish
Groningen, Netherlands
 
Join Date: Jul 2006
Posts: 1,461
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()
 
Old 01-08-2009, 07:19 PM   #4
JayG
Spartan
 
JayG's Avatar
portfolio
Jay Grenier
Technical Artist
Faceware Tech
Venice, USA
 
Join Date: Nov 2006
Posts: 134
Send a message via AIM to JayG Send a message via MSN to JayG
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!
__________________
ScriptSwell

Last edited by JayG : 01-08-2009 at 07:27 PM.
 
Old 01-09-2009, 02:14 AM   #5
DaveWortley
<database error>
 
DaveWortley's Avatar
portfolio
David Wortley
Technical Director
London, United Kingdom
 
Join Date: Dec 2004
Posts: 1,918
Send a message via MSN to DaveWortley
You can also use wildcards.

GetFiles = "C:\test\*.png"
__________________
Maxscript Made Easy...
http://davewortley.wordpress.com/
 
Old 01-09-2009, 07:19 AM   #6
JayG
Spartan
 
JayG's Avatar
portfolio
Jay Grenier
Technical Artist
Faceware Tech
Venice, USA
 
Join Date: Nov 2006
Posts: 134
Send a message via AIM to JayG Send a message via MSN to JayG
Cool, good to know! This ended up working out perfectly. Thanks again for the help.
__________________
ScriptSwell
 
Old 01-09-2009, 07:19 AM   #7
CGTalk Moderation
Expert
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,478
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 05:19 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.