Dlib FaceLandmark Detector 1.4.1
Enox Software
Loading...
Searching...
No Matches
DlibFaceLandmarkDetector.UnityUtils.Utils Class Reference

Static Public Member Functions

static string getFilePath (string filepath, bool refresh=false, int timeout=0)
 Gets the readable path of a file in the "StreamingAssets" directory.
 
static IEnumerator getFilePathAsync (string filepath, Action< string > completed, Action< string, float > progressChanged=null, Action< string, string, long > errorOccurred=null, bool refresh=false, int timeout=0)
 Asynchronously retrieves the readable path of a file in the "StreamingAssets" directory using coroutines.
 
static async Task< string > getFilePathAsyncTask (string filepath, Action< string, float > progressChanged=null, Action< string, string, long > errorOccurred=null, bool refresh=false, int timeout=0, CancellationToken cancellationToken=default)
 Asynchronously retrieves the readable path of a file in the "StreamingAssets" directory using a Task.
 
static IReadOnlyList< string > getMultipleFilePaths (IReadOnlyList< string > filepaths, bool refresh=false, int timeout=0)
 Gets the multiple readable paths of a file in the "StreamingAssets" directory.
 
static IEnumerator getMultipleFilePathsAsync (IReadOnlyList< string > filepaths, Action< IReadOnlyList< string > > allCompleted, Action< string > completed=null, Action< string, float > progressChanged=null, Action< string, string, long > errorOccurred=null, bool refresh=false, int timeout=0)
 Asynchronously retrieves the multiple readable paths of files in the "StreamingAssets" directory using coroutines.
 
static async Task< IReadOnlyList< string > > getMultipleFilePathsAsyncTask (IReadOnlyList< string > filepaths, Action< string > completed=null, Action< string, float > progressChanged=null, Action< string, string, long > errorOccurred=null, bool refresh=false, int timeout=0, CancellationToken cancellationToken=default)
 Asynchronously retrieves the multiple readable paths of files in the "StreamingAssets" directory using a Task.
 
static string getVersion ()
 Returns this "Dlib FaceLandmark Detector" version number.
 
static void setDebugMode (bool debugMode, bool throwException=false, Action< string > callback=null)
 Sets the debug mode.
 

Member Function Documentation

◆ getFilePath()

static string DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePath ( string filepath,
bool refresh = false,
int timeout = 0 )
static

Gets the readable path of a file in the "StreamingAssets" directory.

Provide a relative file path based on the "StreamingAssets" directory. e.g., "foobar.txt" or "hogehoge/foobar.txt". [Android] The target file that exists in the "StreamingAssets" directory is copied to the the Application.persistentDataPath directory. [WebGL] If the target file has not yet been copied to WebGL's virtual filesystem, it is necessary to use getFilePathAsync of getFilePathAsyncTask at first.

Parameters
filepathA file path relative to the "StreamingAssets" directory.
refresh[Android] If false, the file is not copied if it already exists. If true, the file is always copied.
timeout[Android] Sets the UnityWebRequest to abort after the specified number of seconds. If set to 0, no timeout is applied. The default is 0.
Returns
Returns the readable file path in case of success and returns string.Empty in case of error.
Exceptions
ArgumentNullExceptionThrown if filepath is null.

◆ getFilePathAsync()

static IEnumerator DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePathAsync ( string filepath,
Action< string > completed,
Action< string, float > progressChanged = null,
Action< string, string, long > errorOccurred = null,
bool refresh = false,
int timeout = 0 )
static

Asynchronously retrieves the readable path of a file in the "StreamingAssets" directory using coroutines.

Provide a relative file path based on the "StreamingAssets" directory. e.g., "foobar.txt" or "hogehoge/foobar.txt". [Android] The target file that exists in the "StreamingAssets" directory is copied to the the Application.persistentDataPath directory. [WebGL] The target file in the "StreamingAssets" directory is copied to the WebGL's virtual filesystem.

