■内容
複数頂点と1つのジョイントを選択して実行すると繋がったポリゴンが選択されウエイト1でジョイントとバインドされる
 
ShellWeight 0 は選択した頂点を1に
ShellWeight 1 は選択した頂点と繋がった頂点を1に 
バインドされていない場合バインドもされる。
なぜかエラーが出る事があります。バインドの状況が違うのか原因が分からず。
global proc ShellWeight(int $p)
{
 
 string $Weight_joint[] = `ls -sl -type joint`;
 if(!size($Weight_joint)) error "ShellWeight: requires one joint node to be selected.\n";
 
 string $Weight_vtx[] = `ls -sl -type float3`;
 if(!size($Weight_vtx)) error "ShellWeight: requires one vertex to be selected.\n";
 
 string $MeshName[];
 tokenize $Weight_vtx[0] "." $MeshName ;
 string $onevtx = $Weight_vtx[0];
 if(`gmatch "*:*" $Weight_vtx[0]`)
 {
  string $point[];
  tokenize $Weight_vtx[0] ":" $point;
  $onevtx = $point[0] + "]";
 }
 string $SelectShape[] = `listRelatives -s $MeshName[0]`;
 string $SelectSkinClusterS[] = `listConnections -t skinCluster $SelectShape[0]`;
 
 //バインドされたジョイントかチェック
 string $JointInf[] = `skinCluster -q -inf $SelectShape[0]`;
 int $found = stringArrayContains($Weight_joint[0], $JointInf);
 if($found == 0)
 {
  //バインドされていなければ実行
  skinCluster -e -lw true -wt 0 -ai $Weight_joint[0] $SelectShape[0];
 }
 
 skinPercent -tv $Weight_joint[0] 1.0 $SelectSkinClusterS[0] $Weight_vtx[0];
 
 if($p == 0)
 {
  select $onevtx;
  artAttrSkinWeightCopy;
  select $Weight_vtx;
 }
 else if($p == 1)
 {
  select $Weight_vtx[0];
  artAttrSkinWeightCopy;
  select $Weight_vtx;
  ConvertSelectionToShell;
 }
 artAttrSkinWeightPaste;
}
 
0 件のコメント:
コメントを投稿