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

36 lines
1.2 KiB
Plaintext

//******************************************************************************
//
// 版权所有: 玉溪时光科技有限公司
// 联系邮箱: q.100@qq.com
// 开发日期: 2023/08/08
//
//******************************************************************************
global proc SGCreateBlendShape (){
SGProgressBar -sp;
for($mesheIndex=0; $mesheIndex<50; $mesheIndex++){
string $mesh = `SGGetMeshes -m $mesheIndex`;
if(`objExists $mesh`){
string $blendShape = `SGGetBlendShape $mesh`;
int $count = `SGGetBlendShapes -dr "r" -tc $mesheIndex`;
if(!`objExists $blendShape` && $count > 0){
string $blendShapeName = `SGGetMeshes -i $mesheIndex` + "_blendShapes";
SGProgressBar -max $count;
SGProgressBar -t ("[" + $blendShapeName + "] Creating Target Mesh...");
blendShape -n $blendShapeName $mesh;
for($index=0; $index<$count; $index++){
SGProgressBar -apr 1;
string $bsName = `SGGetBlendShapes -dr "r" -bsn $mesheIndex $index`;
duplicate -rr -n $bsName $mesh;
SGSetBlendShapes -ct $mesheIndex $index $bsName;
blendShape -e -tc on -t $mesh $index $bsName 1 -w $index 0 $blendShapeName;
delete $bsName;
}
}
}
}
SGProgressBar -ep;
}