40 lines
1005 B
Plaintext
40 lines
1005 B
Plaintext
//******************************************************************************
|
|
//
|
|
// 版权所有: 玉溪时光科技有限公司
|
|
// 联系邮箱: q.100@qq.com
|
|
// 开发日期: 2024/03/20
|
|
//
|
|
//******************************************************************************
|
|
|
|
global proc SGAutomaticGrouping ()
|
|
{
|
|
for($i=0; $i<8; $i++){
|
|
int $lodMesh[] = `SGGetMeshes -lod $i`;
|
|
string $group = "head_lod" + $i + "_grp";
|
|
if(!`objExists $group`){
|
|
group -em -n $group;
|
|
}
|
|
for($j=0; $j<size($lodMesh); $j++){
|
|
if($lodMesh[$j] >= 50){
|
|
continue;
|
|
}
|
|
string $mesh = `SGGetMeshes -m $lodMesh[$j]`;
|
|
if(`objExists $mesh`){
|
|
catchQuiet (`parent $mesh $group`);
|
|
}
|
|
}
|
|
}
|
|
string $bodyGrps[] = {"body_lod0_grp","body_lod1_grp","body_lod2_grp","body_lod3_grp"};
|
|
for($i=0; $i<4; $i++){
|
|
int $bodyIndex = 50 + $i;
|
|
string $mesh = `SGGetMeshes -m $bodyIndex`;
|
|
if(!`objExists $bodyGrps[$i]`){
|
|
group -em -n $bodyGrps[$i];
|
|
}
|
|
if(`objExists $mesh`){
|
|
catchQuiet (`parent $mesh $bodyGrps[$i]`);
|
|
}
|
|
}
|
|
}
|
|
|