//镜像对灯光没作用,所以写一个这样的mel //把选择灯光的属性连接起来; string $objects[] = `ls -sl`; string $i,$first,$temp; $first=$objects[0]; group; for($i in $objects) { if ($i==$first) {} else { //下行意思:LightConnectAttr("属性名字",$first,$i); //属性名字可以随便改成你所知道的名字 //举例,可以改成shadowRays、rayDepthLimit、castSoftShadows、useDepthMapShadows等: //LightConnectAttr("shadowRays",$first,$i); //LightConnectAttr("rayDepthLimit",$first,$i); //LightConnectAttr("useDepthMapShadows",$first,$i); //连接它们的光线跟踪阴影 LightConnectAttr("intensity",$first,$i); LightConnectAttr("color",$first,$i); } }; proc LightConnectAttr(string $AttrLight,string $first,string $i) { $temp="connectAttr -f "+$first+"."+$AttrLight+" "+$i+"."+$AttrLight; eval($temp); } 此功能,你只需要把几个灯光选择了之后,按一下按键,它就会自动把选择的灯光连接到第一个选择的灯光的color跟intensity上,也可以自己添加属性,里面的解释已经说得很清楚明白 [此贴子已经被作者于2006-12-25 16:15:10编辑过]
|
-
2006-07-10
//MEL:conLightAttr
//mel用途:连接选择灯光属性
//我小改了一下,大家受用
//改动:
//1 自动添加shelf图标
//2 连接shadowColor属性
//3 减肥
global proc conLightAttr(){
string $objects[] = `ls -sl`;
string $i,$first,$temp;
$first=$objects[0];
group;
for($i in $objects)
{
if ($i== $first){
}
else
{
LightConnectAttr("useDepthMapShadows",$first,$i);
LightConnectAttr("shadowColor",$first,$i);
LightConnectAttr("dmapResolution",$first,$i);
LightConnectAttr("dmapFilterSize",$first,$i);
LightConnectAttr("dmapBias",$first,$i);
LightConnectAttr("intensity",$first,$i);
LightConnectAttr("color",$first,$i);
$temp="connectAttr -f "+$first+".lightDiffuse "+$i+".emitDiffuse";
eval($temp);
$temp="connectAttr -f "+$first+".lightSpecular "+$i+".emitSpecular";
eval($temp);
}
};
}
proc LightConnectAttr(string $AttrLight,string $first,string $i)
{
$temp="connectAttr -f "+$first+"."+$AttrLight+" "+$i+"."+$AttrLight;
eval($temp);
}
global proc addIcon_cLA()
{
global string $gShelfTopLevel;
if (`tabLayout -exists $gShelfTopLevel`)
{
shelfButton
-parent ($gShelfTopLevel + "|" + `tabLayout -q -st $gShelfTopLevel`)
-label "conLightAttr"
-iol "cL "
-command " conLightAttr "
-image1 "conLightAttr.bmp";
}
else{
error "You Have To open at Least One Shelf!!!";
}
}
addIcon_cLA;
conLightAttr;