Skip to content

Commit b34ec1c

Browse files
committed
add option to export both model and anim together
1 parent 497b9e3 commit b34ec1c

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

Assets/Integrations/Autodesk/maya/scripts/unityCommands.mel

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ global string $UnityFbxAnimFileNameAttr = "unityFbxAnimFileName";
66
global string $UnityFbxNamespaceAttr = "unityFbxNamespace";
77
global string $UnityExportSetNameFormat = "^1s_UnityExportSet";
88

9+
/* Enum */
10+
global int $UnityExportAnim = 0;
11+
global int $UnityExportModel = 1;
12+
global int $UnityExportModelAnim = 2;
13+
914
global proc unityRemoveNativeMenuOnLoad(){
1015
$removeSendToUnityMenu = `optionVar -q "UnityFbxForMaya_removeSendToUnityMenu"`;
1116
if($removeSendToUnityMenu && `menu -exists "sendToUnityMenu"`){
@@ -411,7 +416,7 @@ proc exportSet(string $unitySet, int $exportAnim){
411416
}
412417
}
413418

414-
proc unityExport(int $exportAnim){
419+
proc unityExport(int $exportType){
415420
// get the global variables
416421
global string $UnityExportSets[];
417422

@@ -423,8 +428,21 @@ proc unityExport(int $exportAnim){
423428
return;
424429
}
425430

431+
$exportAnim = false;
432+
$exportAnimOnly = false;
433+
switch($exportType){
434+
case 0 /* export animation only */:
435+
$exportAnim = true;
436+
$exportAnimOnly = true;
437+
break;
438+
case 1 /* export model only */:
439+
break;
440+
default: /* export model + animation */
441+
$exportAnim = true;
442+
break;
443+
}
426444
FBXProperty "Export|IncludeGrp|Animation" -v $exportAnim;
427-
FBXExportAnimationOnly -v $exportAnim;
445+
FBXExportAnimationOnly -v $exportAnimOnly;
428446

429447
$origSelection = `ls -sl`;
430448
if(size($origSelection) <= 0){
@@ -460,7 +478,7 @@ proc unityExport(int $exportAnim){
460478

461479
for($unitySet in $setsToExport){
462480
print ("exporting set: " + $unitySet);
463-
exportSet($unitySet, $exportAnim);
481+
exportSet($unitySet, $exportAnimOnly);
464482
}
465483

466484
select -cl;
@@ -470,9 +488,16 @@ proc unityExport(int $exportAnim){
470488
}
471489

472490
global proc unityExportAnim(){
473-
unityExport(true);
491+
global int $UnityExportAnim;
492+
unityExport($UnityExportAnim);
474493
}
475494

476495
global proc unityExportModel(){
477-
unityExport(false);
496+
global int $UnityExportModel;
497+
unityExport($UnityExportModel);
498+
}
499+
500+
global proc unityExportModelAnim(){
501+
global int $UnityExportModelAnim;
502+
unityExport($UnityExportModelAnim);
478503
}

Assets/Integrations/Autodesk/maya/scripts/unitySetupUI.mel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ global string $unityFamilyLabel = "The UnityFbxForMaya plugin (v.{Version}) allo
1111
global string $unityImportLabel = "Import an FBX file from a Unity project and auto-configure for exporting";
1212
global string $unityExportModelLabel = "Export Model to Unity";
1313
global string $unityExportAnimLabel = "Export Animation to Unity";
14+
global string $unityExportModelAnimLabel = "Export Model and Animation to Unity in a single file";
1415

1516
global string $unityCommandsFile = "unityCommands.mel";
1617
global string $unityImportMenuName = "Import";
1718
global string $unityExportModelMenuName = "Export Model Only";
1819
global string $unityExportAnimMenuName = "Export Animation Only";
20+
global string $unityExportModelAnimMenuName = "Export";
1921
global string $unityImportCommand = "unityImport";
2022
global string $unityExportModelCommand = "unityExportModel";
2123
global string $unityExportAnimCommand = "unityExportAnim";
24+
global string $unityExportModelAnimCommand = "unityExportModelAnim";
2225

2326
global proc string unityWhatsNewVersion(){
2427
return `about -q -version`;
@@ -54,13 +57,16 @@ global proc unityInstallUI(){
5457
global string $unityImportLabel;
5558
global string $unityExportModelLabel;
5659
global string $unityExportAnimLabel;
60+
global string $unityExportModelAnimLabel;
5761
global string $unityCommandsFile;
5862
global string $unityImportMenuName;
5963
global string $unityExportModelMenuName;
6064
global string $unityExportAnimMenuName;
65+
global string $unityExportModelAnimMenuName;
6166
global string $unityImportCommand;
6267
global string $unityExportModelCommand;
6368
global string $unityExportAnimCommand;
69+
global string $unityExportModelAnimCommand;
6470

6571
global string $gMainFileMenu;
6672

@@ -72,6 +78,7 @@ global proc unityInstallUI(){
7278
menuItem -parent $parentMenu -insertAfter $unityMenuDivider -subMenu true -label $unityMenuLabel -tearOff true -version $pluginVersion -image $unityIconPath -annotation $unityFamilyLabel $unityMenuName;
7379
menuItem -parent $unityMenuName -label $unityImportMenuName -version $pluginVersion -image $unityImportIconPath -annotation $unityImportLabel -command $unityImportCommand;
7480

81+
menuItem -parent $unityMenuName -label $unityExportModelAnimMenuName -version $pluginVersion -image $unityExportIconPath -annotation $unityExportModelAnimLabel -command $unityExportModelAnimCommand;
7582
menuItem -parent $unityMenuName -label $unityExportModelMenuName -version $pluginVersion -image $unityExportIconPath -annotation $unityExportModelLabel -command $unityExportModelCommand;
7683
menuItem -parent $unityMenuName -label $unityExportAnimMenuName -version $pluginVersion -image $unityExportIconPath -annotation $unityExportAnimLabel -command $unityExportAnimCommand;
7784

0 commit comments

Comments
 (0)