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 TriLibCore.Mappers.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)
Declaration
protected override int MapViseme(AssetLoaderContext assetLoaderContext, LipSyncViseme viseme, IGeometryGroup geometryGroup)
Parameters
Type | Name | Description |
---|---|---|
AssetLoaderContext | assetLoaderContext | The TriLibCore.AssetLoaderContext containing the model loading data. |
LipSyncViseme | viseme | The viseme to map. |
IGeometryGroup | geometryGroup | The geometry group that contains the blend‐shape keys. |
Returns
Type | Description |
---|---|
int | The index of the blend‐shape key corresponding to the viseme if a match is found; otherwise, -1. |
Overrides
Remarks
This method iterates over each TriLibCore.Mappers.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.