Skip to main content

BonesBaking

A class in Root.Township, Alta.Customization.

Editor test asset (menu TEST/Bones Baking) that bakes a body type into cosmetic meshes and moves weights from masked bones onto their parents. Probably only used in the editor.

Constructors​

MemberWhat it is
BonesBaking()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

8 private and internal fields
MemberWhat it is
private Mesh bakingMeshMesh the dummy's skinned renderer bakes into.
private int[] bonesIndices of bones to remove.
private bool btnMapInspector button that runs Map.
private SimpleDummy dummyPrefabPrefab of the dummy character used for baking.
private int[] mappedParentsFor each bone index, the parent bone its weight moves to, or -1.
private int[] parentsParent bone index for each entry in bones.
private SimpleDummy sceneDummyThe dummy instance in the scene.
private static List<Vector3> workingVector3Shared buffer for vertex and normal data.

Methods​

MemberWhat it is
void BakeMeshes(IEnumerable<Mesh> originalMeshes, int index)Poses a dummy with the given body type, bakes each mesh's vertices and normals into it, and remaps bone weights from masked bones to their parents.
void Check(AvatarMask mask, SkinnedMeshRenderer source)Fills bones and parents from the bones an AvatarMask enables on a skinned mesh renderer.
void InstantiateDummy()Creates or reactivates the scene dummy used for baking.
void Map()Builds mappedParents from bones and parents, with -1 for bones that stay.

Used in​

Members of other types that take, return or hold a BonesBaking: