@@ -88,12 +88,12 @@ class MayaIntegration : DCCIntegration
88
88
89
89
public override string IntegrationZipPath { get { return "FbxExporters/UnityFbxForMaya.zip" ; } }
90
90
91
- public const string TEMP_SAVE_PATH = "_safe_to_delete" ;
91
+ private string FBX_EXPORT_SETTINGS_PATH { get { return "/Integrations/Autodesk/maya/scripts/unityFbxExportSettings.mel" ; } }
92
92
93
- protected virtual string FBX_EXPORT_SETTINGS_PATH { get { return "/Integrations/Autodesk/maya/scripts/unityFbxExportSettings .mel" ; } }
93
+ private string FBX_IMPORT_SETTINGS_PATH { get { return "/Integrations/Autodesk/maya/scripts/unityFbxImportSettings .mel" ; } }
94
94
95
- protected virtual string MODULE_TEMPLATE_PATH { get { return "Integrations/Autodesk/maya/" + MODULE_FILENAME + ".txt" ; } }
96
- protected virtual string MODULE_FILENAME { get { return "UnityFbxForMaya" ; } }
95
+ private string MODULE_TEMPLATE_PATH { get { return "Integrations/Autodesk/maya/" + MODULE_FILENAME + ".txt" ; } }
96
+ private string MODULE_FILENAME { get { return "UnityFbxForMaya" ; } }
97
97
98
98
private const string PACKAGE_NAME = "FbxExporters" ;
99
99
private const string VERSION_FILENAME = "README.txt" ;
@@ -102,9 +102,11 @@ class MayaIntegration : DCCIntegration
102
102
private const string PROJECT_TAG = "{UnityProject}" ;
103
103
private const string INTEGRATION_TAG = "{UnityIntegrationsPath}" ;
104
104
105
- private const string MAYA_INSTRUCTION_FILENAME = "_safe_to_delete/_temp.txt" ;
105
+ private const string MAYA_USER_STARTUP_SCRIPT = "userSetup.mel" ;
106
+
107
+ private const string USER_STARTUP_CALL = "if(`exists setupUnityUI`){ setupUnityUI; }" ;
106
108
107
- protected static string MAYA_DOCUMENTS_PATH {
109
+ private static string MAYA_DOCUMENTS_PATH {
108
110
get {
109
111
switch ( Application . platform ) {
110
112
case RuntimePlatform . WindowsEditor :
@@ -123,6 +125,12 @@ private static string MAYA_MODULES_PATH {
123
125
}
124
126
}
125
127
128
+ private static string MAYA_SCRIPTS_PATH {
129
+ get {
130
+ return System . IO . Path . Combine ( GetUserFolder ( ) , MAYA_DOCUMENTS_PATH + "/scripts" ) ;
131
+ }
132
+ }
133
+
126
134
// Use string to define escaped quote
127
135
// Windows needs the backslash
128
136
protected static string ESCAPED_QUOTE {
@@ -138,11 +146,10 @@ protected static string ESCAPED_QUOTE {
138
146
}
139
147
}
140
148
141
- protected virtual string MAYA_CONFIG_COMMAND { get {
142
- return string . Format ( "configureUnityFbxForMaya {0}{1}{0} {0}{2}{0} {0}{3}{0} {0}{4}{0} {0}{5}{0} {6};" ,
143
- ESCAPED_QUOTE , GetProjectPath ( ) , GetAppPath ( ) , GetTempSavePath ( ) ,
144
- GetExportSettingsPath ( ) , GetMayaInstructionPath ( ) , ( IsHeadlessInstall ( ) ? 1 : 0 ) ) ;
145
- } }
149
+ protected string MAYA_CONFIG_COMMAND { get {
150
+ return string . Format ( "configureUnityFbxForMaya {0}{1}{0} {0}{2}{0} {0}{3}{0} {4};" ,
151
+ ESCAPED_QUOTE , GetProjectPath ( ) , GetExportSettingsPath ( ) , GetImportSettingsPath ( ) , ( IsHeadlessInstall ( ) ? 1 : 0 ) ) ;
152
+ } }
146
153
147
154
private string MAYA_CLOSE_COMMAND { get {
148
155
return string . Format ( "scriptJob -idleEvent quit;" ) ;
@@ -171,48 +178,37 @@ public string GetModuleTemplatePath()
171
178
return System . IO . Path . Combine ( INTEGRATION_FOLDER_PATH , MODULE_TEMPLATE_PATH ) ;
172
179
}
173
180
174
- public static string GetAppPath ( )
175
- {
176
- return EditorApplication . applicationPath . Replace ( "\\ " , "/" ) ;
177
- }
178
-
179
181
public static string GetPackagePath ( )
180
182
{
181
183
return System . IO . Path . Combine ( Application . dataPath , PACKAGE_NAME ) ;
182
184
}
183
185
184
- public static string GetTempSavePath ( )
185
- {
186
- return TEMP_SAVE_PATH . Replace ( "\\ " , "/" ) ;
187
- }
188
-
189
186
/// <summary>
190
- /// Gets the maya instruction path relative to the Assets folder .
191
- /// Assets folder is not included in the path.
187
+ /// Gets the path to the export settings file .
188
+ /// Returns a relative path with forward slashes as path separators .
192
189
/// </summary>
193
- /// <returns>The relative maya instruction path.</returns>
194
- public static string GetMayaInstructionPath ( )
190
+ /// <returns>The export settings path.</returns>
191
+ public string GetExportSettingsPath ( )
195
192
{
196
- return MAYA_INSTRUCTION_FILENAME ;
193
+ return INTEGRATION_FOLDER_PATH + FBX_EXPORT_SETTINGS_PATH ;
197
194
}
198
195
199
196
/// <summary>
200
- /// Gets the full maya instruction path as an absolute Unity path.
197
+ /// Gets the path to the import settings file.
198
+ /// Returns a relative path with forward slashes as path separators.
201
199
/// </summary>
202
- /// <returns>The full maya instruction path.</returns>
203
- public static string GetFullMayaInstructionPath ( )
204
- {
205
- return Application . dataPath + "/" + FbxExporters . Editor . MayaIntegration . GetMayaInstructionPath ( ) ;
200
+ /// <returns>The import settings path.</returns>
201
+ public string GetImportSettingsPath ( ) {
202
+ return INTEGRATION_FOLDER_PATH + FBX_IMPORT_SETTINGS_PATH ;
206
203
}
207
204
208
205
/// <summary>
209
- /// Gets the path to the export settings file .
206
+ /// Gets the user startup script path .
210
207
/// Returns a relative path with forward slashes as path separators.
211
208
/// </summary>
212
- /// <returns>The export settings path.</returns>
213
- public string GetExportSettingsPath ( )
214
- {
215
- return INTEGRATION_FOLDER_PATH + FBX_EXPORT_SETTINGS_PATH ;
209
+ /// <returns>The user startup script path.</returns>
210
+ private static string GetUserStartupScriptPath ( ) {
211
+ return MAYA_SCRIPTS_PATH + "/" + MAYA_USER_STARTUP_SCRIPT ;
216
212
}
217
213
218
214
public static string GetPackageVersion ( )
@@ -399,7 +395,7 @@ public int ConfigureMaya(string mayaPath)
399
395
return ExitCode ;
400
396
}
401
397
402
- public virtual bool InstallMaya ( bool verbose = false )
398
+ public bool InstallMaya ( bool verbose = false )
403
399
{
404
400
// What's happening here is that we copy the module template to
405
401
// the module path, basically:
@@ -482,87 +478,10 @@ public virtual bool InstallMaya(bool verbose = false)
482
478
// TODO: print message package already installed else where
483
479
}
484
480
485
- return true ;
486
- }
487
-
488
-
489
- public override int InstallIntegration ( string mayaExe )
490
- {
491
- if ( ! InstallMaya ( verbose : true ) ) {
492
- return - 1 ;
493
- }
494
-
495
- return ConfigureMaya ( mayaExe ) ;
496
- }
497
-
498
- /// <summary>
499
- /// Determines if folder is already unzipped at the specified path
500
- /// by checking if UnityFbxForMaya.txt exists at expected location.
501
- /// </summary>
502
- /// <returns><c>true</c> if folder is already unzipped at the specified path; otherwise, <c>false</c>.</returns>
503
- /// <param name="path">Path.</param>
504
- public override bool FolderAlreadyUnzippedAtPath ( string path )
505
- {
506
- if ( string . IsNullOrEmpty ( path ) ) {
507
- return false ;
508
- }
509
- return System . IO . File . Exists ( System . IO . Path . Combine ( path , MODULE_TEMPLATE_PATH ) ) ;
510
- }
511
- }
512
-
513
- class MayaLTIntegration : MayaIntegration
514
- {
515
- public override string DccDisplayName { get { return "Maya LT" ; } }
516
-
517
- public override string IntegrationZipPath { get { return "FbxExporters/UnityFbxForMayaLT.zip" ; } }
518
-
519
- protected override string MODULE_TEMPLATE_PATH { get { return "Integrations/Autodesk/mayalt/" + MODULE_FILENAME + ".txt" ; } }
520
-
521
- protected override string MODULE_FILENAME { get { return "UnityFbxForMayaLT" ; } }
522
-
523
- protected override string FBX_EXPORT_SETTINGS_PATH { get { return "/Integrations/Autodesk/mayalt/scripts/unityFbxExportSettings.mel" ; } }
524
-
525
- protected string FBX_IMPORT_SETTINGS_PATH { get { return "/Integrations/Autodesk/mayalt/scripts/unityFbxImportSettings.mel" ; } }
526
-
527
- private const string MAYA_USER_STARTUP_SCRIPT = "userSetup.mel" ;
528
-
529
- private const string USER_STARTUP_CALL = "if(`exists setupUnityUI`){ setupUnityUI; }" ;
530
-
531
- protected override string MAYA_CONFIG_COMMAND { get {
532
- return string . Format ( "configureUnityFbxForMayaLT {0}{1}{0} {0}{2}{0} {0}{3}{0} {4};" ,
533
- ESCAPED_QUOTE , GetProjectPath ( ) , GetExportSettingsPath ( ) , GetImportSettingsPath ( ) , ( IsHeadlessInstall ( ) ? 1 : 0 ) ) ;
534
- } }
535
-
536
- private static string MAYA_SCRIPTS_PATH {
537
- get {
538
- return System . IO . Path . Combine ( GetUserFolder ( ) , MAYA_DOCUMENTS_PATH + "/scripts" ) ;
539
- }
540
- }
541
-
542
- /// <summary>
543
- /// Gets the path to the import settings file.
544
- /// Returns a relative path with forward slashes as path separators.
545
- /// </summary>
546
- /// <returns>The import settings path.</returns>
547
- public string GetImportSettingsPath ( ) {
548
- return INTEGRATION_FOLDER_PATH + FBX_IMPORT_SETTINGS_PATH ;
481
+ return SetupUserStartupScript ( verbose ) ;
549
482
}
550
483
551
- /// <summary>
552
- /// Gets the user startup script path.
553
- /// Returns a relative path with forward slashes as path separators.
554
- /// </summary>
555
- /// <returns>The user startup script path.</returns>
556
- private static string GetUserStartupScriptPath ( ) {
557
- return MAYA_SCRIPTS_PATH + "/" + MAYA_USER_STARTUP_SCRIPT ;
558
- }
559
-
560
- public override bool InstallMaya ( bool verbose = false )
561
- {
562
- if ( ! base . InstallMaya ( verbose ) ) {
563
- return false ;
564
- }
565
-
484
+ private bool SetupUserStartupScript ( bool verbose = false ) {
566
485
// setup user startup script
567
486
string mayaStartupScript = GetUserStartupScriptPath ( ) ;
568
487
string fileContents = string . Format ( "\n {0}" , USER_STARTUP_CALL ) ;
@@ -608,14 +527,33 @@ public override bool InstallMaya (bool verbose = false)
608
527
return true ;
609
528
}
610
529
611
- public override int InstallIntegration ( string mayaLTExe )
530
+ public override int InstallIntegration ( string mayaExe )
612
531
{
613
532
if ( ! InstallMaya ( verbose : true ) ) {
614
533
return - 1 ;
615
534
}
616
535
617
- return ConfigureMaya ( mayaLTExe ) ;
536
+ return ConfigureMaya ( mayaExe ) ;
618
537
}
538
+
539
+ /// <summary>
540
+ /// Determines if folder is already unzipped at the specified path
541
+ /// by checking if UnityFbxForMaya.txt exists at expected location.
542
+ /// </summary>
543
+ /// <returns><c>true</c> if folder is already unzipped at the specified path; otherwise, <c>false</c>.</returns>
544
+ /// <param name="path">Path.</param>
545
+ public override bool FolderAlreadyUnzippedAtPath ( string path )
546
+ {
547
+ if ( string . IsNullOrEmpty ( path ) ) {
548
+ return false ;
549
+ }
550
+ return System . IO . File . Exists ( System . IO . Path . Combine ( path , MODULE_TEMPLATE_PATH ) ) ;
551
+ }
552
+ }
553
+
554
+ class MayaLTIntegration : MayaIntegration
555
+ {
556
+ public override string DccDisplayName { get { return "Maya LT" ; } }
619
557
}
620
558
621
559
class MaxIntegration : DCCIntegration
0 commit comments