ladaojeifang

mel

string $sels[] = `ls -sl`;
string $sel;
for($sel in $sels){
int $numCVs = `getAttr -size ($sel+".controlPoints")`;
select -cl;
int $i;
for($i=0;$i<$numCVs;$i++){
select -r ($sel+".cv["+$i+"]");
string $clusternames[] = `cluster -envelope 1`;
vector $pointr = `xform -q -ws -t ($sel+".cv["+$i+"]")`;
string $spanum[] = `spaceLocator -p 0 0 0`;
xform -r -t ($pointr.x) ($pointr.y) ($pointr.z) $spanum[0] ;

pointConstraint $spanum[0] $clusternames[1];
setAttr ($clusternames[1]+".visibility") 0;
}
}

 

string $sels[] = `ls -sl`;
string $sel;
for($sel in $sels){
int $numCVs = `getAttr -size ($sel+".controlPoints")`;
select -cl;
int $i;
for($i=0;$i<$numCVs;$i++){


vector $pointr = `xform -q -ws -t ($sel+".cv["+$i+"]")`;
string $spanum[] = `spaceLocator `;
xform -r -t ($pointr.x) ($pointr.y) ($pointr.z) $spanum[0] ;
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1 $spanum[0];
select -r ($sel+".cv["+$i+"]");
cluster -wn $spanum[0] $spanum[0];

}
}

 

 python

import maya.cmds as cmd
sels=cmd.ls(sl=True)
for sel in sels:
    cvnum = cmd.getAttr(sel+\'.controlPoints\', size=1)
    for i in range(0,cvnum):
        cmd.select(sel+(\'.cv[\'+str(i)+\']\'),r=1)
        clustername =cmd.cluster(envelope=1)
        pointr =cmd.xform(sel+(\'.cv[\'+str(i)+\']\'),q=1,ws=1,t=1)
        spanum =cmd.spaceLocator(p=(0,0,0))
        cmd.xform(spanum[0],r=1,t=(pointr[0],pointr[1],pointr[2]))
        cmd.pointConstraint(spanum[0],clustername[1])
        cmd.setAttr(clustername[1]+".visibility",0)

  

分类:

技术点:

相关文章:

  • 2021-11-28
  • 2021-09-16
  • 2022-12-23
  • 2021-05-31
  • 2021-07-25
  • 2021-10-09
  • 2022-01-08
  • 2022-12-23
猜你喜欢
  • 2021-12-27
  • 2022-03-12
  • 2021-10-19
  • 2021-09-26
  • 2021-10-09
  • 2021-12-20
  • 2021-06-14
相关资源
相似解决方案