Skip to content

Commit 7515e75

Browse files
committed
unzip maya integration when installing
1 parent 7175848 commit 7515e75

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,10 +504,15 @@ namespace Editors
504504
class IntegrationsUI
505505
{
506506
const string MenuItemName1 = "FbxExporters/Install Maya Integration";
507+
const string IntegrationZipPath = "FbxExporters/unityoneclick_for_maya.zip";
507508

508509
[MenuItem (MenuItemName1, false, 0)]
509510
public static void OnMenuItem1 ()
510511
{
512+
// unzip Integration folder
513+
DecompressZip(Application.dataPath + "/" + IntegrationZipPath, Application.dataPath + "/TestIntegrations");
514+
return;
515+
511516
var mayaVersion = new Integrations.MayaVersion();
512517
if (!Integrations.InstallMaya(mayaVersion, verbose: true)) {
513518
return;
@@ -525,6 +530,22 @@ public static void OnMenuItem1 ()
525530
}
526531
UnityEditor.EditorUtility.DisplayDialog (title, message, "Ok");
527532
}
533+
534+
public static void DecompressZip(string zipPath, string destPath){
535+
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
536+
myProcess.StartInfo.FileName = string.Format("\"{0}\"", EditorApplication.applicationContentsPath + "/Tools/7z.exe");
537+
myProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
538+
myProcess.StartInfo.CreateNoWindow = true;
539+
myProcess.StartInfo.UseShellExecute = false;
540+
541+
myProcess.StartInfo.Arguments = string.Format("x \"{0}\" -o\"{1}\" -r -y", zipPath, destPath);
542+
myProcess.EnableRaisingEvents = true;
543+
myProcess.Start();
544+
myProcess.WaitForExit();
545+
546+
Debug.Log ("ran: " + myProcess.StartInfo.FileName + " " + myProcess.StartInfo.Arguments);
547+
Debug.Log ("exported to: " + destPath);
548+
}
528549
}
529550
}
530551
}

0 commit comments

Comments
 (0)