Parameters
filepathA file path relative to the "StreamingAssets" directory.
completedA callback that is called when the process is completed. Returns a readable file path in case of success and returns string.Empty in case of error.
progressChangedAn optional callback that is called when the process is the progress. Returns the file path and a progress value (0.0 to 1.0).
errorOccurredAn optional callback that is called when the process is error occurred. Returns the file path and an error string and an error response code.
refresh[Android][WebGL] If false, the file is not copied if it already exists. If true, the file is always copied.
timeout[Android][WebGL] Sets the UnityWebRequest to abort after the specified number of seconds. If set to 0, no timeout is applied. The default is 0.
Returns
Returns an IEnumerator object. Yielding the IEnumerator in a coroutine pauses the coroutine until the UnityWebRequest completes or encounters a system error. Note: that if the IEnumerator is externally stoped, the UnityWebRequest's Abort method will not be called, meaning the download will continue in the background.
Exceptions
ArgumentNullExceptionThrown if filepath is null.

◆ getFilePathAsyncTask()

static async Task< string > DlibFaceLandmarkDetector.UnityUtils.Utils.getFilePathAsyncTask ( string filepath,
Action< string, float > progressChanged = null,
Action< string, string, long > errorOccurred = null,
bool refresh = false,
int timeout = 0,
CancellationToken cancellationToken = default )
static

Asynchronously retrieves the readable path of a file in the "StreamingAssets" directory using a Task.

Provide a relative file path based on the "StreamingAssets" directory. e.g., "foobar.txt" or "hogehoge/foobar.txt". [Android] The target file that exists in the "StreamingAssets" directory is copied to the the Application.persistentDataPath directory. [WebGL] The target file in the "StreamingAssets" directory is copied to the WebGL's virtual filesystem.

Parameters
filepathA file path relative to the "StreamingAssets" directory.
progressChangedAn optional callback that is called when the process is the progress. Returns the file path and a progress value (0.0 to 1.0).
errorOccurredAn optional callback that is called when the process is error occurred. Returns the file path and an error string and an error response code.
refresh[Android][WebGL] If false, the file is not copied if it already exists. If true, the file is always copied.
timeout[Android][WebGL] Sets the UnityWebRequest to abort after the specified number of seconds. If set to 0, no timeout is applied. The default is 0.
cancellationTokenA cancellation token that can be used to cancel the download operation.
Returns
A task that represents the asynchronous download operation. The result is a readable file path where the downloaded file was saved, or string.Empty if the download fails.
Exceptions
ArgumentNullExceptionThrown if filepath is null.
InvalidOperationExceptionThrown if this method is called from a non-main thread.
OperationCanceledExceptionThrown if the download operation is canceled.

◆ getMultipleFilePaths()

static IReadOnlyList< string > DlibFaceLandmarkDetector.UnityUtils.Utils.getMultipleFilePaths ( IReadOnlyList< string > filepaths,
bool refresh = false,
int timeout = 0 )
static

Gets the multiple readable paths of a file in the "StreamingAssets" directory.

Provide a relative file path based on the "StreamingAssets" directory. e.g., "foobar.txt" or "hogehoge/foobar.txt". [Android] The target file that exists in the "StreamingAssets" directory is copied to the the Application.persistentDataPath directory. [WebGL] If the target file has not yet been copied to WebGL's virtual filesystem, it is necessary to use getMultipleFilePathsAsync of getMultipleFilePathsAsynck at first.

Parameters
filepathsThe list of file paths relative to the "StreamingAssets" directory.
refresh[Android] If false, the file is not copied if it already exists. If true, the file is always copied.
timeout[Android] Sets the UnityWebRequest to abort after the specified number of seconds. If set to 0, no timeout is applied. The default is 0.
Returns
Returns the list of readable file paths in case of success and returns string.Empty in case of error.
Exceptions
ArgumentNullExceptionThrown if filepath is null.

◆ getMultipleFilePathsAsync()

static IEnumerator DlibFaceLandmarkDetector.UnityUtils.Utils.getMultipleFilePathsAsync ( IReadOnlyList< string > filepaths,
Action< IReadOnlyList< string > > allCompleted,
Action< string > completed = null,
Action< string, float > progressChanged = null,
Action< string, string, long > errorOccurred = null,
bool refresh = false,
int timeout = 0 )
static

Asynchronously retrieves the multiple readable paths of files in the "StreamingAssets" directory using coroutines.

Provide a relative file path based on the "StreamingAssets" directory. e.g., "foobar.txt" or "hogehoge/foobar.txt". [Android] The target file that exists in the "StreamingAssets" directory is copied to the the Application.persistentDataPath directory. [WebGL] The target file in the "StreamingAssets" directory is copied to the WebGL's virtual filesystem.

