Blend shapes
This page uses Mesh from Unity. The glossary says what each one is.
A blend shape is a setting on a part that bends it, for example to open a mouth or narrow an eye. Each shape has a weight, which says how strongly it is applied.
NpcAppearance blend shape calls
Call BlendShapes(npcId) to read a character’s shapes and SetBlendShape to change one. Use Restore or Clear to undo your changes.
public static partial class NpcAppearance
{
public static List<NpcBlendShapeInfo> BlendShapes(int npcId);
public static bool SetBlendShape(string modId, int npcId, string mesh, string shape, float weight);
}
| Method | Returns | What it does |
|---|---|---|
BlendShapes(npcId) | List<NpcBlendShapeInfo> | Every blend shape of the character, with its weight. |
SetBlendShape(modId, npcId, mesh, shape, weight) | bool | Sets the weight of one shape. Returns true when it was set. |
NpcBlendShapeInfo one blend shape on one part
BlendShapes(npcId) gives you one of these for each shape. Weight is its weight now.
public sealed class NpcBlendShapeInfo
{
public string Mesh { get; }
public string Shape { get; }
public float Weight { get; }
}
| Property | Type | What it means |
|---|---|---|
Mesh | string | The name of the part. |
Shape | string | The name of the blend shape. |
Weight | float | Its weight right now. |
Things to know
BlendShapes(npcId)lists every blend shape of every switched-on part of the character, with its weight right now.SetBlendShapesets the weight of the shape on every switched-on part with that name that has that shape. The weight is kept between 0 and 200.- Only one mod can change a given shape of a given part of a character at a time. A second mod is refused until the first mod calls
RestoreorClear. RestoreandClearput each changed weight back to the value it had before your mod’s first change.
Limits
SetBlendShaperefuses the eyelid shape. The game closes the eyelids with that shape when a character sleeps or dies, so the call returnsfalsefor it. (The shape is_01UpperLidLower.)- The game moves the mouth shapes itself while a character talks. They are not refused here, so a change to a mouth shape can be overwritten while the character is talking.