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

42 lines
1.2 KiB
Plaintext

//******************************************************************************
//
// 版权所有: 玉溪时光科技有限公司
// 联系邮箱: q.100@qq.com
// 开发日期: 2024/06/12
//
//******************************************************************************
global proc SGSaveBlendShapeMappings ( int $resetMappings ){
SGProgressBar -sp;
int $mapping = 0;
string $blendShapeNames[] = `SGGetBlendShapes`;
SGProgressBar -max (size($blendShapeNames));
SGProgressBar -t ("Update BlendShape Mappings...");
SGProgressBar -pr 0;
string $blendShapes[];
int $meshIndices[];
for($meshIndex=0; $meshIndex<50; $meshIndex++){
string $blendShape = `SGGetMeshes -i $meshIndex` + "_blendShapes";
if(`objExists $blendShape`){
$blendShapes[size($blendShapes)] = $blendShape;
$meshIndices[size($meshIndices)] = $meshIndex;
}
}
for($blendShapeName in $blendShapeNames){
SGProgressBar -apr 1;
for($i=0; $i<size($blendShapes); $i++) {
string $bsNode[] = `listAttr -m ($blendShapes[$i] + ".w")`;
if(stringArrayContains($blendShapeName, $bsNode)){
SGSaveBlendShapes -rm $resetMappings -ma $mapping $meshIndices[$i] $blendShapeName;
$mapping++;
}
}
}
SGProgressBar -ep;
}