Skip to content

Commit 19d4241

Browse files
author
AJubrey
committed
[CHANGED] redundant duplicate functions, we now just have FindDCCVersion() instead of findMayaVersion and findMaxVersion
[CHANGED] FindDCCVersion() now takes the version from the name of the application rather than the path, which will prevent confusion between mac and windows paths
1 parent 0269064 commit 19d4241

File tree

1 file changed

+8
-33
lines changed

1 file changed

+8
-33
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,12 @@ public int FindMostRecentProgram()
333333
if (newestMayaVersion == -1)
334334
{
335335
newestMayaVersion = 0;
336-
savedMayaVersionNumber = FindMayaVersion(dccOptionPaths[i]);
336+
savedMayaVersionNumber = FindDCCVersion(dccOptionNames[i]);
337337
continue;
338338
}
339339

340340
//Check if the path we are considering is newer than the previously saved one
341-
int versionToCheck = FindMayaVersion(dccOptionPaths[i]);
341+
int versionToCheck = FindDCCVersion(dccOptionNames[i]);
342342
if (versionToCheck > savedMayaVersionNumber)
343343
{
344344
newestMayaVersion = i;
@@ -350,12 +350,12 @@ public int FindMostRecentProgram()
350350
if (newestMaxVersion == -1)
351351
{
352352
newestMaxVersion = 0;
353-
savedMaxVersionNumber = FindMaxVersion(dccOptionPaths[newestMaxVersion]);
353+
savedMaxVersionNumber = FindDCCVersion(dccOptionNames[newestMaxVersion]);
354354
continue;
355355
}
356356

357357
//Check if the path we are considering is newer than the previously saved one
358-
int versionToCheck = FindMaxVersion(dccOptionPaths[i]);
358+
int versionToCheck = FindDCCVersion(dccOptionNames[i]);
359359
if (versionToCheck > savedMaxVersionNumber)
360360
{
361361
newestMaxVersion = i;
@@ -384,36 +384,11 @@ public int FindMostRecentProgram()
384384
/// </summary>
385385
/// <param name="path"></param>
386386
/// <returns> the year/version OR -1 if the year could not be parsed </returns>
387-
private static int FindMaxVersion(string path)
387+
private static int FindDCCVersion(string AppName)
388388
{
389-
var fileName = Path.GetFileName(Path.GetDirectoryName(path)).ToLower();
390-
fileName = fileName.Replace("3ds max", "").Trim();
391-
392-
int version;
393-
394-
if (int.TryParse(fileName, out version))
395-
{
396-
return version;
397-
}
398-
else
399-
{
400-
return -1;
401-
}
402-
}
403-
404-
/// <summary>
405-
/// Finds the Maya version based off of the title of the application
406-
/// </summary>
407-
/// <param name="path"></param>
408-
/// <returns> the year/version OR -1 if the year could not be parsed </returns>
409-
private static int FindMayaVersion(string path)
410-
{
411-
var fileName = Path.GetFileName(Path.GetDirectoryName(path)).ToLower();
412-
fileName = fileName.Replace("maya", "").Trim();
413-
414389
int version;
415390

416-
if (int.TryParse(fileName, out version))
391+
if (int.TryParse(AppName, out version))
417392
{
418393
return version;
419394
}
@@ -623,8 +598,8 @@ public static string GetMaxOptionName(string exePath){
623598
return GetUniqueName (Path.GetFileName(Path.GetDirectoryName (exePath)));
624599
}
625600

626-
public static bool IsEarlierThanMax2017(string exePath){
627-
int version = FindMaxVersion(exePath);
601+
public static bool IsEarlierThanMax2017(string AppName){
602+
int version = FindDCCVersion(AppName);
628603
return version != -1 && version < 2017;
629604
}
630605

0 commit comments

Comments
 (0)