maya小脚本插件之物体ID

选中物体运行脚本就可为物体随机指定不同的ID材质球,方便烘焙ID贴图

string $selection[] = `ls -selection`;

for ($obj in $selection)
{
string $material = `shadingNode -asShader lambert -name (“mat*” + $obj)`;
float $MatColor[] = { (rand (0, 1.5)), (rand (0, 1.5)), (rand (0, 1.5))};
setAttr ($material + “.color”) -type double3 $MatColor[0] $MatColor[1] $MatColor[2];
select $obj;
hyperShade -assign $material;
}
select $selection;

发表评论

电子邮件地址不会被公开。 必填项已用*标注