Class Skeleton
Namespace: ValveResourceFormat.ResourceTypes.ModelAnimation
Assembly: ValveResourceFormat.dll
Represents a model skeleton with bones arranged in a hierarchy.
public class SkeletonInheritance
object ← Skeleton
Properties
BoneSpheres
Gets the authored bounding sphere radius of each bone, in model space, covering the vertices weighted to it. Zero for bones that carry no geometry.
public float[] BoneSpheres { get; }Property Value
float[]
Bones
Gets all bones in the skeleton.
public Bone[] Bones { get; }Property Value
Bone[]
ClothSimulationRoot
Gets the root bone for cloth simulation, if present.
public Bone? ClothSimulationRoot { get; }Property Value
Bone?
Name
Gets the name of the skeleton.
public string Name { get; }Property Value
string
Roots
Gets the root bones of the skeleton.
public Bone[] Roots { get; }Property Value
Bone[]
this[uint]
Gets a bone by its StringToken hash.
public Bone? this[uint hash] { get; }Property Value
Bone?
this[string]
Gets a bone by its name.
public Bone? this[string name] { get; }Property Value
Bone?
Methods
ComputeWorldPose(Frame, Span<Matrix4x4>)
Accumulates each bone's world-space transform from the frame's local bone transforms, walking down the hierarchy from the roots. world must be at least as long as Skeleton.Bones and is indexed by bone index.
public void ComputeWorldPose(Frame frame, Span<Matrix4x4> world)Parameters
frame Frame
ComputeWorldSubtree(Bone, Matrix4x4, Frame?, Span<Matrix4x4>)
Accumulates world-space transforms for one bone subtree under the given parent transform. A null frame yields the bind pose.
public static void ComputeWorldSubtree(Bone bone, Matrix4x4 parentWorld, Frame? frame, Span<Matrix4x4> world)Parameters
bone Bone
parentWorld Matrix4x4
frame Frame?
FromModelData(KVObject)
Creates a skeleton from model data.
public static Skeleton FromModelData(KVObject modelData)Parameters
modelData KVObject
Returns
FromRenderSkeleton(KVObject)
Builds a skeleton from a mesh's own render skeleton, to skin a mesh that has no owning model. Bones are ordered as authored and parented by name; one naming an unknown parent is a root. Returns null when the render skeleton has no bones, or only bone hashes as in older files.
public static Skeleton? FromRenderSkeleton(KVObject renderSkeleton)Parameters
renderSkeleton KVObject
Returns
FromSkeletonData(KVObject)
Creates a skeleton from skeleton-specific data.
public static Skeleton FromSkeletonData(KVObject nmSkeleton)Parameters
nmSkeleton KVObject
Returns
FromSkeletonResource(IFileLoader, string)
Loads a compiled NM skeleton (.vnmskel) resource by name and builds a skeleton from it, or returns null when the resource cannot be loaded.
public static Skeleton? FromSkeletonResource(IFileLoader fileLoader, string skeletonName)Parameters
fileLoader IFileLoader
skeletonName string
Returns
GetBoneIndex(uint)
Gets the index of a bone by its StringToken hash, or -1 if not found.
public int GetBoneIndex(uint hash)Parameters
hash uint
Returns
int
GetBoneIndex(string)
Gets the index of a bone by its name, or -1 if not found.
public int GetBoneIndex(string name)Parameters
name string
Returns
int

