Class ModelSceneNode
Namespace: ValveResourceFormat.Renderer.SceneNodes
Assembly: Renderer.dll
Scene node for rendering animated models with skeletal animation and morph targets.
public class ModelSceneNode : MeshCollectionNodeInheritance
object ← SceneNode ← MeshCollectionNode ← ModelSceneNode
Inherited Members
MeshCollectionNode.Tint, MeshCollectionNode.RenderableMeshes, MeshCollectionNode.Delete(), SceneNode.Transform, SceneNode.LayerName, SceneNode.LayerEnabled, SceneNode.BoundingBox, SceneNode.LocalBoundingBox, SceneNode.Name, SceneNode.Id, SceneNode.IsSelected, SceneNode.Flags, SceneNode.Scene, SceneNode.EnvMaps, SceneNode.ShaderEnvMapVisibility, SceneNode.LightingOrigin, SceneNode.OverlayRenderOrder, SceneNode.CubeMapPrecomputedHandshake, SceneNode.LightProbeVolumePrecomputedHandshake, SceneNode.LightProbeBinding, SceneNode.EntityData, SceneNode.Update(Scene.UpdateContext), SceneNode.Render(Scene.RenderContext), SceneNode.GetSupportedRenderModes(), SceneNode.SetRenderMode(string), SceneNode.Delete(), SceneNode.GetCameraDistance(Camera)
Constructors
ModelSceneNode(Scene, Model, string?, bool)
Initializes a new instance of the class and loads its meshes and animations.
public ModelSceneNode(Scene scene, Model model, string? skin = null, bool isWorldPreview = false)Parameters
scene Scene
The scene this node belongs to.
model Model
The model resource to render.
skin string?
The material group (skin) name to activate, or null for the default.
isWorldPreview bool
When true, only embedded animations are loaded.
Properties
ActiveMaterialGroup
Gets the name of the currently active material group (skin).
public string ActiveMaterialGroup { get; }Property Value
AnimationController
Gets the animation controller managing skeletal pose and flex data for this model.
public AnimationController AnimationController { get; }Property Value
Animations
A collection of animations available for sequential playback on this model.
public Dictionary<string, Animation> Animations { get; }Property Value
Attachments
Attachment points from model data.
public Dictionary<string, Attachment> Attachments { get; }Property Value
Dictionary<string, Attachment>
HasMeshes
Gets whether this model has at least one mesh renderer loaded.
public bool HasMeshes { get; }Property Value
IsAnimated
Gets whether this model has an active GPU bone matrix buffer (i.e., has animations loaded).
public bool IsAnimated { get; }Property Value
Tint
Gets or sets the tint color applied to all meshes in this node.
public override Vector4 Tint { get; set; }Property Value
Methods
Delete()
Releases resources held by this node.
public override void Delete()GetActiveMeshGroups()
Returns the set of currently active mesh group names.
public ICollection<string> GetActiveMeshGroups()Returns
GetAttachmentTransform(string)
Gets the world transform for the specified attachment point.
public Matrix4x4 GetAttachmentTransform(string attachmentName)Parameters
attachmentName string
Returns
GetLod1RefMeshes()
Returns the external reference mesh names and their LoD masks for LoD level 1.
public IEnumerable<(int MeshIndex, string MeshName, long LoDMask)> GetLod1RefMeshes()Returns
IEnumerable<(int MeshIndex, string MeshName, long LoDMask)>
GetMeshBoneIndex(int, RenderableMesh)
Returns the mesh-local bone index for the given model-level bone index within the specified mesh's remapping table slice.
public int GetMeshBoneIndex(int modelBoneIndex, RenderableMesh mesh)Parameters
modelBoneIndex int
mesh RenderableMesh
Returns
GetMeshGroups()
Returns all mesh group names defined by this model.
public IEnumerable<string> GetMeshGroups()Returns
GetSupportedRenderModes()
Returns the render modes supported by this node.
public override IEnumerable<string> GetSupportedRenderModes()Returns
LoadAnimationClip(AnimationClip)
Loads an animgraph2 clip from the given instance and makes it available for playback on this model.
public void LoadAnimationClip(AnimationClip clip)Parameters
clip AnimationClip
LoadAnimationClip(string)
Loads an animgraph2 clip from the file system and makes it available for playback on this model.
public bool LoadAnimationClip(string clipName)Parameters
clipName string
Clip resource name.
Returns
true if the clip was found and loaded; otherwise false.
SetActiveMeshGroups(IEnumerable<string>)
Sets which mesh groups are active, rebuilding the renderable mesh list accordingly.
public void SetActiveMeshGroups(IEnumerable<string> setMeshGroups)Parameters
setMeshGroups IEnumerable<string>
SetAnimation(Animation?)
Activates the given animation instance, or clears the active animation when null.
public void SetAnimation(Animation? activeAnimation)Parameters
activeAnimation Animation?
SetAnimationByName(string)
Activates the animation with the given name, or stops animation if not found.
public void SetAnimationByName(string animationName)Parameters
animationName string
SetAnimationForWorldPreview(string)
Activates the named animation for world preview mode.
public bool SetAnimationForWorldPreview(string animationName)Parameters
animationName string
Returns
true if the animation was found and activated; otherwise false.
SetCharacterEyeRenderParams()
Detects eye materials on this model and injects bone index and bind-pose uniforms for eyeball rendering.
public void SetCharacterEyeRenderParams()SetMaterialGroup(string)
Activates the named material group (skin), remapping all mesh materials accordingly.
public void SetMaterialGroup(string name)Parameters
name string
Update(UpdateContext)
Called each frame to update this node's state.
public override void Update(Scene.UpdateContext context)Parameters
context Scene.UpdateContext
The current update context.

