February 19, 2014

Use an image sequence with texture emission – [Maya]

One of the great bugs in maya is that if you want to use an image sequence to use within any of its’ nodes, it manages to completely negate the effect of anything other than the first frame.

To fix this just create an expression in your scene and enter this code in to it, replacing the correct attributes as shown by the comments.

// Enter the name of the existing file node you want to drive here. "file1", "weightDrive_file", etc.
string $fileNode="fileIn";</code>

// Enter the directory and first part of the image name, before the numbers, here
// If your image sequence is called "animMap.0001.tif" and its in the images directory of your project
// then you would leave the $imagePrefix variable as it is.
string $imagePrefix="images/animMap";

// This is self explantory with the previous explanation in mind..
string $imageSuffix="tif";

// This is for you to offset the sequence if you need to
int $offset=0;

// Check the image name of the file node to make sure the name string is correct. Adjust previous entries to fix.
string $pythonCmd="import maya.cmds as cmds\noffset="+$offset+"\nframe=int(cmds.currentTime(q=1))+offset\ncmds.setAttr('"+$fileNode+".fileTextureName',('"+$imagePrefix+".'+str(frame).zfill(4)+'."+$imageSuffix+"'),type='string')";
python $pythonCmd;

Leave a Reply

Your email address will not be published. Required fields are marked *