236 lines
6.8 KiB
Plaintext
236 lines
6.8 KiB
Plaintext
|
//******************************************************************************
|
|||
|
//
|
|||
|
// <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 SGExportFBXWindow (){
|
|||
|
|
|||
|
if (!`window -ex SuperRiggingEditor`){
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (`window -ex exportFBXWin`){
|
|||
|
deleteUI -window exportFBXWin;
|
|||
|
}
|
|||
|
|
|||
|
string $All = "All";
|
|||
|
string $ExportHeadFBX = "Export Head LOD To FBX";
|
|||
|
string $ExportSelectHeadFBX = "Export Select Head To FBX";
|
|||
|
string $ExportBodyFBX = "Export Body LOD To FBX";
|
|||
|
string $ExportSelectBodyFBX = "Export Select Body To FBX";
|
|||
|
|
|||
|
if(`SGDescriptor -l` == "ZH"){
|
|||
|
$All = "ȫѡ";
|
|||
|
$ExportHeadFBX = "<22><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>LOD<4F><44>FBX";
|
|||
|
$ExportSelectHeadFBX = "<22><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>FBX";
|
|||
|
$ExportBodyFBX = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>LOD<4F><44>FBX";
|
|||
|
$ExportSelectBodyFBX = "<22><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>嵽FBX";
|
|||
|
}
|
|||
|
|
|||
|
window -p SuperRiggingEditor -w 310 -h 100 -t "ExportFBX" -s true -tb true exportFBXWin;
|
|||
|
columnLayout -adj 1 -columnAttach "both" 5 -rowSpacing 2 -columnWidth 150 ;
|
|||
|
separator -height 10 -style "in";
|
|||
|
checkBoxGrp -vis 1 -cw4 55 55 55 55 -ncb 4 -la4 "LOD0" "LOD1" "LOD2" "LOD3" -v1 1 -v2 0 -v3 0 -v4 0 export_FBX_Check_1;
|
|||
|
checkBoxGrp -vis 1 -cw4 55 55 55 55 -ncb 4 -la4 "LOD4" "LOD5" "LOD6" "LOD7" -v1 0 -v2 0 -v3 0 -v4 0 export_FBX_Check_2;
|
|||
|
|
|||
|
separator -height 10 -style "in";
|
|||
|
rowLayout -adj 2 -nc 2 -cw2 45 20;
|
|||
|
checkBox -cc "SGExportHeadCheckCommand" -l $All -v 0 check_Select_All_1;
|
|||
|
button -l $ExportHeadFBX -al "center" -c "SGExportHeadCommand;" ;
|
|||
|
setParent..;
|
|||
|
button -l $ExportSelectHeadFBX -al "center" -c "SGExportSelectHeadCommand;" ;
|
|||
|
|
|||
|
separator -height 10 -style "in";
|
|||
|
rowLayout -adj 2 -nc 2 -cw2 45 20;
|
|||
|
checkBox -cc "SGExportBodyCheckCommand" -l $All -v 0 check_Select_All_2;
|
|||
|
button -l $ExportBodyFBX -al "center" -c "SGExportBodyCommand;" ;
|
|||
|
setParent..;
|
|||
|
button -l $ExportSelectBodyFBX -al "center" -c "SGExportSelectBodyCommand;" ;
|
|||
|
separator -height 10 -style "in";
|
|||
|
showWindow exportFBXWin;
|
|||
|
}
|
|||
|
|
|||
|
global proc SGExportFBX (string $file){
|
|||
|
FBXResetExport;
|
|||
|
FBXExportBakeComplexAnimation -v true;
|
|||
|
FBXExportBakeComplexStart -v 1;
|
|||
|
FBXExportBakeComplexStep -v 1;
|
|||
|
FBXExportBakeComplexEnd -v 1;
|
|||
|
FBXExportConstraints -v true;
|
|||
|
FBXExportSkeletonDefinitions -v true;
|
|||
|
FBXExportInputConnections -v true;
|
|||
|
FBXExportSmoothingGroups -v true;
|
|||
|
FBXExportSkins -v true;
|
|||
|
FBXExportShapes -v true;
|
|||
|
FBXExportCameras -v false;
|
|||
|
FBXExportLights -v false;
|
|||
|
FBXExportUpAxis "y";
|
|||
|
FBXExport -f $file -s;
|
|||
|
print ($file + ": Export completed...\n");
|
|||
|
}
|
|||
|
|
|||
|
global proc SGExportHeadCheckCommand (){
|
|||
|
int $v = `checkBox -q -v check_Select_All_1`;
|
|||
|
checkBoxGrp -e -v1 $v -v2 $v -v3 $v -v4 $v export_FBX_Check_1;
|
|||
|
checkBoxGrp -e -v1 $v -v2 $v -v3 $v -v4 $v export_FBX_Check_2;
|
|||
|
}
|
|||
|
|
|||
|
global proc SGExportBodyCheckCommand (){
|
|||
|
int $v = `checkBox -q -v check_Select_All_2`;
|
|||
|
checkBoxGrp -e -v1 $v -v2 $v -v3 $v -v4 $v export_FBX_Check_1;
|
|||
|
}
|
|||
|
|
|||
|
global proc SGExportHeadCommand (){
|
|||
|
|
|||
|
if(!`pluginInfo -q -l "fbxmaya"`){
|
|||
|
loadPlugin "fbxmaya";
|
|||
|
}
|
|||
|
|
|||
|
if(!`objExists "DHIhead:root"`){
|
|||
|
error -n "Missing <20><>DHIhead:root<6F><74> joint...";
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
SGRenameBlendShapes;
|
|||
|
|
|||
|
int $lod0 = `checkBoxGrp -q -v1 export_FBX_Check_1`;
|
|||
|
int $lod1 = `checkBoxGrp -q -v2 export_FBX_Check_1`;
|
|||
|
int $lod2 = `checkBoxGrp -q -v3 export_FBX_Check_1`;
|
|||
|
int $lod3 = `checkBoxGrp -q -v4 export_FBX_Check_1`;
|
|||
|
int $lod4 = `checkBoxGrp -q -v1 export_FBX_Check_2`;
|
|||
|
int $lod5 = `checkBoxGrp -q -v2 export_FBX_Check_2`;
|
|||
|
int $lod6 = `checkBoxGrp -q -v3 export_FBX_Check_2`;
|
|||
|
int $lod7 = `checkBoxGrp -q -v4 export_FBX_Check_2`;
|
|||
|
|
|||
|
int $lods[] = {$lod0,$lod1,$lod2,$lod3,$lod4,$lod5,$lod6,$lod7};
|
|||
|
for ($i=0; $i<size($lods); $i++){
|
|||
|
if($lods[$i]){
|
|||
|
string $exportGrp = "head_lod" + $i + "_grp";
|
|||
|
string $groupMembers[] = `ls -dag -geometry $exportGrp`;
|
|||
|
if(`size($groupMembers)`){
|
|||
|
string $path = `SGDescriptor -p`;
|
|||
|
string $name = `SGDescriptor -n`;
|
|||
|
string $filePath = $path + "/" + $name +"_lod" + $i + "_head.fbx";
|
|||
|
select -cl;
|
|||
|
select -r $exportGrp;
|
|||
|
select -add "DHIhead:root";
|
|||
|
SGExportFBX $filePath;
|
|||
|
}
|
|||
|
else{
|
|||
|
error -n ("\"" + $exportGrp + "\" No geometry found within the group...");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
SGResetBlendShapes;
|
|||
|
|
|||
|
string $folderPath = `SGDescriptor -p`;
|
|||
|
$folderPath = `substituteAllString $folderPath "/" "\\"`;
|
|||
|
system("explorer " + $folderPath);
|
|||
|
}
|
|||
|
|
|||
|
global proc SGExportSelectHeadCommand (){
|
|||
|
|
|||
|
if(!`pluginInfo -q -l "fbxmaya"`){
|
|||
|
loadPlugin "fbxmaya";
|
|||
|
}
|
|||
|
|
|||
|
if(!`objExists "DHIhead:root"`){
|
|||
|
error -n "Missing <20><>DHIhead:root<6F><74> joint...";
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
string $sel[] = `ls -sl`;
|
|||
|
if(!size($sel)){
|
|||
|
error -n "Selection is empty...";
|
|||
|
return;
|
|||
|
}
|
|||
|
SGRenameBlendShapes;
|
|||
|
select -cl;
|
|||
|
select -r $sel;
|
|||
|
select -add "DHIhead:root";
|
|||
|
string $path = `SGDescriptor -p`;
|
|||
|
string $name = `SGDescriptor -n`;
|
|||
|
string $filePath = $path + "/" + $name +"_lod" + "_head.fbx";
|
|||
|
SGExportFBX $filePath;
|
|||
|
SGResetBlendShapes;
|
|||
|
|
|||
|
string $folderPath = `SGDescriptor -p`;
|
|||
|
$folderPath = `substituteAllString $folderPath "/" "\\"`;
|
|||
|
system("explorer " + $folderPath);
|
|||
|
}
|
|||
|
|
|||
|
global proc SGExportBodyCommand (){
|
|||
|
|
|||
|
if(!`pluginInfo -q -l "fbxmaya"`){
|
|||
|
loadPlugin "fbxmaya";
|
|||
|
}
|
|||
|
|
|||
|
if(!`objExists "DHIbody:root"`){
|
|||
|
error -n "Missing <20><>DHIbody:root<6F><74> joint...";
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
int $lod0 = `checkBoxGrp -q -v1 export_FBX_Check_1`;
|
|||
|
int $lod1 = `checkBoxGrp -q -v2 export_FBX_Check_1`;
|
|||
|
int $lod2 = `checkBoxGrp -q -v3 export_FBX_Check_1`;
|
|||
|
int $lod3 = `checkBoxGrp -q -v4 export_FBX_Check_1`;
|
|||
|
|
|||
|
int $lods[] = {$lod0,$lod1,$lod2,$lod3};
|
|||
|
for ($i=0; $i<size($lods); $i++){
|
|||
|
if($lods[$i]){
|
|||
|
string $exportGrp = "body_lod" + $i + "_grp";
|
|||
|
string $groupMembers[] = `ls -dag -geometry $exportGrp`;
|
|||
|
if(`size($groupMembers)`){
|
|||
|
string $path = `SGDescriptor -p`;
|
|||
|
string $name = `SGDescriptor -n`;
|
|||
|
string $filePath = $path + "/" + $name +"_lod" + $i + "_body.fbx";
|
|||
|
select -cl;
|
|||
|
select -r $exportGrp;
|
|||
|
select -add "DHIbody:root";
|
|||
|
SGExportFBX $filePath;
|
|||
|
}
|
|||
|
else{
|
|||
|
error -n ("\"" + $exportGrp + "\" No geometry found within the group...");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
string $folderPath = `SGDescriptor -p`;
|
|||
|
$folderPath = `substituteAllString $folderPath "/" "\\"`;
|
|||
|
system("explorer " + $folderPath);
|
|||
|
}
|
|||
|
|
|||
|
global proc SGExportSelectBodyCommand (){
|
|||
|
|
|||
|
if(!`pluginInfo -q -l "fbxmaya"`){
|
|||
|
loadPlugin "fbxmaya";
|
|||
|
}
|
|||
|
|
|||
|
if(!`objExists "DHIbody:root"`){
|
|||
|
error -n "Missing <20><>DHIbody:root<6F><74> joint...";
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
string $sel[] = `ls -sl`;
|
|||
|
if(!size($sel)){
|
|||
|
error -n "Selection is empty...";
|
|||
|
return;
|
|||
|
}
|
|||
|
select -cl;
|
|||
|
select -r $sel;
|
|||
|
select -add "DHIbody:root";
|
|||
|
string $path = `SGDescriptor -p`;
|
|||
|
string $name = `SGDescriptor -n`;
|
|||
|
string $filePath = $path + "/" + $name +"_lod" + "_body.fbx";
|
|||
|
SGExportFBX $filePath;
|
|||
|
|
|||
|
string $folderPath = `SGDescriptor -p`;
|
|||
|
$folderPath = `substituteAllString $folderPath "/" "\\"`;
|
|||
|
system("explorer " + $folderPath);
|
|||
|
}
|
|||
|
|
|||
|
|