Skip to content

Commit da22ace

Browse files
authored
Merge pull request #212 from Unity-Technologies/Uni-31457_remove_send_to_unity_menu_item_in_Maya
Uni-31457 toggle to hide "send to unity" menu in maya
2 parents 51bbc45 + 49ee5dc commit da22ace

File tree

5 files changed

+52
-14
lines changed

5 files changed

+52
-14
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,28 @@ public override void OnInspectorGUI() {
200200

201201
EditorGUILayout.Space();
202202

203+
exportSettings.launchAfterInstallation = EditorGUILayout.Toggle(
204+
new GUIContent("Keep open:",
205+
"Keep the selected 3D application open after Unity integration install has completed."),
206+
exportSettings.launchAfterInstallation
207+
);
208+
209+
exportSettings.HideSendToUnityMenu = EditorGUILayout.Toggle(
210+
new GUIContent("Hide native menu:",
211+
"Replace Maya's native 'Send to Unity' menu with the Unity Integration's menu"),
212+
exportSettings.HideSendToUnityMenu
213+
);
214+
215+
EditorGUILayout.Space();
216+
217+
203218
var installIntegrationContent = new GUIContent(
204219
"Install Unity Integration",
205220
"Install and configure the Unity integration for the selected 3D application so that you can import and export directly with this project.");
206221
if (GUILayout.Button (installIntegrationContent)) {
207222
FbxExporters.Editor.IntegrationsUI.InstallDCCIntegration ();
208223
}
209224

210-
exportSettings.launchAfterInstallation = EditorGUILayout.Toggle(
211-
new GUIContent("Keep 3D Application opened:",
212-
"Keep the selected 3D application open after Unity integration install has completed."),
213-
exportSettings.launchAfterInstallation
214-
);
215-
216225
GUILayout.FlexibleSpace ();
217226
GUILayout.EndScrollView ();
218227
GUILayout.EndVertical();
@@ -324,6 +333,7 @@ public static string[] DCCVendorLocations {
324333
public bool mayaCompatibleNames;
325334
public bool centerObjects;
326335
public bool launchAfterInstallation;
336+
public bool HideSendToUnityMenu;
327337
public int ExportFormatSelection;
328338

329339
public string IntegrationSavePath;
@@ -355,6 +365,7 @@ protected override void LoadDefaults()
355365
mayaCompatibleNames = true;
356366
centerObjects = true;
357367
launchAfterInstallation = true;
368+
HideSendToUnityMenu = true;
358369
ExportFormatSelection = 0;
359370
convertToModelSavePath = kDefaultSavePath;
360371
IntegrationSavePath = DefaultIntegrationSavePath;

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ protected static string ESCAPED_QUOTE {
148148
}
149149

150150
protected string MAYA_CONFIG_COMMAND { get {
151-
return string.Format("unityConfigure {0}{1}{0} {0}{2}{0} {0}{3}{0} {4};",
152-
ESCAPED_QUOTE, GetProjectPath(), GetExportSettingsPath(), GetImportSettingsPath(), (IsHeadlessInstall()?1:0));
151+
return string.Format("unityConfigure {0}{1}{0} {0}{2}{0} {0}{3}{0} {4} {5};",
152+
ESCAPED_QUOTE, GetProjectPath(), GetExportSettingsPath(), GetImportSettingsPath(), (IsHeadlessInstall()), (HideSendToUnityMenu));
153153
}}
154154

155155
private string MAYA_CLOSE_COMMAND { get {
@@ -169,9 +169,16 @@ protected static string GetUserFolder()
169169
}
170170
}
171171

172-
public static bool IsHeadlessInstall ()
172+
public static int IsHeadlessInstall ()
173173
{
174-
return false;
174+
return 0;
175+
}
176+
177+
public static int HideSendToUnityMenu
178+
{
179+
get{
180+
return EditorTools.ExportSettings.instance.HideSendToUnityMenu?1:0;
181+
}
175182
}
176183

177184
public string GetModuleTemplatePath()

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ proc int loadUnityDependencies(){
7676
for($plugin in $pluginsToLoad){
7777
$result = $result && `loadUnityPlugin ($plugin + "." + $ext)`;
7878
}
79+
80+
$removeSendToUnityMenu = `optionVar -q "UnityFbxForMaya_removeSendToUnityMenu"`;
81+
if($removeSendToUnityMenu){
82+
//Remove the GamePipeline 'SendToUnity' button
83+
menu -e -visible false "sendToUnityMenu";
84+
}
85+
7986
return $result;
8087
}
8188

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ global proc unityConfigure(
22
string $unityProject,
33
string $unityFbxExportSettings,
44
string $unityFbxImportSettings,
5-
int $headless)
5+
int $headless,
6+
int $unityRemoveSendToUnityMenuOption)
67
{
78
// configure plugin settings
89
optionVar -stringValue "UnityProject" $unityProject;
910
optionVar -stringValue "UnityFbxExportSettings" $unityFbxExportSettings;
1011
optionVar -stringValue "UnityFbxImportSettings" $unityFbxImportSettings;
1112
optionVar -intValue "UnityFbxForMaya_Headless" $headless;
13+
optionVar -intValue "UnityFbxForMaya_removeSendToUnityMenu" $unityRemoveSendToUnityMenuOption;
1214

1315
return;
1416
}

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +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";
1921

2022
global proc string unityWhatsNewVersion(){
2123
return `about -q -version`;
2224

2325
}
2426

2527
global proc unitySetupUI(){
28+
2629
$isHeadless = `optionVar -q "UnityFbxForMaya_Headless"`;
2730
if($isHeadless){
2831
// headless install, don't add UI
2932
return;
30-
}
31-
33+
}
34+
3235
evalDeferred -lowestPriority "unityInstallUI";
3336
}
3437

@@ -45,13 +48,15 @@ global proc unityInstallUI(){
4548
global string $unityFamilyLabel;
4649
global string $unityImportLabel;
4750
global string $unityExportLabel;
48-
4951
global string $unityCommandsFile;
5052
global string $unityImportMenuName;
5153
global string $unityExportMenuName;
5254
global string $unityImportCommand;
5355
global string $unityExportCommand;
5456

57+
global string $unityRemoveSendToUnityMenuOption;
58+
global string $unitySendToUnityMenuName;
59+
5560
global string $gMainFileMenu;
5661

5762
buildFileMenu;
@@ -62,4 +67,10 @@ global proc unityInstallUI(){
6267
menuItem -parent $parentMenu -insertAfter $unityMenuDivider -subMenu true -label $unityMenuLabel -tearOff true -version $pluginVersion -image $unityIconPath -annotation $unityFamilyLabel $unityMenuName;
6368
menuItem -parent $unityMenuName -label $unityImportMenuName -version $pluginVersion -image $unityImportIconPath -annotation $unityImportLabel -command $unityImportCommand;
6469
menuItem -parent $unityMenuName -label $unityExportMenuName -version $pluginVersion -image $unityExportIconPath -annotation $unityExportLabel -command $unityExportCommand;
70+
71+
$unityRemoveSendToUnityMenuOption = `optionVar -q $unityRemoveSendToUnityMenuOption`;
72+
if($unityRemoveSendToUnityMenuOption){
73+
menu -e -visible false $unitySendToUnityMenuName;
74+
}
75+
6576
}

0 commit comments

Comments
 (0)