MetaFusion/Reference/SuperRiggingEditor/scripts/SGBindSkinCluster.mel

39 lines
970 B
Plaintext
Raw Normal View History

2025-02-03 22:58:41 +08:00
//******************************************************************************
//
// <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>: <20><>Ϫʱ<CFAA><CAB1><EFBFBD>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD>޹<EFBFBD>˾
// <20><>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>: q.100@qq.com
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 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;
}