Skip to content

Commit ddfebee

Browse files
committed
update export menu ui
add Export->Model Only and Export->Animation Only submenus
1 parent 858363d commit ddfebee

File tree

2 files changed

+46
-12
lines changed

2 files changed

+46
-12
lines changed

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

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,13 @@ global proc unityImport(){
213213
}
214214

215215

216-
global proc unityExport(){
216+
proc unityExport(int $exportAnim){
217217
// get the global variables
218218
global string $UnityExportSets[];
219219
global string $UnityFbxFilePathAttr;
220220
global string $UnityFbxFileNameAttr;
221+
global string $UnityFbxAnimFilePathAttr;
222+
global string $UnityFbxAnimFileNameAttr;
221223

222224
if(!loadUnityDependencies()){
223225
return;
@@ -227,6 +229,9 @@ global proc unityExport(){
227229
return;
228230
}
229231

232+
FBXProperty "Export|IncludeGrp|Animation" -v $exportAnim;
233+
FBXExportAnimationOnly -v $exportAnim;
234+
230235
$origSelection = `ls -sl`;
231236
if(size($origSelection) <= 0){
232237
// nothing selected
@@ -266,21 +271,34 @@ global proc unityExport(){
266271

267272
select -r -ne $unitySet;
268273

269-
$unity_fbx_file_path = getAttribute($unitySet, $UnityFbxFilePathAttr);
270-
$unity_fbx_file_name = getAttribute($unitySet, $UnityFbxFileNameAttr);
274+
$pathAttr = $UnityFbxFilePathAttr;
275+
$nameAttr = $UnityFbxFileNameAttr;
276+
277+
if($exportAnim){
278+
$pathAttr = $UnityFbxAnimFilePathAttr;
279+
$nameAttr = $UnityFbxAnimFileNameAttr;
280+
}
281+
282+
$unity_fbx_file_path = getAttribute($unitySet, $pathAttr);
283+
$unity_fbx_file_name = getAttribute($unitySet, $nameAttr);
271284

272285
$strCmd = "";
273286
if ($unity_fbx_file_path != "" && $unity_fbx_file_name != ""){
274287
$strCmd = "file -force -options \"\" -typ \"FBX export\" -pr -es \"" + $unity_fbx_file_path + "/" + $unity_fbx_file_name + "\"";
288+
eval $strCmd;
275289
}
276-
else {
277-
$strCmd = "SendToUnitySelection";
278-
}
279-
eval $strCmd;
280290
}
281291

282292
select -cl;
283293
if (size($origSelection) > 0){
284294
select -add -ne $origSelection;
285295
}
296+
}
297+
298+
global proc unityExportAnim(){
299+
unityExport(true);
300+
}
301+
302+
global proc unityExportModel(){
303+
unityExport(false);
286304
}

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

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ global string $unityIconPath = "unity.png";
99

1010
global string $unityFamilyLabel = "The UnityFbxForMaya plugin (v.{Version}) allows you to reliably exchange and review your work between Maya and Unity.";
1111
global string $unityImportLabel = "Import an FBX file from a Unity project and auto-configure for exporting";
12-
global string $unityExportLabel = "Export Model to Unity";
12+
global string $unityExportLabel = "Export Model or Animation to Unity";
13+
global string $unityExportModelLabel = "Export Model to Unity";
14+
global string $unityExportAnimLabel = "Export Animation to Unity";
1315

1416
global string $unityCommandsFile = "unityCommands.mel";
1517
global string $unityImportMenuName = "Import";
16-
global string $unityExportMenuName = "Export";
18+
global string $unityExportMenuLabel = "Export";
19+
global string $unityExportMenuName = "UnityFbxForMayaExport";
20+
global string $unityExportModelMenuName = "Model Only";
21+
global string $unityExportAnimMenuName = "Animation Only";
1722
global string $unityImportCommand = "unityImport";
18-
global string $unityExportCommand = "unityExport";
23+
global string $unityExportModelCommand = "unityExportModel";
24+
global string $unityExportAnimCommand = "unityExportAnim";
1925

2026
global proc string unityWhatsNewVersion(){
2127
return `about -q -version`;
@@ -50,11 +56,18 @@ global proc unityInstallUI(){
5056
global string $unityFamilyLabel;
5157
global string $unityImportLabel;
5258
global string $unityExportLabel;
59+
global string $unityExportMenuLabel;
60+
global string $unityExportModelLabel;
61+
global string $unityExportAnimLabel;
5362
global string $unityCommandsFile;
5463
global string $unityImportMenuName;
5564
global string $unityExportMenuName;
65+
global string $unityExportModelMenuName;
66+
global string $unityExportAnimMenuName;
5667
global string $unityImportCommand;
5768
global string $unityExportCommand;
69+
global string $unityExportModelCommand;
70+
global string $unityExportAnimCommand;
5871

5972
global string $gMainFileMenu;
6073

@@ -65,8 +78,11 @@ global proc unityInstallUI(){
6578
menuItem -parent $parentMenu -insertAfter $unityMenuInsertAfter -divider true -longDivider false -version $pluginVersion $unityMenuDivider;
6679
menuItem -parent $parentMenu -insertAfter $unityMenuDivider -subMenu true -label $unityMenuLabel -tearOff true -version $pluginVersion -image $unityIconPath -annotation $unityFamilyLabel $unityMenuName;
6780
menuItem -parent $unityMenuName -label $unityImportMenuName -version $pluginVersion -image $unityImportIconPath -annotation $unityImportLabel -command $unityImportCommand;
68-
menuItem -parent $unityMenuName -label $unityExportMenuName -version $pluginVersion -image $unityExportIconPath -annotation $unityExportLabel -command $unityExportCommand;
69-
81+
menuItem -parent $unityMenuName -label $unityExportMenuLabel -version $pluginVersion -image $unityExportIconPath -annotation $unityExportLabel -subMenu true -tearOff true $unityExportMenuName;
82+
83+
menuItem -parent $unityExportMenuName -label $unityExportModelMenuName -version $pluginVersion -annotation $unityExportModelLabel -command $unityExportModelCommand;
84+
menuItem -parent $unityExportMenuName -label $unityExportAnimMenuName -version $pluginVersion -annotation $unityExportAnimLabel -command $unityExportAnimCommand;
85+
7086
unityRemoveNativeMenuOnLoad();
7187

7288
}

0 commit comments

Comments
 (0)