Skip to content

Commit 5529da0

Browse files
authored
Merge pull request #232 from Unity-Technologies/Uni-31929_SendToUnity_is_unhidden
Uni 31929 send to unity is unhidden after importing
2 parents 89d7e61 + 0862c64 commit 5529da0

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ global string $UnityExportSet = "UnityFbxExportSet";
22
global string $UnityFbxFilePathAttr = "unityFbxFilePath";
33
global string $UnityFbxFileNameAttr = "unityFbxFileName";
44

5+
global proc unityRemoveNativeMenuOnLoad(){
6+
$removeSendToUnityMenu = `optionVar -q "UnityFbxForMaya_removeSendToUnityMenu"`;
7+
if($removeSendToUnityMenu && `menu -exists "sendToUnityMenu"`){
8+
//Remove the GamePipeline 'SendToUnity' button
9+
menu -e -visible false "sendToUnityMenu";
10+
}
11+
}
12+
513
// Load a specified settings file
614
proc int loadUnityFbxSettings(string $fileName, string $settingType){
715
// check if the file exists
@@ -49,7 +57,6 @@ proc int setExists(string $setName){
4957
return stringArrayContains($setName, `listSets -allSets`);
5058
}
5159

52-
5360
proc int loadUnityPlugin(string $plugin){
5461
if (`pluginInfo -q -loaded $plugin` == false){
5562
loadPlugin $plugin;
@@ -61,7 +68,7 @@ proc int loadUnityPlugin(string $plugin){
6168
};
6269

6370

64-
proc int loadUnityDependencies(){
71+
global proc int loadUnityDependencies(){
6572
// GamePipeline plugin 'SendToUnitySelection' command used in export
6673
$pluginsToLoad = {"GamePipeline", "fbxmaya"};
6774

@@ -77,11 +84,7 @@ proc int loadUnityDependencies(){
7784
$result = $result && `loadUnityPlugin ($plugin + "." + $ext)`;
7885
}
7986

80-
$removeSendToUnityMenu = `optionVar -q "UnityFbxForMaya_removeSendToUnityMenu"`;
81-
if($removeSendToUnityMenu && `menu -exists "sendToUnityMenu"`){
82-
//Remove the GamePipeline 'SendToUnity' button
83-
menu -e -visible false "sendToUnityMenu";
84-
}
87+
unityRemoveNativeMenuOnLoad();
8588

8689
return $result;
8790
}

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,22 @@ global string $unityImportMenuName = "Import";
1616
global string $unityExportMenuName = "Export";
1717
global string $unityImportCommand = "unityImport";
1818
global string $unityExportCommand = "unityExport";
19-
global string $unityRemoveSendToUnityMenuOption = "UnityFbxForMaya_removeSendToUnityMenu";
20-
global string $unitySendToUnityMenuName = "sendToUnityMenu";
2119

2220
global proc string unityWhatsNewVersion(){
2321
return `about -q -version`;
2422

2523
}
2624

2725
global proc unitySetupUI(){
28-
26+
global string $unityCommandsFile;
2927
$isHeadless = `optionVar -q "UnityFbxForMaya_Headless"`;
3028
if($isHeadless){
3129
// headless install, don't add UI
3230
return;
3331
}
32+
33+
eval ("source " + $unityCommandsFile);
34+
loadUnityDependencies();
3435

3536
evalDeferred -lowestPriority "unityInstallUI";
3637
}
@@ -55,9 +56,6 @@ global proc unityInstallUI(){
5556
global string $unityImportCommand;
5657
global string $unityExportCommand;
5758

58-
global string $unityRemoveSendToUnityMenuOption;
59-
global string $unitySendToUnityMenuName;
60-
6159
global string $gMainFileMenu;
6260

6361
buildFileMenu;
@@ -68,10 +66,7 @@ global proc unityInstallUI(){
6866
menuItem -parent $parentMenu -insertAfter $unityMenuDivider -subMenu true -label $unityMenuLabel -tearOff true -version $pluginVersion -image $unityIconPath -annotation $unityFamilyLabel $unityMenuName;
6967
menuItem -parent $unityMenuName -label $unityImportMenuName -version $pluginVersion -image $unityImportIconPath -annotation $unityImportLabel -command $unityImportCommand;
7068
menuItem -parent $unityMenuName -label $unityExportMenuName -version $pluginVersion -image $unityExportIconPath -annotation $unityExportLabel -command $unityExportCommand;
71-
72-
$unityRemoveSendToUnityMenuOption = `optionVar -q $unityRemoveSendToUnityMenuOption`;
73-
if($unityRemoveSendToUnityMenuOption && `menu -exists $unitySendToUnityMenuName`){
74-
menu -e -visible false $unitySendToUnityMenuName;
75-
}
69+
70+
unityRemoveNativeMenuOnLoad();
7671

7772
}

0 commit comments

Comments
 (0)