Updated getter in ModelList and cleaned Assembly
This commit is contained in:
@@ -23,9 +23,9 @@ public class ModelList : ScriptableObject
|
||||
/// </summary>
|
||||
/// <param name="modelIndex">ModelIndex of the model</param>
|
||||
/// <returns>Model associated with this index, null if no model was found</returns>
|
||||
public NNModel GetModelByIndex(ModelIndex modelIndex)
|
||||
public NNModel GetCurrentModel()
|
||||
{
|
||||
return models.Find((m) => m.index == modelIndex).model;
|
||||
return models[currentModelIndex].model;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
"GUID:63c63e721f65ebb7d871cb9ef49f4752",
|
||||
"GUID:1631ed2680c61245b8211d943c1639a8",
|
||||
"GUID:5c2b5ba89f9e74e418232e154bc5cc7a",
|
||||
"GUID:7f2d0ee6dd21e1d4eb25b71b7a749d25",
|
||||
"GUID:d0b6b39a21908f94fbbd9f2c196a9725"
|
||||
"GUID:7f2d0ee6dd21e1d4eb25b71b7a749d25"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -37,27 +37,10 @@ public class ModelListTest
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if getModelByIndex returns the NMModel or return null if there is no model
|
||||
/// Check if all courses can be correctly gotten and set as current via SetCurrentCourse
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestGetModelByIndex()
|
||||
{
|
||||
foreach (var field in typeof(ModelIndex).GetFields())
|
||||
{
|
||||
if (field.IsLiteral)
|
||||
{
|
||||
ModelIndex value = (ModelIndex)field.GetValue(null);
|
||||
string name = field.Name;
|
||||
Assert.IsTrue(modelList.GetModelByIndex(value) is NNModel || modelList.GetModelByIndex(value) is null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if all courses can be correctly set as current via SetCurrentCourse
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestSetCurrentModel()
|
||||
public void TestGetSetCurrentModel()
|
||||
{
|
||||
foreach (var field in typeof(ModelIndex).GetFields())
|
||||
{
|
||||
@@ -71,6 +54,7 @@ public class ModelListTest
|
||||
ModelTuple m = modelList.models[modelList.currentModelIndex];
|
||||
|
||||
Assert.AreEqual(m.index, value);
|
||||
Assert.IsTrue(m.model is NNModel || m.model is null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace Mediapipe.Unity.Tutorial
|
||||
|
||||
// check if model exists at path
|
||||
//var model = ModelLoader.Load(Resources.Load<NNModel>("Models/Fingerspelling/model_A-L"));
|
||||
worker = modelList.models[modelList.currentModelIndex].model.CreateWorker();
|
||||
worker = modelList.GetCurrentModel().CreateWorker();
|
||||
|
||||
StartCoroutine(SignRecognitionCoroutine());
|
||||
StartCoroutine(MediapipeCoroutine());
|
||||
@@ -223,7 +223,7 @@ namespace Mediapipe.Unity.Tutorial
|
||||
worker?.Dispose();
|
||||
|
||||
// Add a new worker for the new model
|
||||
worker = modelList.models[modelList.currentModelIndex].model.CreateWorker();
|
||||
worker = modelList.GetCurrentModel().CreateWorker();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user