Skip to content

Commit d8b68d0

Browse files
committed
update 1.1.1
1 parent 2aaccc0 commit d8b68d0

17 files changed

+163
-64
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.

Assets/CVVTuberExample/CVVTuber/Addons/VRM10CVVTuber.unitypackage.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
-26 Bytes
Binary file not shown.
Binary file not shown.

Assets/CVVTuberExample/CVVTuber/Examples/VideoCaptureCVVTuberExample/VideoCaptureCVVTuberExample.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public class VideoCaptureCVVTuberExample : MonoBehaviour
2020
void Start()
2121
{
2222
// Load global settings.
23-
dlibFaceLandmarkGetter.dlibShapePredictorFileName = CVVTuberExample.dlibShapePredictorFileName;
24-
dlibFaceLandmarkGetter.dlibShapePredictorMobileFileName = CVVTuberExample.dlibShapePredictorFileName;
23+
dlibFaceLandmarkGetter.dlibShapePredictorFilePath = CVVTuberExample.dlibShapePredictorFilePath;
24+
dlibFaceLandmarkGetter.dlibShapePredictorMobileFilePath = CVVTuberExample.dlibShapePredictorFilePath;
2525
}
2626

2727
/// <summary>

Assets/CVVTuberExample/CVVTuber/Examples/WebCamTextureCVVTuberExample/WebCamTextureCVVTuberExample.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public class WebCamTextureCVVTuberExample : MonoBehaviour
2020
void Start()
2121
{
2222
// Load global settings.
23-
dlibFaceLandmarkGetter.dlibShapePredictorFileName = CVVTuberExample.dlibShapePredictorFileName;
24-
dlibFaceLandmarkGetter.dlibShapePredictorMobileFileName = CVVTuberExample.dlibShapePredictorFileName;
23+
dlibFaceLandmarkGetter.dlibShapePredictorFilePath = CVVTuberExample.dlibShapePredictorFilePath;
24+
dlibFaceLandmarkGetter.dlibShapePredictorMobileFilePath = CVVTuberExample.dlibShapePredictorFilePath;
2525
}
2626

2727
/// <summary>

Assets/CVVTuberExample/CVVTuber/Scripts/Core/CVVTuberControllManager.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,7 @@ protected virtual IEnumerator Start()
2020
if (processOrderList == null)
2121
yield break;
2222

23-
foreach (var item in processOrderList)
24-
{
25-
if (item == null)
26-
continue;
27-
28-
//Debug.Log("Setup : "+item.gameObject.name);
29-
30-
item.Setup();
31-
}
23+
SetupAllProcess();
3224

3325
enabled = true;
3426
}
@@ -82,5 +74,21 @@ public virtual void Dispose()
8274
{
8375

8476
}
77+
78+
public virtual void SetupAllProcess()
79+
{
80+
if (processOrderList == null)
81+
return;
82+
83+
foreach (var item in processOrderList)
84+
{
85+
if (item == null)
86+
continue;
87+
88+
//Debug.Log("Setup : "+item.gameObject.name);
89+
90+
item.Setup();
91+
}
92+
}
8593
}
8694
}

Assets/CVVTuberExample/CVVTuber/Scripts/DlibFaceLandmarkGetter.cs

Lines changed: 57 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ protected IFaceRectGetter faceRectGetterInterface
4545

4646
[Header("[Setting]")]
4747

48-
public string dlibShapePredictorFileName;
48+
[Tooltip("Set the shape predictor file path, relative to the starting point of the \"StreamingAssets\" folder, or absolute path.")]
49+
public string dlibShapePredictorFilePath;
4950

50-
public string dlibShapePredictorMobileFileName;
51+
[Tooltip("Set the shape predictor mobile file path, relative to the starting point of the \"StreamingAssets\" folder, or absolute path.")]
52+
public string dlibShapePredictorMobileFilePath;
5153

5254
[Header("[Debug]")]
5355

@@ -69,11 +71,11 @@ protected IFaceRectGetter faceRectGetterInterface
6971

7072
protected FaceLandmarkDetector faceLandmarkDetector;
7173

72-
protected static readonly string DLIB_SHAPEPREDICTOR_FILENAME_PRESET = "DlibFaceLandmarkDetector/sp_human_face_68.dat";
74+
protected static readonly string DLIB_SHAPEPREDICTOR_FILEPATH_PRESET = "DlibFaceLandmarkDetector/sp_human_face_68.dat";
7375

74-
protected static readonly string DLIB_SHAPEPREDICTOR_MOBILE_FILENAME_PRESET = "DlibFaceLandmarkDetector/sp_human_face_68_for_mobile.dat";
76+
protected static readonly string DLIB_SHAPEPREDICTOR_MOBILE_FILEPATH_PRESET = "DlibFaceLandmarkDetector/sp_human_face_68_for_mobile.dat";
7577

