Class ByNameLipSyncMapper
Provides a lip sync mapping strategy by searching for viseme matches in blend‐shape key names. This mapper searches through candidate names specified in VisemeCandidates and compares them with the names of blend‐shape keys found in the model's geometry. If a match is found (using the configured string comparison options), the corresponding blend‐shape key index is returned.
Inherited Members
Namespace: TriLibCore.Mappers
Assembly: Assembly-CSharp.dll
Syntax
[CreateAssetMenu(menuName = "TriLib/Mappers/LypSync/By Name Lip Sync Mapper", fileName = "ByNameLipSyncMapper")]
public class ByNameLipSyncMapper : LipSyncMapper
Fields
CaseInsensitive
Indicates whether string comparisons for mapping visemes should be case insensitive.
Declaration
public bool CaseInsensitive
Field Value
| Type | Description |
|---|---|
| bool |
StringComparisonMode
Defines the string comparison mode used when matching blend‐shape key names against viseme candidate names.
Declaration
[Header("Left = Blend-Shape Key Name, Right = Viseme Name")]
public StringComparisonMode StringComparisonMode
Field Value
| Type | Description |
|---|---|
| StringComparisonMode |
Remarks
The "left" value in the comparison is the name of the blend‐shape key and the "right" value is the candidate name.
VisemeCandidates
A list of viseme candidates. Each VisemeCandidate defines a viseme and a collection of acceptable blend‐shape names that can be used to represent that viseme.
Declaration
public List<VisemeCandidate> VisemeCandidates
Field Value
| Type | Description |
|---|---|
| List<VisemeCandidate> |
Methods
MapViseme(AssetLoaderContext, LipSyncViseme, IGeometryGroup)
Maps a single viseme (lip-sync shape) to its corresponding blend shape key
within the specified geometryGroup, returning the index of
that blend shape key if found.
Override this method to customize name matching or heuristic-based matching.
Declaration
protected override int MapViseme(AssetLoaderContext assetLoaderContext, LipSyncViseme viseme, IGeometryGroup geometryGroup)
Parameters
| Type | Name | Description |
|---|---|---|
| AssetLoaderContext | assetLoaderContext | The AssetLoaderContext referencing the model’s loaded data and import settings. |
| LipSyncViseme | viseme | The specific lip-sync shape to match. |
| IGeometryGroup | geometryGroup | The geometric data group holding blend shape keys. This method tries to locate one that corresponds to the requested viseme. |
Returns
| Type | Description |
|---|---|
| int | The blend shape key index if a matching shape is found; otherwise |
Overrides
Remarks
This method iterates over each VisemeCandidate that matches the provided viseme.
For each candidate name, it compares the candidate string with the name of each blend‐shape key in the
geometryGroup using Matches(StringComparisonMode, bool, string, string) with the specified
StringComparisonMode and CaseInsensitive settings. If a match is found, the
method returns the index of the matching blend‐shape key; otherwise, it returns -1.