@@ -395,14 +395,11 @@ class MaxIntegration
395
395
private const string PluginName = "unityOneClickPlugin.ms" ;
396
396
private const string PluginPath = "FbxExporters/Integrations/Autodesk/max/scripts/" + PluginName ;
397
397
398
- private const string InstallMaxScriptTemplate =
399
- @"temp = pathConfig.GetDir(#userStartupScripts) + \""/{UnityPluginScript_Name}\"";" +
400
- @"deleteFile temp;" +
401
- @"copyFile \""{UnityPluginScript_Source}\"" temp;" +
402
- @"quitMax()" ;
398
+ private const string ConfigureMaxScript = "FbxExporters/Integrations/Autodesk/max/scripts/configureUnityFbxForMax.ms" ;
403
399
404
- private const string PluginSourceTag = "{UnityPluginScript_Source}" ;
405
- private const string PluginNameTag = "{UnityPluginScript_Name}" ;
400
+ private const string PluginSourceTag = "UnityPluginScript_Source" ;
401
+ private const string PluginNameTag = "UnityPluginScript_Name" ;
402
+ private const string ProjectTag = "UnityProject" ;
406
403
407
404
// TODO: get this from the export settings
408
405
private static string GetMaxExe ( ) {
@@ -413,13 +410,16 @@ private static string GetInstallScript(){
413
410
Dictionary < string , string > Tokens = new Dictionary < string , string > ( )
414
411
{
415
412
{ PluginSourceTag , ( Application . dataPath + "/" + PluginPath ) } ,
416
- { PluginNameTag , PluginName }
413
+ { PluginNameTag , PluginName } ,
414
+ { ProjectTag , Integrations . GetProjectPath ( ) }
417
415
} ;
418
416
419
- var installScript = InstallMaxScriptTemplate ;
417
+ var installScript = "" ;
418
+ // setup the variables to be used in the configure max script
420
419
foreach ( var t in Tokens ) {
421
- installScript = installScript . Replace ( t . Key , t . Value ) ;
420
+ installScript += string . Format ( @"global {0} = @\""{1}\"";" , t . Key , t . Value ) ;
422
421
}
422
+ installScript += string . Format ( @"filein \""{0}/{1}\""" , Application . dataPath , ConfigureMaxScript ) ;
423
423
return installScript ;
424
424
}
425
425
@@ -476,7 +476,7 @@ public static void InstallIntegration()
476
476
message = string . Format ( "Failed to configure 3DsMax, please check logs (exitcode={0})." , exitCode ) ;
477
477
} else {
478
478
title = "Completed installation of 3DsMax Integration." ;
479
- message = "Enjoy the new \" Unity\" menu in 3DsMax." ;
479
+ message = "Enjoy the new Unity menu in 3DsMax." ;
480
480
}
481
481
UnityEditor . EditorUtility . DisplayDialog ( title , message , "Ok" ) ;
482
482
}
0 commit comments