MetaFusion/Reference/SuperRiggingEditor/scripts/SGRepairNormals.mel

137 lines
2.2 KiB
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/01
//
//******************************************************************************
global proc SGRepairNormals (int $index){
int $vtxs[];
if($index == 0){
$vtxs = `SGMetaHumanNormals`;
}
else{
return;
}
string $head = `SGGetMeshes -m 0`;
string $body = `SGGetMeshes -m 50`;
int $count = size($vtxs)/2;
SGProgressBar -sp;
SGProgressBar -max $count;
SGProgressBar -t ("Repair Normals...");
for ($i=0; $i<$count; $i++){
SGProgressBar -apr 1;
int $h = $vtxs[$i*2];
int $b = $vtxs[$i*2+1];
string $headVtx = $head + ".vtx[" + $h + "]";
string $bodyVtx = $body + ".vtx[" + $b + "]";
float $pos[] = `polyNormalPerVertex -q -xyz $headVtx`;
polyNormalPerVertex -xyz $pos[0] $pos[1] $pos[2] $bodyVtx;
}
SGProgressBar -ep;
select -cl;
select -r $body;
BakeAllNonDefHistory;
}
global proc int[] SGMetaHumanNormals (){
int $vtxs[] = {
2805,9,
2806,8,
2807,7,
2808,10,
2809,6,
2810,5,
2811,2,
2812,1,
2813,0,
2814,4,
2815,12,
2816,14,
2817,15,
2818,16,
2819,17,
2820,18,
2821,19,
2822,20,
2823,21,
2824,11,
2873,22,
2876,23,
2965,3,
2997,13,
5876,3818,
5877,30,
5878,31,
5879,32,
5880,29,
5881,28,
5882,26,
5883,24,
5884,25,
5885,27,
5886,34,
5887,35,
5888,36,
5889,37,
5890,38,
5891,39,
5892,40,
5893,41,
5894,42,
5895,33,
5944,43,
5947,44,
11560,16789,
11564,16786,
11567,16795,
11569,16794,
11572,16784,
11575,7645,
11578,22814,
11582,16779,
11585,22833,
11587,22824,
11600,22801,
11795,21578,
11798,21577,
11799,21575,
11802,21573,
11803,21571,
11805,21569,
11807,21566,
11809,21564,
11811,21540,
11899,16775,
11909,16774,
11910,21542,
17607,9206,
17610,9203,
17614,9211,
17617,9207,
17619,9198,
17622,15227,
17626,15170,
17629,9195,
17632,15189,
17635,15180,
17647,15158,
17854,13968,
17856,13966,
17859,13964,
17860,13962,
17863,13960,
17865,13958,
17867,13957,
17869,13955,
17871,13927,
17962,9192,
17968,9186,
17972,13931
};
return $vtxs;
}