MEL How-To #51
How do I get the width and height of a file texture?
A file texture includes the following attributes for this purpose: ‘
// Width and Height individually int $width = `getAttr file1.outSizeX`; // Result: 64 // int $height = `getAttr file1.outSizeY`; // Result: 32 // // Both float $size = `getAttr file1.outSize`; // Result: 64 32 //
Don't know why the latter is returned as a float.
Note: The first time you query a file texture for its dimensions Maya will likely perform a disk-read of the image, presumably to cache this information. This can take considerable time if you are looping through many file textures in a scene. Subsequent queries will not be subject to this delay.
Note: I've heard of a case where Maya erroneously swapped the width and height dimensions returned with this query. I have not experienced this anomoly myself, however.
|Copyright ©2005 by Bryan Ewert, firstname.lastname@example.org|
Maya is a Registered Trademark of Alias