Call for Submission
NAB 2012 Best of the Best Show Reel
Submit your work today!
  • 1/3
You are here: Forum Home / Autodesk® Maya® / MEL / Selecting different texture maps from a folder to render stills of the same object, one at a time
  RSS 2.0 ATOM  

Selecting different texture maps from a folder to render stills of the same object, one at a time
Rate this thread
 
36931
 
Permlink of this thread   Subscribe to this thread
avatar
  • Total Posts: 5
  • Joined: 22 August 2006 01:59 PM

Hi,
I need help in writing a mel that does the following based on a selected object:

pick up a single texture map in its shading network from a designated folder
render a still shot of it,
save that,
choose the next texture map from the same folder and repeat the above
until they are all done.

Can someone help me with that?

I would really appreciate if you could!

Thanks,

Fred



Replies: 0
avatar

$folder="C:/Documents and Settings/All Users/Documents/My Pictures/Sample Pictures/";
$material="lambert1";
$texture=`shadingNode -asTexture file`;//create file

connectAttr -force ($texture+".outColor") ($material+".color")// assign the file the the material
$files=`getFileList -folder $folder`;// get all file list in the folder inclode thumbs and everything
for($i=0;$i<size($files)$i++)// loop through files
{
$files[$i]
=$folder+$files[$i];// get each file full directory and name
setAttr -type "string" ($texture+".fileTextureName") $files[$i];// assign the file to the texture node
renderIntoNewWindow render;// render view
renderWindowMenuCommand keepImageInRenderView renderView;// save the result in images/temp
}

hi
I did this script for you , choose the folder in this first string $folder
put the name of your material in the $material variable
some files in that folder can’t be rendered so it will give you black frames
other renderable files will render properly

regards
Salwan



Replies: 2
/img/forum/dark/default_avatar.png

Hi Salwan,
Sorry for late reply, I’ve been out of town for thanksgiving. That’s great! I’m going to work on it and post back!

Thanks very much,,

Fred

Author: fredershadi

Replied: 01 December 2009 04:53 AM  
/img/forum/dark/default_avatar.png

Hi,

The script works up to
for($i=0;$i<size($files)$i++)// loop through files
where I get an Syntax error.

What’s going wrong?

Fred

Author: fredershadi

Replied: 01 December 2009 05:18 AM  
avatar
  • Norbert
  • Posted: 01 December 2009 11:04 AM

for( $i 0$i size( $files ) $i++ )


Replies: 1
/img/forum/dark/default_avatar.png

Great, it let me pass that and get to the rest of the script!

Thanks Norbert,

Fred

Author: fredershadi

Replied: 03 December 2009 10:44 AM  
avatar
  • Norbert
  • Posted: 04 December 2009 09:41 AM

np :)



Replies: 0
avatar

Hi,
Now, here is script I have so far:

$folder="/Users/fredeno4/Desktop/Maps";
$material="blinn1";
$texture=`shadingNode -asTexture file`;//create file
connectAttr -force ($texture+".outColor") ($material+".color")// assign the file the the material
$files=`getFileList -folder $folder`;// get all file list in the folder inclode thumbs and everything

for( $i = 0; $i < size( $files ) ; $i++ )

{
$files[$i]=$folder+$files[$i];// get each file full directory and name

setAttr -type “string” ($texture+".fileTextureName") $files[$i];// assign the file to the texture node
renderIntoNewWindow render;// render view
renderWindowMenuCommand keepImageInRenderView renderView;// save the result in images/temp
}

It does create a new texture and connects it to a blinn that I need, but it does not load any of the maps from the “Maps” folder on the desktop. Therefore it renders the object black after 4 passes, and stops. Here is error message it gives:

// Warning: Texture file /Users/fredeno4/Desktop/Mapstwosixth_120cc.tif doesn’t exist, node file1 //
For some reason it looks for the Map which is named “Mapstwosixth_120cc.tif” although it should look for “twosixth_120cc.tif” file in the “Map” folder. ANd after that for the next file in the Map folder, etc.

Can someone help me with that correction?

Thanks,

Fred



Replies: 0




   
  Settings Choose Theme color: