Skip to content

Commit 2eef55e

Browse files
CDiaz-MSkeveleigh
authored andcommitted
Merge pull request #10282 from Craig-J/leap-4.9.1
Add support for Leap UnityModules 4.9.1
1 parent dd6d1b9 commit 2eef55e

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

Assets/MRTK/Providers/LeapMotion/Editor/LeapMotionConfigurationChecker.cs

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static class LeapMotionConfigurationChecker
3030
private static bool isLeapRecognizedByMRTK = false;
3131

3232
// The current supported Leap Core Assets version numbers.
33-
private static string[] leapCoreAssetsVersionsSupported = new string[] { "4.5.0", "4.5.1", "4.6.0", "4.7.0", "4.7.1", "4.8.0" };
33+
private static string[] leapCoreAssetsVersionsSupported = new string[] { "4.5.0", "4.5.1", "4.6.0", "4.7.0", "4.7.1", "4.8.0", "4.9.1" };
3434

3535
// The current Leap Core Assets version in this project
3636
private static string currentLeapCoreAssetsVersion = "";
@@ -179,30 +179,32 @@ private static bool LeapCoreAssetsVersionSupport()
179179

180180
// The Leap Motion Unity modules Version.txt has remained 4.5.1 across versions 4.6.0, 4.7.0, 4.7.1, and 4.8.0 check for the presence
181181
// of certain paths to infer the version number.
182-
183-
// This path is only present in 4.7.1
184-
string leap471Path = Path.Combine(Application.dataPath, pathDifference, leapAsmDefPath_471);
185-
186-
// This path is present in versions 4.7.0 and 4.7.1
187-
string testDirectoryPath = Path.Combine(Application.dataPath, pathDifference, leapTestsPath_470);
188-
189-
// This path is present in 4.6.0 and not 4.5.1
190-
string xrPath = Path.Combine(Application.dataPath, pathDifference, leapXRPath_460);
191-
192-
if (File.Exists(leap471Path))
193-
{
194-
// The Leap Motion Unity modules Core package version 4.7.1 is identical to the version 4.8.0
195-
// Core package. Due to the lack of differences between the two versions, the modules will be marked as 4.7.1 even
196-
// if they are version 4.8.0.
197-
currentLeapCoreAssetsVersion = "4.7.1";
198-
}
199-
else if (!File.Exists(leap471Path) && Directory.Exists(testDirectoryPath))
200-
{
201-
currentLeapCoreAssetsVersion = "4.7.0";
202-
}
203-
else if (!File.Exists(leap471Path) && !Directory.Exists(testDirectoryPath) && File.Exists(xrPath))
182+
if (currentLeapCoreAssetsVersion == "4.5.1")
204183
{
205-
currentLeapCoreAssetsVersion = "4.6.0";
184+
// This path is only present in 4.7.1
185+
string leap471Path = Path.Combine(Application.dataPath, pathDifference, leapAsmDefPath_471);
186+
187+
// This path is present in versions 4.7.0 and 4.7.1
188+
string testDirectoryPath = Path.Combine(Application.dataPath, pathDifference, leapTestsPath_470);
189+
190+
// This path is present in 4.6.0 and not 4.5.1
191+
string xrPath = Path.Combine(Application.dataPath, pathDifference, leapXRPath_460);
192+
193+
if (File.Exists(leap471Path))
194+
{
195+
// The Leap Motion Unity modules Core package version 4.7.1 is identical to the version 4.8.0
196+
// Core package. Due to the lack of differences between the two versions, the modules will be marked as 4.7.1 even
197+
// if they are version 4.8.0.
198+
currentLeapCoreAssetsVersion = "4.7.1";
199+
}
200+
else if (!File.Exists(leap471Path) && Directory.Exists(testDirectoryPath))
201+
{
202+
currentLeapCoreAssetsVersion = "4.7.0";
203+
}
204+
else if (!File.Exists(leap471Path) && !Directory.Exists(testDirectoryPath) && File.Exists(xrPath))
205+
{
206+
currentLeapCoreAssetsVersion = "4.6.0";
207+
}
206208
}
207209

208210
return true;
@@ -262,7 +264,7 @@ private static void AddAndUpdateAsmDefs()
262264
string leapCoreAsmDefPath = Path.Combine(Application.dataPath, pathDifference, "LeapMotion", "LeapMotion.asmdef");
263265

264266
// If the Leap Unity Modules version is 4.7.1, the LeapMotion.asmdef file does not need to be created
265-
if (currentLeapCoreAssetsVersion == "4.7.1")
267+
if (currentLeapCoreAssetsVersion == "4.7.1" || currentLeapCoreAssetsVersion == "4.9.1")
266268
{
267269
return;
268270
}
@@ -329,7 +331,7 @@ private static void AddLeapEditorAsmDefs()
329331
};
330332

331333
// Add the LeapMotion.LeapCSharp assembly definition to the leap motion tests assembly definition
332-
if ((currentLeapCoreAssetsVersion == "4.5.1" || currentLeapCoreAssetsVersion == "4.6.0" || currentLeapCoreAssetsVersion == "4.7.0" || currentLeapCoreAssetsVersion == "4.7.1") && (leapAsmDef.Key == "LeapMotion.Core.Tests.Editor" || leapAsmDef.Key == "LeapMotion.Core.Editor"))
334+
if ((currentLeapCoreAssetsVersion == "4.5.1" || currentLeapCoreAssetsVersion == "4.6.0" || currentLeapCoreAssetsVersion == "4.7.0" || currentLeapCoreAssetsVersion == "4.7.1" || currentLeapCoreAssetsVersion == "4.9.1") && (leapAsmDef.Key == "LeapMotion.Core.Tests.Editor" || leapAsmDef.Key == "LeapMotion.Core.Editor"))
333335
{
334336
leapEditorAsmDef.AddReference("LeapMotion.LeapCSharp");
335337
}

0 commit comments

Comments
 (0)