76-
protected string dlibShapePredictorFilePath;
78+
protected string dlibShapePredictorFileFullPath;
7779

7880
#if UNITY_WEBGL
7981
protected IEnumerator getFilePath_Coroutine;
@@ -89,37 +91,59 @@ public override string GetDescription()
8991

9092
public override void Setup()
9193
{
94+
Dispose();
95+
9296
NullCheck(matSourceGetterInterface, "matSourceGetter");
9397

94-
if (string.IsNullOrEmpty(dlibShapePredictorFileName))
95-
dlibShapePredictorFileName = DLIB_SHAPEPREDICTOR_FILENAME_PRESET;
98+
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
99+
dlibShapePredictorFilePath = DLIB_SHAPEPREDICTOR_FILEPATH_PRESET;
100+
101+
if (string.IsNullOrEmpty(dlibShapePredictorMobileFilePath))
102+
dlibShapePredictorMobileFilePath = DLIB_SHAPEPREDICTOR_MOBILE_FILEPATH_PRESET;
96103

97-
if (string.IsNullOrEmpty(dlibShapePredictorMobileFileName))
98-
dlibShapePredictorMobileFileName = DLIB_SHAPEPREDICTOR_MOBILE_FILENAME_PRESET;
99104

100105
#if UNITY_WEBGL
101-
getFilePath_Coroutine = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePathAsync(dlibShapePredictorMobileFileName, (result) =>
106+
Uri uri;
107+
if (Uri.TryCreate(dlibShapePredictorMobileFilePath, UriKind.Absolute, out uri))
102108
{
103-
getFilePath_Coroutine = null;
104-
105-
dlibShapePredictorFilePath = result;
106-
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
107-
{
108-
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. ");
109-
}
109+
dlibShapePredictorFileFullPath = uri.OriginalString;
110110
Run();
111-
});
112-
StartCoroutine(getFilePath_Coroutine);
111+
}
112+
else
113+
{
114+
getFilePath_Coroutine = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePathAsync(dlibShapePredictorMobileFilePath, (result) =>
115+
{
116+
getFilePath_Coroutine = null;
117+
118+
dlibShapePredictorFileFullPath = result;
119+
Run();
120+
});
121+
StartCoroutine(getFilePath_Coroutine);
122+
}
113123
#else
124+
114125
#if UNITY_ANDROID || UNITY_IOS
115-
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorMobileFileName);
126+
Uri uri;
127+
if (Uri.TryCreate(dlibShapePredictorMobileFilePath, UriKind.Absolute, out uri))
128+
{
129+
dlibShapePredictorFileFullPath = uri.OriginalString;
130+
}
131+
else
132+
{
133+
dlibShapePredictorFileFullPath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorMobileFilePath);
134+
}
116135
#else
117-
dlibShapePredictorFilePath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorFileName);
118-
#endif
119-
if (string.IsNullOrEmpty(dlibShapePredictorFilePath))
136+
Uri uri;
137+
if (Uri.TryCreate(dlibShapePredictorFilePath, UriKind.Absolute, out uri))
120138
{
121-
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. ");
139+
dlibShapePredictorFileFullPath = uri.OriginalString;
140+
}
141+
else
142+
{
143+
dlibShapePredictorFileFullPath = DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath(dlibShapePredictorFilePath);
122144
}
145+
#endif
146+
123147
Run();
124148
#endif
125149
}
@@ -254,7 +278,10 @@ public override void UpdateValue()
254278
public override void Dispose()
255279
{
256280
if (faceLandmarkDetector != null)
281+
{
257282
faceLandmarkDetector.Dispose();
283+
faceLandmarkDetector = null;
284+
}
258285

259286
if (debugMat != null)
260287
{
@@ -282,7 +309,12 @@ public override void Dispose()
282309

283310
protected virtual void Run()
284311
{
285-
faceLandmarkDetector = new FaceLandmarkDetector(dlibShapePredictorFilePath);
312+
if (string.IsNullOrEmpty(dlibShapePredictorFileFullPath))
313+
{
314+
Debug.LogError("shape predictor file does not exist. Please copy from “DlibFaceLandmarkDetector/StreamingAssets/DlibFaceLandmarkDetector/” to “Assets/StreamingAssets/DlibFaceLandmarkDetector/” folder. ");
315+
}
316+
317+
faceLandmarkDetector = new FaceLandmarkDetector(dlibShapePredictorFileFullPath);
286318

287319
didUpdateFaceLanmarkPoints = false;
288320
}

0 commit comments

Comments
 (0)