@@ -9,44 +9,50 @@ public abstract class DCCIntegration
9
9
public abstract string DccDisplayName { get ; }
10
10
public abstract string IntegrationZipPath { get ; }
11
11
12
- private static string m_integrationFolderPath = null ;
13
- public static string INTEGRATION_FOLDER_PATH
12
+ private static string s_integrationFolderPath = null ;
13
+ public static string IntegrationFolderPath
14
14
{
15
15
get {
16
- if ( string . IsNullOrEmpty ( m_integrationFolderPath ) ) {
17
- m_integrationFolderPath = Application . dataPath ;
16
+ if ( string . IsNullOrEmpty ( s_integrationFolderPath ) ) {
17
+ s_integrationFolderPath = Application . dataPath ;
18
18
}
19
- return m_integrationFolderPath ;
19
+ return s_integrationFolderPath ;
20
20
}
21
21
set {
22
22
if ( ! string . IsNullOrEmpty ( value ) && System . IO . Directory . Exists ( value ) ) {
23
- m_integrationFolderPath = value ;
23
+ s_integrationFolderPath = value ;
24
24
} else {
25
25
Debug . LogError ( string . Format ( "Failed to set integration folder path, invalid directory \" {0}\" " , value ) ) ;
26
26
}
27
27
}
28
28
}
29
29
30
30
public void SetIntegrationFolderPath ( string path ) {
31
- INTEGRATION_FOLDER_PATH = path ;
31
+ IntegrationFolderPath = path ;
32
32
}
33
33
34
34
/// <summary>
35
35
/// Gets the integration zip full path as an absolute Unity-style path.
36
36
/// </summary>
37
37
/// <returns>The integration zip full path.</returns>
38
- public string GetIntegrationZipFullPath ( )
38
+ public string IntegrationZipFullPath
39
39
{
40
- return System . IO . Path . GetFullPath ( "Packages/com.unity.formats.fbx/Editor/Integrations" ) . Replace ( "\\ " , "/" ) + "/" + IntegrationZipPath ;
40
+ get
41
+ {
42
+ return System . IO . Path . GetFullPath ( "Packages/com.unity.formats.fbx/Editor/Integrations" ) . Replace ( "\\ " , "/" ) + "/" + IntegrationZipPath ;
43
+ }
41
44
}
42
45
43
46
/// <summary>
44
47
/// Gets the project path.
45
48
/// </summary>
46
49
/// <returns>The project path.</returns>
47
- public static string GetProjectPath ( )
50
+ public static string ProjectPath
48
51
{
49
- return System . IO . Directory . GetParent ( Application . dataPath ) . FullName . Replace ( "\\ " , "/" ) ;
52
+ get
53
+ {
54
+ return System . IO . Directory . GetParent ( Application . dataPath ) . FullName . Replace ( "\\ " , "/" ) ;
55
+ }
50
56
}
51
57
52
58
/// <summary>
@@ -120,19 +126,19 @@ private static string MAYA_DOCUMENTS_PATH {
120
126
121
127
private static string MAYA_MODULES_PATH {
122
128
get {
123
- return System . IO . Path . Combine ( GetUserFolder ( ) , MAYA_DOCUMENTS_PATH + "/modules" ) ;
129
+ return System . IO . Path . Combine ( UserFolder , MAYA_DOCUMENTS_PATH + "/modules" ) ;
124
130
}
125
131
}
126
132
127
133
private static string MAYA_SCRIPTS_PATH {
128
134
get {
129
- return System . IO . Path . Combine ( GetUserFolder ( ) , MAYA_DOCUMENTS_PATH + "/scripts" ) ;
135
+ return System . IO . Path . Combine ( UserFolder , MAYA_DOCUMENTS_PATH + "/scripts" ) ;
130
136
}
131
137
}
132
138
133
139
// Use string to define escaped quote
134
140
// Windows needs the backslash
135
- protected static string ESCAPED_QUOTE {
141
+ protected static string EscapedQuote {
136
142
get {
137
143
switch ( Application . platform ) {
138
144
case RuntimePlatform . WindowsEditor :
@@ -145,24 +151,28 @@ protected static string ESCAPED_QUOTE {
145
151
}
146
152
}
147
153
148
- protected string MAYA_CONFIG_COMMAND { get {
154
+ protected string MayaConfigCommand { get {
149
155
return string . Format ( "unityConfigure {0}{1}{0} {0}{2}{0} {0}{3}{0} {4} {5};" ,
150
- ESCAPED_QUOTE , GetProjectPath ( ) , GetExportSettingsPath ( ) , GetImportSettingsPath ( ) , ( IsHeadlessInstall ( ) ) , ( HideSendToUnityMenu ) ) ;
156
+ EscapedQuote , ProjectPath , ExportSettingsPath , ImportSettingsPath , ( IsHeadlessInstall ( ) ) , ( HideSendToUnityMenu ) ) ;
151
157
} }
152
158
153
159
private string MAYA_CLOSE_COMMAND { get {
154
160
return string . Format ( "scriptJob -idleEvent quit;" ) ;
155
161
} }
156
162
157
- protected static string GetUserFolder ( )
163
+ protected static string UserFolder
158
164
{
159
- switch ( Application . platform ) {
160
- case RuntimePlatform . WindowsEditor :
161
- return System . Environment . GetFolderPath ( System . Environment . SpecialFolder . Personal ) ;
162
- case RuntimePlatform . OSXEditor :
163
- return System . Environment . GetEnvironmentVariable ( "HOME" ) ;
164
- default :
165
- throw new NotImplementedException ( ) ;
165
+ get
166
+ {
167
+ switch ( Application . platform )
168
+ {
169
+ case RuntimePlatform . WindowsEditor :
170
+ return System . Environment . GetFolderPath ( System . Environment . SpecialFolder . Personal ) ;
171
+ case RuntimePlatform . OSXEditor :
172
+ return System . Environment . GetEnvironmentVariable ( "HOME" ) ;
173
+ default :
174
+ throw new NotImplementedException ( ) ;
175
+ }
166
176
}
167
177
}
168
178
@@ -178,33 +188,45 @@ public static int HideSendToUnityMenu
178
188
}
179
189
}
180
190
181
- public string GetModuleTemplatePath ( )
191
+ public string ModuleTemplatePath
182
192
{
183
- return System . IO . Path . Combine ( INTEGRATION_FOLDER_PATH , MODULE_TEMPLATE_PATH ) ;
193
+ get
194
+ {
195
+ return System . IO . Path . Combine ( IntegrationFolderPath , MODULE_TEMPLATE_PATH ) ;
196
+ }
184
197
}
185
198
186
- public static string GetPackagePath ( )
199
+ public static string PackagePath
187
200
{
188
- return System . IO . Path . Combine ( Application . dataPath , PACKAGE_NAME ) ;
201
+ get
202
+ {
203
+ return System . IO . Path . Combine ( Application . dataPath , PACKAGE_NAME ) ;
204
+ }
189
205
}
190
206
191
207
/// <summary>
192
208
/// Gets the path to the export settings file.
193
209
/// Returns a relative path with forward slashes as path separators.
194
210
/// </summary>
195
211
/// <returns>The export settings path.</returns>
196
- public string GetExportSettingsPath ( )
212
+ public string ExportSettingsPath
197
213
{
198
- return INTEGRATION_FOLDER_PATH + FBX_EXPORT_SETTINGS_PATH ;
214
+ get
215
+ {
216
+ return IntegrationFolderPath + FBX_EXPORT_SETTINGS_PATH ;
217
+ }
199
218
}
200
219
201
220
/// <summary>
202
221
/// Gets the path to the import settings file.
203
222
/// Returns a relative path with forward slashes as path separators.
204
223
/// </summary>
205
224
/// <returns>The import settings path.</returns>
206
- public string GetImportSettingsPath ( ) {
207
- return INTEGRATION_FOLDER_PATH + FBX_IMPORT_SETTINGS_PATH ;
225
+ public string ImportSettingsPath {
226
+ get
227
+ {
228
+ return IntegrationFolderPath + FBX_IMPORT_SETTINGS_PATH ;
229
+ }
208
230
}
209
231
210
232
/// <summary>
@@ -216,9 +238,12 @@ private static string GetUserStartupScriptPath(){
216
238
return MAYA_SCRIPTS_PATH + "/" + MAYA_USER_STARTUP_SCRIPT ;
217
239
}
218
240
219
- public static string GetPackageVersion ( )
241
+ public static string PackageVersion
220
242
{
221
- return ModelExporter . GetVersionFromReadme ( ) ;
243
+ get
244
+ {
245
+ return ModelExporter . GetVersionFromReadme ( ) ;
246
+ }
222
247
}
223
248
224
249
private static List < string > ParseTemplateFile ( string FileName , Dictionary < string , string > Tokens )
@@ -337,11 +362,11 @@ public int ConfigureMaya(string mayaPath)
337
362
{
338
363
myProcess . StartInfo . WindowStyle = System . Diagnostics . ProcessWindowStyle . Normal ;
339
364
myProcess . StartInfo . CreateNoWindow = false ;
340
- myProcess . StartInfo . Arguments = string . Format ( commandString , MAYA_CONFIG_COMMAND ) ;
365
+ myProcess . StartInfo . Arguments = string . Format ( commandString , MayaConfigCommand ) ;
341
366
}
342
367
else
343
368
{
344
- myProcess . StartInfo . Arguments = string . Format ( commandString , MAYA_CONFIG_COMMAND + MAYA_CLOSE_COMMAND ) ;
369
+ myProcess . StartInfo . Arguments = string . Format ( commandString , MayaConfigCommand + MAYA_CLOSE_COMMAND ) ;
345
370
}
346
371
347
372
myProcess . EnableRaisingEvents = true ;
@@ -384,7 +409,7 @@ public bool InstallMaya(bool verbose = false)
384
409
// - done.
385
410
// But it's complicated because we can't trust any files actually exist.
386
411
387
- string moduleTemplatePath = GetModuleTemplatePath ( ) ;
412
+ string moduleTemplatePath = ModuleTemplatePath ;
388
413
if ( ! System . IO . File . Exists ( moduleTemplatePath ) )
389
414
{
390
415
Debug . LogError ( string . Format ( "Missing Maya module file at: \" {0}\" " , moduleTemplatePath ) ) ;
@@ -432,9 +457,9 @@ public bool InstallMaya(bool verbose = false)
432
457
{
433
458
Dictionary < string , string > Tokens = new Dictionary < string , string > ( )
434
459
{
435
- { VERSION_TAG , GetPackageVersion ( ) } ,
436
- { PROJECT_TAG , GetProjectPath ( ) } ,
437
- { INTEGRATION_TAG , INTEGRATION_FOLDER_PATH } ,
460
+ { VERSION_TAG , PackageVersion } ,
461
+ { PROJECT_TAG , ProjectPath } ,
462
+ { INTEGRATION_TAG , IntegrationFolderPath } ,
438
463
} ;
439
464
440
465
// parse template, replace "{UnityProject}" with project path
@@ -502,13 +527,13 @@ private bool SetupUserStartupScript(bool verbose = false){
502
527
return true ;
503
528
}
504
529
505
- public override int InstallIntegration ( string mayaExe )
530
+ public override int InstallIntegration ( string exe )
506
531
{
507
532
if ( ! InstallMaya ( verbose : true ) ) {
508
533
return - 1 ;
509
534
}
510
535
511
- return ConfigureMaya ( mayaExe ) ;
536
+ return ConfigureMaya ( exe ) ;
512
537
}
513
538
514
539
/// <summary>
@@ -559,15 +584,15 @@ public class MaxIntegration : DCCIntegration
559
584
/// <returns>The absolute path.</returns>
560
585
/// <param name="relPath">Relative path.</param>
561
586
public static string GetAbsPath ( string relPath ) {
562
- return MayaIntegration . INTEGRATION_FOLDER_PATH + "/" + relPath ;
587
+ return MayaIntegration . IntegrationFolderPath + "/" + relPath ;
563
588
}
564
589
565
590
private static string GetInstallScript ( ) {
566
591
Dictionary < string , string > Tokens = new Dictionary < string , string > ( )
567
592
{
568
593
{ PluginSourceTag , GetAbsPath ( PluginPath ) } ,
569
594
{ PluginNameTag , PluginName } ,
570
- { ProjectTag , GetProjectPath ( ) } ,
595
+ { ProjectTag , ProjectPath } ,
571
596
{ ExportSettingsTag , GetAbsPath ( ExportSettingsFile ) } ,
572
597
{ ImportSettingsTag , GetAbsPath ( ImportSettingsFile ) }
573
598
} ;
@@ -642,8 +667,8 @@ public static int InstallMaxPlugin(string maxExe){
642
667
return ExitCode ;
643
668
}
644
669
645
- public override int InstallIntegration ( string maxExe ) {
646
- return MaxIntegration . InstallMaxPlugin ( maxExe ) ;
670
+ public override int InstallIntegration ( string exe ) {
671
+ return MaxIntegration . InstallMaxPlugin ( exe ) ;
647
672
}
648
673
649
674
/// <summary>
@@ -661,7 +686,7 @@ public override bool FolderAlreadyUnzippedAtPath(string path)
661
686
}
662
687
}
663
688
664
- class IntegrationsUI
689
+ static class IntegrationsUI
665
690
{
666
691
/// <summary>
667
692
/// The path of the DCC executable.
@@ -734,7 +759,7 @@ public static void InstallDCCIntegration ()
734
759
735
760
private static bool GetIntegrationFolder ( DCCIntegration dcc ) {
736
761
// decompress zip file if it exists, otherwise try using default location
737
- var zipPath = dcc . GetIntegrationZipFullPath ( ) ;
762
+ var zipPath = dcc . IntegrationZipFullPath ;
738
763
if ( System . IO . File . Exists ( zipPath ) ) {
739
764
return DecompressIntegrationZipFile ( zipPath , dcc ) ;
740
765
}
0 commit comments