MetaFusion/Reference/SuperRiggingEditor/scripts/SGBindSkinCluster.mel
2025-02-03 22:58:41 +08:00

39 lines
970 B
Plaintext

//******************************************************************************
//
// 版权所有: 玉溪时光科技有限公司
// 联系邮箱: q.100@qq.com
// 开发日期: 2024/03/26
//
//******************************************************************************
global proc SGBindSkinCluster (){
for($i=0; $i<8; $i++){
string $joint_lod[] = `SGGetJoints -lod $i "string"`;
int $exists = 1;
for($joint in $joint_lod){
if(!`objExists $joint`){
$exists = 0;
break;
}
}
if($exists){
int $lod[] = `SGGetMeshes -lod $i`;
for($l in $lod){
string $mesh = `SGGetMeshes -m $l`;
if(`objExists $mesh`){
string $skinCluster = `findRelatedSkinCluster $mesh`;
if(!`objExists $skinCluster`){
string $name = `SGGetMeshes -i $l` + "_skinCluster";
string $infs[] = `SGGetJoints -inf $l`;
int $mi = `SGGetJoints -mi $l`;
skinCluster -n $name -mi $mi -tsb $infs $mesh;
}
}
}
}
}
SGBindSkinClusterWeights;
}