Skip to content

Commit 7a32649

Browse files
committed
call correct DCC on install button press
figure out which dcc is selected, and install the integration
1 parent 515d0ca commit 7a32649

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public override void OnInspectorGUI() {
154154
"Install Unity Integration",
155155
"Install and configure the Unity integration for the selected DCC so that you can import and export directly to this project.");
156156
if (GUILayout.Button (installIntegrationContent)) {
157-
//FbxExporters.Editor.IntegrationsUI.InstallMayaIntegration ();
157+
FbxExporters.Editor.IntegrationsUI.InstallDCCIntegration ();
158158
}
159159

160160
GUILayout.FlexibleSpace ();

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,6 @@ class MaxIntegration
372372
private const string ProjectTag = "UnityProject";
373373
private const string ExportSettingsTag = "UnityFbxExportSettings";
374374

375-
// TODO: get this from the export settings
376-
private static string GetMaxExe(){
377-
return "C:/Program Files/Autodesk/3ds Max 2018/3dsmax.exe";
378-
}
379-
380375
/// <summary>
381376
/// Gets the absolute Unity path for relative path in Assets folder.
382377
/// </summary>
@@ -404,8 +399,7 @@ private static string GetInstallScript(){
404399
return installScript;
405400
}
406401

407-
public static int InstallMaxPlugin(){
408-
var maxExe = GetMaxExe ();
402+
public static int InstallMaxPlugin(string maxExe){
409403
var installScript = GetInstallScript ();
410404

411405
int ExitCode = 0;
@@ -449,9 +443,9 @@ public static int InstallMaxPlugin(){
449443
class IntegrationsUI
450444
{
451445
/// <summary>
452-
/// The path of the Maya executable.
446+
/// The path of the DCC executable.
453447
/// </summary>
454-
public static string GetMayaExe () {
448+
public static string GetDCCExe () {
455449
return FbxExporters.EditorTools.ExportSettings.GetSelectedDCCPath ();
456450
}
457451

@@ -471,13 +465,25 @@ private static void ShowSuccessDialog(string dcc, int exitCode){
471465
UnityEditor.EditorUtility.DisplayDialog (title, message, "Ok");
472466
}
473467

474-
public static void InstallMayaIntegration ()
468+
public static void InstallDCCIntegration()
475469
{
476-
var mayaExe = GetMayaExe ();
477-
if (string.IsNullOrEmpty (mayaExe)) {
470+
var dccExe = GetDCCExe ();
471+
if (string.IsNullOrEmpty (dccExe)) {
472+
return;
473+
}
474+
string dccType = System.IO.Path.GetFileNameWithoutExtension (dccExe).ToLower();
475+
if (dccType.Equals ("maya")) {
476+
InstallMayaIntegration (dccExe);
478477
return;
479478
}
479+
if (dccType.Equals ("3dsmax")) {
480+
InstallMaxIntegration (dccExe);
481+
return;
482+
}
483+
}
480484

485+
public static void InstallMayaIntegration (string mayaExe)
486+
{
481487
if (!Integrations.InstallMaya(verbose: true)) {
482488
return;
483489
}
@@ -486,9 +492,9 @@ public static void InstallMayaIntegration ()
486492
ShowSuccessDialog ("Maya", exitCode);
487493
}
488494

489-
public static void InstallMaxIntegration()
495+
public static void InstallMaxIntegration(string maxExe)
490496
{
491-
int exitCode = MaxIntegration.InstallMaxPlugin ();
497+
int exitCode = MaxIntegration.InstallMaxPlugin (maxExe);
492498
ShowSuccessDialog ("3DsMax", exitCode);
493499
}
494500
}

0 commit comments

Comments
 (0)