PDA

View Full Version : Thumbnail generation


beuzel
11-04-2010, 11:43 PM
Hello,

I have a lot of maya scenes/files and want to get an overview of its content. Is there a way to generate thumbnails of the viewport? Maya 2009.

Greetings,
Chris

fezz
11-05-2010, 01:00 AM
Without opening each scene?

mduvekot
11-05-2010, 01:45 AM
Here's a script that loads all scenes in a folder and renders out a snapshot of a default camera view and saves that. It's pretty simple.


// figure out where the scenes are
string $path = (`workspace -q -fn`+ "/" +`workspace -q -fre "scene"`);
// make a list of all the .am and .mb files
string $asciiFiles[] = `getFileList -folder $path -filespec "*.ma"`;
string $binaryFiles[] = `getFileList -folder $path -filespec "*.mb"`;
string $sceneFiles[] = stringArrayCatenate($asciiFiles, $binaryFiles);
// iterate over all th files
string $file;
for ($file in $sceneFiles){
print ($file + "\n");
// open the file
file -f -open $file;
// get the file name
string $file = `file -q -sn`;
// look through the default persp view
lookThroughModelPanel persp modelPanel4;
// fix a problem with too narrow viewFit
setAttr "perspShape.overscan" 0.9;
// put the camera in the default position
viewSet -home;
// fit everything in the view
allViewFit(1);
//set a file name for the image derived from the scene name
$image = ($path + "/" + `basenameEx $file`);
// set .png as the fil format
setAttr "defaultRenderGlobals.imageFormat" 32;
// and get the right extension
string $ext = ".png";
// set the resolution
setAttr "defaultResolution.width" 1024;
setAttr "defaultResolution.height" 768;
// create a render view
if (!`window -exists renderViewWindow`) {RenderViewWindow;}
window -e -wh 1035 850 renderViewWindow;
// render a snapshot or a full render
//renderWindowRenderCamera render renderView persp;
renderWindowRenderCamera snapshot renderView persp;
//delete the image if it already exists
if (`filetest -w ($image + $ext)`) {
sysFile -delete ($image + $ext);
}
$editor = "renderView";
// and save the image
renderWindowEditor -edit -writeImage $image $editor;
}

beuzel
11-07-2010, 06:29 PM
Hi,

That was exactly what i was looking for. Thanks. I got the script to run on Maya 2009 and it works when there are only a few files in the directory. It doesn't generate any images when there are a lot of files in the directory. I am investigating this issue.

Greetings Chris

CGTalk Moderation
11-07-2010, 06:29 PM
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.