Skip to content

Commit c45409c

Browse files
committed
move MaxIntegrationsUI into Integrations UI
refactor dialog code into a function
1 parent 25c8ad7 commit c45409c

File tree

2 files changed

+40
-44
lines changed

2 files changed

+40
-44
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public override void OnInspectorGUI() {
162162
}
163163

164164
if (GUILayout.Button ("Install 3DS Max Integration")) {
165-
FbxExporters.Editor.MaxIntegrationUI.InstallIntegration ();
165+
FbxExporters.Editor.IntegrationsUI.InstallMaxIntegration ();
166166
}
167167

168168
GUILayout.FlexibleSpace ();

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -356,40 +356,6 @@ public static bool InstallMaya(bool verbose = false)
356356
}
357357
}
358358

359-
class IntegrationsUI
360-
{
361-
/// <summary>
362-
/// The path of the Maya executable.
363-
/// </summary>
364-
public static string GetMayaExe () {
365-
return FbxExporters.EditorTools.ExportSettings.GetSelectedMayaPath ();
366-
}
367-
368-
public static void InstallMayaIntegration ()
369-
{
370-
var mayaExe = GetMayaExe ();
371-
if (string.IsNullOrEmpty (mayaExe)) {
372-
return;
373-
}
374-
375-
if (!Integrations.InstallMaya(verbose: true)) {
376-
return;
377-
}
378-
379-
int exitCode = Integrations.ConfigureMaya (mayaExe);
380-
381-
string title, message;
382-
if (exitCode != 0) {
383-
title = "Failed to install Maya Integration.";
384-
message = string.Format("Failed to configure Maya, please check logs (exitcode={0}).", exitCode);
385-
} else {
386-
title = "Completed installation of Maya Integration.";
387-
message = "Enjoy the new \"Unity\" menu in Maya.";
388-
}
389-
UnityEditor.EditorUtility.DisplayDialog (title, message, "Ok");
390-
}
391-
}
392-
393359
class MaxIntegration
394360
{
395361
private const string MaxScriptsPath = "FbxExporters/Integrations/Autodesk/max/scripts/";
@@ -478,22 +444,52 @@ public static int InstallMaxPlugin(){
478444
}
479445
return ExitCode;
480446
}
481-
482447
}
483448

484-
class MaxIntegrationUI{
485-
public static void InstallIntegration()
486-
{
487-
int exitCode = MaxIntegration.InstallMaxPlugin ();
449+
class IntegrationsUI
450+
{
451+
/// <summary>
452+
/// The path of the Maya executable.
453+
/// </summary>
454+
public static string GetMayaExe () {
455+
return FbxExporters.EditorTools.ExportSettings.GetSelectedMayaPath ();
456+
}
457+
458+
/// <summary>
459+
/// Opens a dialog showing whether the installation succeeded.
460+
/// </summary>
461+
/// <param name="dcc">Dcc name.</param>
462+
private static void ShowSuccessDialog(string dcc, int exitCode){
488463
string title, message;
489464
if (exitCode != 0) {
490-
title = "Failed to install 3DsMax Integration.";
491-
message = string.Format("Failed to configure 3DsMax, please check logs (exitcode={0}).", exitCode);
465+
title = string.Format("Failed to install {0} Integration.", dcc);
466+
message = string.Format("Failed to configure {0}, please check logs (exitcode={1}).", dcc, exitCode);
492467
} else {
493-
title = "Completed installation of 3DsMax Integration.";
494-
message = "Enjoy the new Unity menu in 3DsMax.";
468+
title = string.Format("Completed installation of {0} Integration.", dcc);
469+
message = string.Format("Enjoy the new Unity menu in {0}.", dcc);
495470
}
496471
UnityEditor.EditorUtility.DisplayDialog (title, message, "Ok");
497472
}
473+
474+
public static void InstallMayaIntegration ()
475+
{
476+
var mayaExe = GetMayaExe ();
477+
if (string.IsNullOrEmpty (mayaExe)) {
478+
return;
479+
}
480+
481+
if (!Integrations.InstallMaya(verbose: true)) {
482+
return;
483+
}
484+
485+
int exitCode = Integrations.ConfigureMaya (mayaExe);
486+
ShowSuccessDialog ("Maya", exitCode);
487+
}
488+
489+
public static void InstallMaxIntegration()
490+
{
491+
int exitCode = MaxIntegration.InstallMaxPlugin ();
492+
ShowSuccessDialog ("3DsMax", exitCode);
493+
}
498494
}
499495
}

0 commit comments

Comments
 (0)