78 lines
2.4 KiB
Plaintext
78 lines
2.4 KiB
Plaintext
//******************************************************************************
|
|
//
|
|
// 版权所有: 玉溪时光科技有限公司
|
|
// 联系邮箱: q.100@qq.com
|
|
// 开发日期: 2024/04/01
|
|
//
|
|
//******************************************************************************
|
|
|
|
global proc SGSupplementMeshes ()
|
|
{
|
|
for($i=0; $i<8; $i++){
|
|
int $lodList[] = `SGGetMeshes -lod $i`;
|
|
string $head = `SGGetMeshes -m $lodList[0]`;
|
|
|
|
string $deformed = `SGGetMeshes -m 0`;
|
|
|
|
if(`objExists $head`){
|
|
|
|
string $source = `SGGetMeshes -cm 0`;
|
|
string $sourceBuffer = $source + "_buffer";
|
|
$sourceBuffer = `substring $sourceBuffer 2 (size($sourceBuffer))`;
|
|
$sourceBuffer = `rename $source $sourceBuffer`;
|
|
|
|
string $title = "[LOD" + $i + "] Please be patient and wait...";
|
|
if(`SGDescriptor -l` == "ZH"){
|
|
$title = "[LOD" + $i + "] 请耐心等待...";
|
|
}
|
|
SGProgressBar -sp;
|
|
SGProgressBar -t $title;
|
|
|
|
string $eyeMesh[], $eye[], $mouthMesh[];
|
|
|
|
string $json = `SGDescriptor -ti "vertexsInfo"`;
|
|
int $eyeIndices[] = `SGReadJson -f $json -k "headEye" -t "int"`;
|
|
int $mouthIndices[] = `SGReadJson -f $json -k "headMouth" -t "int"`;
|
|
|
|
for($j=1; $j<size($lodList); $j++){
|
|
if($lodList[$j] < 50){
|
|
string $mesh = `SGGetMeshes -m $lodList[$j]`;
|
|
if(!`objExists $mesh`){
|
|
string $newMesh = `SGGetMeshes -cm $lodList[$j]`;
|
|
if(`objExists $newMesh`){
|
|
if(`gmatch $newMesh "*eyeshell*"` || `gmatch $newMesh "*eyelashes*"`
|
|
|| `gmatch $newMesh "*eyeEdge*"`|| `gmatch $newMesh "*cartilage*"`){
|
|
$eyeMesh[size($eyeMesh)] = $newMesh;
|
|
}
|
|
else if(`gmatch $newMesh "*eyeLeft*"` || `gmatch $newMesh "*eyeRight*"`){
|
|
$eye[size($eye)] = $newMesh;
|
|
}
|
|
else if(`gmatch $newMesh "*teeth*"` || `gmatch $newMesh "*saliva*"`){
|
|
$mouthMesh[size($mouthMesh)] = $newMesh;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
SGProgressBar -max 3;
|
|
SGProgressBar -apr 1;
|
|
if(size($eyeMesh) > 0){
|
|
SGRBFDeformer -r 0.01 -rbf 1 -m $sourceBuffer $deformed -pi $eyeIndices -t $eyeMesh;
|
|
}
|
|
SGProgressBar -apr 1;
|
|
if(size($eye) > 0){
|
|
SGRBFDeformer -r 0.01 -rbf 1 -d off -m $sourceBuffer $deformed -pi $eyeIndices -t $eye;
|
|
}
|
|
SGProgressBar -apr 1;
|
|
if(size($mouthMesh) > 0){
|
|
SGRBFDeformer -r 0.01 -rbf 1 -d off -m $sourceBuffer $deformed -pi $mouthIndices -t $mouthMesh;
|
|
}
|
|
delete $sourceBuffer;
|
|
SGProgressBar -ep;
|
|
}
|
|
}
|
|
}
|
|
|
|
|