Class BlendShapePlayerMapper
A specialized BlendShapeMapper that creates and configures a BlendShapePlayer component for the specified GameObject. The BlendShapePlayerMapper assigns blend shape keys and sets up animation curve mapping for blend shapes based on their index.
Inherited Members
Namespace: TriLibCore.BlendShapePlayer
Assembly: Assembly-CSharp.dll
Syntax
[CreateAssetMenu(menuName = "TriLib/Mappers/BlendShape/BlendShape Player Mapper", fileName = "BlendShapePlayerMapper")]
public class BlendShapePlayerMapper : BlendShapeMapper
Properties
AnimationCurveSourceType
Indicates the source type (e.g., SkinnedMeshRenderer
or another component)
for blend shape animation curves. Override to specify a different type if
not using the default Unity setup.
Declaration
public override Type AnimationCurveSourceType { get; }
Property Value
Type | Description |
---|---|
Type |
Overrides
Remarks
Returns the Type of the source component used for animation curve mapping, which is BlendShapePlayer.
Methods
MapAnimationCurve(AssetLoaderContext, int)
Provides a way to remap the animation property name or path when creating animation curves for blend shape keys, effectively controlling how TriLib’s loaded blend shape animations are interpreted in Unity. Override this if your system requires a different naming scheme.
Declaration
public override string MapAnimationCurve(AssetLoaderContext assetLoaderContext, int blendShapeIndex)
Parameters
Type | Name | Description |
---|---|---|
AssetLoaderContext | assetLoaderContext | References the model loading data, including loaded objects, user settings, and runtime information. |
int | blendShapeIndex | The index of the blend shape within the mesh. This value can be used to determine the naming or structure of animation curves. |
Returns
Type | Description |
---|---|
string | A new or adjusted string representing the animation curve property to which
this blend shape should be keyed. |
Overrides
Remarks
Maps a blend shape key index to an animation curve property name by delegating the lookup to GetPropertyName(int).
Setup(AssetLoaderContext, IGeometryGroup, GameObject, List<IBlendShapeKey>)
Performs initial configuration for the specified geometryGroup
,
applying the blend shape data to the provided meshGameObject
.
Override this method to implement a custom blend shape playback system
(e.g., a custom runtime script or different naming conventions).
Declaration
public override void Setup(AssetLoaderContext assetLoaderContext, IGeometryGroup geometryGroup, GameObject meshGameObject, List<IBlendShapeKey> blendShapeKeys)
Parameters
Type | Name | Description |
---|---|---|
AssetLoaderContext | assetLoaderContext | The AssetLoaderContext containing references to loaded objects, loading options, and callbacks. |
IGeometryGroup | geometryGroup | The geometry group (mesh data and related structures) containing the blend shape keys. |
GameObject | meshGameObject | The UnityEngine.GameObject to which the blend shape mesh is bound. Often hosts a UnityEngine.SkinnedMeshRenderer if using Unity’s default system. |
List<IBlendShapeKey> | blendShapeKeys | A list of IBlendShapeKey objects referencing the blend shapes (morph targets) available for this mesh. |
Overrides
Remarks
This method adds a BlendShapePlayer component to the provided meshGameObject
,
and calls its Setup(IGeometryGroup, List<IBlendShapeKey>) method to initialize it with
the given geometryGroup
and blendShapeKeys
.