@@ -324,7 +324,12 @@ public static int ConfigureMaya(string mayaPath)
324
324
ExitCode = myProcess . ExitCode ;
325
325
Debug . Log ( string . Format ( "Ran maya: [{0}]\n With args [{1}]\n Result {2}" ,
326
326
mayaPath , myProcess . StartInfo . Arguments , ExitCode ) ) ;
327
- }
327
+
328
+ if ( EditorTools . ExportSettings . instance . launchAfterInstallation )
329
+ {
330
+ LaunchMaya ( mayaPath ) ;
331
+ }
332
+ }
328
333
catch ( Exception e )
329
334
{
330
335
UnityEngine . Debug . LogError ( string . Format ( "Exception failed to start Maya ({0})" , e . Message ) ) ;
@@ -333,6 +338,18 @@ public static int ConfigureMaya(string mayaPath)
333
338
return ExitCode ;
334
339
}
335
340
341
+ public static void LaunchMaya ( string mayaPath )
342
+ {
343
+ System . Diagnostics . Process myProcess = new System . Diagnostics . Process ( ) ;
344
+ myProcess . StartInfo . FileName = mayaPath ;
345
+ myProcess . StartInfo . WindowStyle = System . Diagnostics . ProcessWindowStyle . Normal ;
346
+ myProcess . StartInfo . CreateNoWindow = false ;
347
+ myProcess . StartInfo . UseShellExecute = false ;
348
+
349
+ myProcess . EnableRaisingEvents = false ;
350
+ myProcess . Start ( ) ;
351
+ }
352
+
336
353
public static bool InstallMaya ( bool verbose = false )
337
354
{
338
355
// What's happening here is that we copy the module template to
@@ -532,8 +549,13 @@ public static int InstallMaxPlugin(string maxExe){
532
549
myProcess . WaitForExit ( ) ;
533
550
ExitCode = myProcess . ExitCode ;
534
551
552
+ if ( EditorTools . ExportSettings . instance . launchAfterInstallation )
553
+ {
554
+ LaunchMax ( maxExe ) ;
555
+ }
556
+
535
557
// TODO (UNI-29910): figure out what exactly causes this exit code + how to resolve
536
- if ( ExitCode == - 1073740791 ) {
558
+ if ( ExitCode == - 1073740791 ) {
537
559
Debug . Log ( string . Format ( "Detected 3ds max exitcode {0} -- safe to ignore" , ExitCode ) ) ;
538
560
ExitCode = 0 ;
539
561
}
@@ -545,10 +567,22 @@ public static int InstallMaxPlugin(string maxExe){
545
567
{
546
568
UnityEngine . Debug . LogError ( string . Format ( "Exception failed to start Max ({0})" , e . Message ) ) ;
547
569
ExitCode = - 1 ;
548
- }
570
+ }
549
571
return ExitCode ;
550
572
}
551
573
574
+ public static void LaunchMax ( string maxPath )
575
+ {
576
+ System . Diagnostics . Process myProcess = new System . Diagnostics . Process ( ) ;
577
+ myProcess . StartInfo . FileName = maxPath ;
578
+ myProcess . StartInfo . WindowStyle = System . Diagnostics . ProcessWindowStyle . Normal ;
579
+ myProcess . StartInfo . CreateNoWindow = false ;
580
+ myProcess . StartInfo . UseShellExecute = false ;
581
+
582
+ myProcess . EnableRaisingEvents = false ;
583
+ myProcess . Start ( ) ;
584
+ }
585
+
552
586
public override int InstallIntegration ( string maxExe ) {
553
587
return MaxIntegration . InstallMaxPlugin ( maxExe ) ;
554
588
}
0 commit comments