Skeleton
- Module
- Animation
- Header
#include "Animation/Skeleton.h"- Namespace
Mowo
Constructors
| Signature | Name | Description |
|---|---|---|
Skeleton() = default | Skeleton |
Public functions
| Returns | Name | Description |
|---|---|---|
void | AddBone | |
void | SetBoneOffset | |
int32_t | FindBoneIndex | |
const Bone& | GetBone | |
uint32_t | GetBoneCount | |
const std::vector<Bone>& | GetBones | |
void | SetRootTransform | Root transform: accumulated transforms of non-bone ancestor nodes (e.g. |
const Mat4& | GetRootTransform | |
void | ComputeSkinningMatrices | Compute final bone matrices for GPU upload globalTransforms: array of bone-space -> model-space transforms (computed by animation) outMatrices: finalMatrix[i] = globalTransform[i] * offsetMatrix[i] |
void | ComputeGlobalTransforms | Compute global transforms from local transforms (hierarchy walk) |
void | SetLodBonesToRemove | A distant character does not need its finger, jaw or twist bones animated: the pixels those bones move are smaller than the error. |
const std::vector<uint8_t>* | GetLodRequiredBones | nullptr = every bone is required at this LOD (the common case — no caller should have to build an all-ones mask to ask the question). |
uint32_t | GetLodCount | Highest authored LOD index + 1 (0 when nothing is authored). |
uint32_t | GetLodRequiredBoneCount | Bones actually evaluated at this LOD — what a test or a stat reads to see the work the mask removed. |
int32_t | AddVirtualBone | An IK goal or an aim point that lives in one bone's space but sits where another bone is — a hand target under the spine, a weapon point under the head — without re-authoring the skeleton in a DCC. |
bool | IsVirtualBone | |
void | RemoveVirtualBones | Drops every virtual bone and keeps the imported rig. |
const std::vector<FVirtualBone>& | GetVirtualBones |
Function details
Skeleton
Skeleton() = defaultAddBone
void AddBone(const Bone& bone)SetBoneOffset
void SetBoneOffset(uint32_t index, const Mat4& offset)FindBoneIndex
int32_t FindBoneIndex(const std::string& name) constGetBone
const Bone& GetBone(uint32_t index) constGetBoneCount
uint32_t GetBoneCount() constGetBones
const std::vector<Bone>& GetBones() constSetRootTransform
void SetRootTransform(const Mat4& transform)Root transform: accumulated transforms of non-bone ancestor nodes (e.g. Armature)
GetRootTransform
const Mat4& GetRootTransform() constComputeSkinningMatrices
void ComputeSkinningMatrices(const std::vector<Mat4>& globalTransforms, std::vector<Mat4>& outMatrices) constCompute final bone matrices for GPU upload globalTransforms: array of bone-space -> model-space transforms (computed by animation) outMatrices: finalMatrix[i] = globalTransform[i] * offsetMatrix[i]
ComputeGlobalTransforms
void ComputeGlobalTransforms(const std::vector<Mat4>& localTransforms, std::vector<Mat4>& outGlobalTransforms) constCompute global transforms from local transforms (hierarchy walk)
SetLodBonesToRemove
void SetLodBonesToRemove(uint32_t lod, const std::vector<std::string>& boneNames)A distant character does not need its finger, jaw or twist bones animated: the pixels those bones move are smaller than the error. Naming a bone here excludes it AND its whole subtree from evaluation at that LOD and every coarser one — a child cannot be animated by a parent that is not, and UE's authoring model is the same "remove this branch". An excluded bone is not deleted: it keeps its BIND local transform, so its subtree still rides its parent rigidly and the palette keeps its length. That is what makes this safe to switch per frame — nothing downstream (skinning matrices, sockets, attachment) changes shape. LOD 0 is always fully required; a level that was never authored inherits the closest coarser one that was, so a mesh with masks at 1 and 3 does the right thing at 2 without the caller repeating itself.
GetLodRequiredBones
const std::vector<uint8_t>* GetLodRequiredBones(uint32_t lod) constnullptr = every bone is required at this LOD (the common case — no caller should have to build an all-ones mask to ask the question). Otherwise one byte per bone, 1 = evaluate it.
GetLodCount
uint32_t GetLodCount() constHighest authored LOD index + 1 (0 when nothing is authored).
GetLodRequiredBoneCount
uint32_t GetLodRequiredBoneCount(uint32_t lod) constBones actually evaluated at this LOD — what a test or a stat reads to see the work the mask removed.
AddVirtualBone
int32_t AddVirtualBone(const std::string& name, const std::string& sourceBone, const std::string& targetBone)An IK goal or an aim point that lives in one bone's space but sits where another bone is — a hand target under the spine, a weapon point under the head — without re-authoring the skeleton in a DCC. The bone is appended after every real bone and carries no skin weights, so the skin palette, the clip bindings and every existing index stay valid. Its drive happens inside ComputeGlobalTransforms, the one hierarchy walk every pose consumer (animation system, anim graph, control rig, retargeting, the editors' previews) goes through, so it follows Target on every frame of every one of them. -1 when the name is empty or taken, a bone is missing, source equals target, or the skeleton is at the bone limit.
IsVirtualBone
bool IsVirtualBone(uint32_t index) constRemoveVirtualBones
void RemoveVirtualBones()Drops every virtual bone and keeps the imported rig. The object stays the one the level's animators share, so a re-authored set can be laid onto it in place; a pose buffer sized for the old count is resized by the next ComputeGlobalTransforms.
GetVirtualBones
const std::vector<FVirtualBone>& GetVirtualBones() const