Skip to content

Commit 76f0b19

Browse files
author
AJubrey
committed
[ADDED] a toggle that allows you to hide the "send to unity" menu in Maya
1 parent 24028c7 commit 76f0b19

File tree

5 files changed

+33
-4
lines changed

5 files changed

+33
-4
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@ public override void OnInspectorGUI() {
196196
exportSettings.launchAfterInstallation
197197
);
198198

199+
exportSettings.HideOtherMenuMaya = EditorGUILayout.Toggle(
200+
new GUIContent("Hide 'SendToUnity' menu (Maya only):",
201+
"Hide the GamePipeline menu in Maya, can help avoid confusion with Fbx export menu (will only affect maya integration)"),
202+
exportSettings.HideOtherMenuMaya
203+
);
204+
199205
GUILayout.FlexibleSpace ();
200206
GUILayout.EndScrollView ();
201207
GUILayout.EndVertical();
@@ -302,8 +308,10 @@ public static string[] DCCVendorLocations {
302308
public bool mayaCompatibleNames;
303309
public bool centerObjects;
304310
public bool launchAfterInstallation;
311+
public bool HideOtherMenuMaya;
305312
public int ExportFormatSelection;
306313

314+
307315
public string IntegrationSavePath;
308316

309317
public int selectedDCCApp = 0;
@@ -333,6 +341,7 @@ protected override void LoadDefaults()
333341
mayaCompatibleNames = true;
334342
centerObjects = true;
335343
launchAfterInstallation = true;
344+
HideOtherMenuMaya = true;
336345
ExportFormatSelection = 0;
337346
convertToModelSavePath = kDefaultSavePath;
338347
IntegrationSavePath = Directory.GetCurrentDirectory().ToString();

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ protected static string ESCAPED_QUOTE {
155155
}
156156

157157
protected string MAYA_CONFIG_COMMAND { get {
158-
return string.Format("unityConfigure {0}{1}{0} {0}{2}{0} {0}{3}{0} {4};",
159-
ESCAPED_QUOTE, GetProjectPath(), GetExportSettingsPath(), GetImportSettingsPath(), (IsHeadlessInstall()?1:0));
158+
return string.Format("unityConfigure {0}{1}{0} {0}{2}{0} {0}{3}{0} {4} {5};",
159+
ESCAPED_QUOTE, GetProjectPath(), GetExportSettingsPath(), GetImportSettingsPath(), (IsHeadlessInstall()?1:0), (HideOtherMenuMaya()?1:0));
160160
}}
161161

162162
private string MAYA_CLOSE_COMMAND { get {
@@ -181,6 +181,11 @@ public static bool IsHeadlessInstall ()
181181
return false;
182182
}
183183

184+
public static bool HideOtherMenuMaya()
185+
{
186+
return EditorTools.ExportSettings.instance.HideOtherMenuMaya;
187+
}
188+
184189
public string GetModuleTemplatePath()
185190
{
186191
return System.IO.Path.Combine(INTEGRATION_FOLDER_PATH, MODULE_TEMPLATE_PATH);

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+
$removeOtherMenu = `optionVar -q "UnityFbxForMaya_RemoveOtherMenu"`;
81+
if($removeOtherMenu){
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 $removeOtherMenu)
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_RemoveOtherMenu" $removeOtherMenu;
1214

1315
return;
1416
}

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,14 @@ global proc unitySetupUI(){
2424
// headless install, don't add UI
2525
return;
2626
}
27-
27+
2828
evalDeferred -lowestPriority "buildFileMenu; \
29+
\
30+
$removeOtherMenu = `optionVar -q \"UnityFbxForMaya_RemoveOtherMenu\"`;\
31+
if($removeOtherMenu){\
32+
menu -e -visible false \"sendToUnityMenu\";\
33+
}\
34+
\
2935
$parentMenu = $gMainFileMenu; \
3036
$pluginVersion = unityWhatsNewVersion(); \
3137
source \"unityCommands.mel\"; \

0 commit comments

Comments
 (0)