一半君的总结纸

听话只听一半君

#51 How do I get the width and height of a file texture?

A file texture includes the following attributes for this purpose: ‘.outSizeX’, ‘outSizeY’ and ‘outSize’.

// Width and Height individually
int $width = `getAttr file1.outSizeX`;
// Result: 64 //

int $height = `getAttr file1.outSizeY`;
// Result: 32 //

// Both
float $size[2] = `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.

Friday, December 08, 2000

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: