Skip to content

Commit 822579a

Browse files
committed
fix so max integration works with zip file
- move files + remove Maya specific zip file code
1 parent c376c18 commit 822579a

File tree

4 files changed

+23
-38
lines changed

4 files changed

+23
-38
lines changed

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 23 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ public static bool InstallMaya(bool verbose = false)
372372

373373
class MaxIntegration
374374
{
375-
private const string MaxScriptsPath = "FbxExporters/Integrations/Autodesk/max/scripts/";
375+
private const string MaxScriptsPath = "Integrations/Autodesk/max/scripts/";
376376

377377
private const string PluginName = "UnityFbxForMaxPlugin.ms";
378378
private const string PluginPath = MaxScriptsPath + PluginName;
@@ -387,12 +387,12 @@ class MaxIntegration
387387
private const string ExportSettingsTag = "UnityFbxExportSettings";
388388

389389
/// <summary>
390-
/// Gets the absolute Unity path for relative path in Assets folder.
390+
/// Gets the absolute Unity path for relative path in Integrations folder.
391391
/// </summary>
392392
/// <returns>The absolute path.</returns>
393393
/// <param name="relPath">Relative path.</param>
394394
public static string GetAbsPath(string relPath){
395-
return Application.dataPath + "/" + relPath;
395+
return Integrations.INTEGRATION_FOLDER_PATH + "/" + relPath;
396396
}
397397

398398
private static string GetInstallScript(){
@@ -496,15 +496,6 @@ public static void InstallDCCIntegration ()
496496
if (string.IsNullOrEmpty (dccExe)) {
497497
return;
498498
}
499-
string dccType = System.IO.Path.GetFileNameWithoutExtension (dccExe).ToLower();
500-
if (dccType.Equals ("maya")) {
501-
InstallMayaIntegration (dccExe);
502-
return;
503-
}
504-
if (dccType.Equals ("3dsmax")) {
505-
InstallMaxIntegration (dccExe);
506-
return;
507-
}
508499

509500
// decompress zip file if it exists, otherwise try using default location
510501
if (System.IO.File.Exists (GetIntegrationZipFullPath())) {
@@ -517,27 +508,36 @@ public static void InstallDCCIntegration ()
517508
Integrations.INTEGRATION_FOLDER_PATH = DefaultIntegrationSavePath;
518509
}
519510

511+
string dccType = System.IO.Path.GetFileNameWithoutExtension (dccExe).ToLower();
512+
if (dccType.Equals ("maya")) {
513+
InstallMayaIntegration (dccExe);
514+
return;
515+
}
516+
if (dccType.Equals ("3dsmax")) {
517+
InstallMaxIntegration (dccExe);
518+
return;
519+
}
520+
}
521+
522+
public static void InstallMayaIntegration (string mayaExe)
523+
{
520524
if (!Integrations.InstallMaya(verbose: true)) {
521525
return;
522526
}
523527

524528
int exitCode = Integrations.ConfigureMaya (mayaExe);
529+
ShowSuccessDialog ("Maya", exitCode);
530+
}
525531

526-
string title, message;
527-
if (exitCode != 0) {
528-
title = "Failed to install Maya Integration.";
529-
message = string.Format("Failed to configure Maya, please check logs (exitcode={0}).", exitCode);
530-
} else {
531-
title = "Completed installation of Maya Integration.";
532-
message = "Enjoy the new \"Unity\" menu in Maya.";
533-
}
534-
UnityEditor.EditorUtility.DisplayDialog (title, message, "Ok");
532+
public static void InstallMaxIntegration(string maxExe){
533+
int exitCode = MaxIntegration.InstallMaxPlugin (maxExe);
534+
ShowSuccessDialog ("3DsMax", exitCode);
535535
}
536536

537537
private static bool DecompressIntegrationZipFile()
538538
{
539539
// prompt user to enter location to unzip file
540-
var unzipFolder = EditorUtility.OpenFolderPanel("Select Location to Save Maya Integration",LastIntegrationSavePath,"");
540+
var unzipFolder = EditorUtility.OpenFolderPanel("Select Location to Save DCC Integration",LastIntegrationSavePath,"");
541541
if (string.IsNullOrEmpty (unzipFolder)) {
542542
// user has cancelled, do nothing
543543
return false;
@@ -553,7 +553,7 @@ private static bool DecompressIntegrationZipFile()
553553
);
554554

555555
if (result) {
556-
InstallMayaIntegration ();
556+
InstallDCCIntegration ();
557557
} else {
558558
return false;
559559
}
@@ -595,16 +595,6 @@ private static string GetIntegrationZipFullPath()
595595
return Application.dataPath + "/" + IntegrationZipPath;
596596
}
597597

598-
public static void InstallMayaIntegration (string mayaExe)
599-
{
600-
if (!Integrations.InstallMaya(verbose: true)) {
601-
return;
602-
}
603-
604-
int exitCode = Integrations.ConfigureMaya (mayaExe);
605-
ShowSuccessDialog ("Maya", exitCode);
606-
}
607-
608598
/// <summary>
609599
/// Determines if folder is already unzipped at the specified path
610600
/// by checking if unityoneclick.txt exists at expected location.
@@ -645,11 +635,6 @@ public static bool DirectoryHasWritePermission(string path)
645635
}
646636
}
647637

648-
public static void InstallMaxIntegration(string maxExe){
649-
int exitCode = MaxIntegration.InstallMaxPlugin (maxExe);
650-
ShowSuccessDialog ("3DsMax", exitCode);
651-
}
652-
653638
public static void DecompressZip(string zipPath, string destPath){
654639
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
655640
var ZIPAPP = "7z.exe";

0 commit comments

Comments
 (0)