Parameters
filepathsThe list of file paths relative to the "StreamingAssets" directory.
allCompletedA callback that is called when all processes are completed. Returns a list of file paths. Returns a readable file path in case of success and returns string.Empty in case of error.
completedAn optional callback that is called when one process is completed. Returns a readable file path in case of success and returns empty in case of error.
progressChangedAn optional callback that is called when one process is the progress. Returns the file path and a progress value (0.0 to 1.0).
errorOccurredAn optional callback that is called when one process is error occurred. Returns the file path and an error string and an error response code.
refresh[Android][WebGL] If false, the file is not copied if it already exists. If true, the file is always copied.
timeout[Android][WebGL] Sets the UnityWebRequest to abort after the specified number of seconds. If set to 0, no timeout is applied. The default is 0.
Returns
Returns an IEnumerator object. Yielding the IEnumerator in a coroutine pauses the coroutine until the UnityWebRequest completes or encounters a system error. Note: that if the IEnumerator is externally stoped, the UnityWebRequest's Abort method will not be called, meaning the download will continue in the background.
Exceptions
ArgumentNullExceptionThrown if filepath is null.

◆ getMultipleFilePathsAsyncTask()

static async Task< IReadOnlyList< string > > DlibFaceLandmarkDetector.UnityUtils.Utils.getMultipleFilePathsAsyncTask ( IReadOnlyList< string > filepaths,
Action< string > completed = null,
Action< string, float > progressChanged = null,
Action< string, string, long > errorOccurred = null,
bool refresh = false,
int timeout = 0,
CancellationToken cancellationToken = default )
static

Asynchronously retrieves the multiple readable paths of files in the "StreamingAssets" directory using a Task.

Provide a relative file path based on the "StreamingAssets" directory. e.g., "foobar.txt" or "hogehoge/foobar.txt". [Android] The target file that exists in the "StreamingAssets" directory is copied to the the Application.persistentDataPath directory. [WebGL] The target file in the "StreamingAssets" directory is copied to the WebGL's virtual filesystem.

Parameters
filepathsThe list of file paths relative to the "StreamingAssets" directory.
completedAn optional callback that is called when one process is completed. Returns a readable file path in case of success and returns empty in case of error.
progressChangedAn optional callback that is called when one process is the progress. Returns the file path and a progress value (0.0 to 1.0).
errorOccurredAn optional callback that is called when one process is error occurred. Returns the file path and an error string and an error response code.
refresh[Android][WebGL] If false, the file is not copied if it already exists. If true, the file is always copied.
timeout[Android][WebGL] Sets the UnityWebRequest to abort after the specified number of seconds. If set to 0, no timeout is applied. The default is 0.
cancellationTokenA cancellation token that can be used to cancel the download operation.
Returns
A task that represents the asynchronous download operation. The result is a list of readable file paths where the downloaded file was saved, or string.Empty if the download fails.
Exceptions
ArgumentNullExceptionThrown if filepath is null.
InvalidOperationExceptionThrown if this method is called from a non-main thread.
OperationCanceledExceptionThrown if the download operation is canceled.

◆ getVersion()

static string DlibFaceLandmarkDetector.UnityUtils.Utils.getVersion ( )
static

Returns this "Dlib FaceLandmark Detector" version number.

Returns
this "Dlib FaceLandmark Detector" version number

◆ setDebugMode()

static void DlibFaceLandmarkDetector.UnityUtils.Utils.setDebugMode ( bool debugMode,
bool throwException = false,
Action< string > callback = null )
static

Sets the debug mode.

If debugMode is true, The error log of the Native side Dlib will be displayed on the Unity Editor Console.However, if throwException is true, DlibException is thrown instead of calling Debug.LogError (msg).

Please use as follows.

{
// DlibException handling
// Publish DlibException to Debug.LogError.
Utils.setDebugMode(true, false);
// Code that causes an error.
// Throw DlibException.
Utils.setDebugMode(true, true);
try
{
// Code that causes an error.
}
catch (Exception e)
{
Debug.Log("DlibException: " + e);
}
Utils.setDebugMode(false);
}
static void setDebugMode(bool debugMode, bool throwException=false, Action< string > callback=null)
Sets the debug mode.
Definition Utils.cs:672
Parameters
debugModeIf true, The error log of the Native side Dlib will be displayed on the Unity Editor Console.
throwExceptionIf true, DlibException is thrown instead of calling Debug.LogError (msg).
callbackCallback called when an Dlib error occurs on the Native side.

The documentation for this class was generated from the following file: