Files
sbox-public/engine/Sandbox.Engine/Systems/SceneSystem/SceneModel.Update.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

70 lines
1.6 KiB
C#

namespace Sandbox;
public sealed partial class SceneModel
{
/// <summary>
/// Update this animation. Delta is the time you want to advance, usually RealTime.Delta
/// </summary>
public void Update( float delta )
{
animNative.Update( delta );
FinishBoneUpdate();
}
/// <summary>
/// Update this animation. Delta is the time you want to advance, usually RealTime.Delta
/// </summary>
internal void Update( float delta, Action updateBones )
{
animNative.Update( delta );
updateBones.Invoke();
FinishBoneUpdate();
}
/// <summary>
/// Update all of the bones to the bind pose
/// </summary>
public void UpdateToBindPose()
{
animNative.SetBindPose();
FinishBoneUpdate();
}
/// <summary>
/// Update all of the bones to the bind pose
/// </summary>
internal void UpdateToBindPose( Action updateBones )
{
animNative.SetBindPose();
updateBones.Invoke();
FinishBoneUpdate();
}
/// <summary>
/// Updates attachments, ao proxies etc
/// Should be called any time the world transform change
/// </summary>
internal void FinishBoneUpdate()
{
if ( Parent.IsValid() )
return;
animNative.CalculateWorldSpaceBones();
animNative.FinishUpdate();
}
/// <summary>
/// Update our bones to match the target's bones. This is a manual bone merge.
/// </summary>
public void MergeBones( SceneModel parent )
{
Assert.IsValid( parent );
Assert.False( parent == this );
animNative.MergeFrom( parent );
}
internal Transform GetParentSpaceBone( int i ) => animNative.GetParentSpaceBone( i );
internal void SetParentSpaceBone( int i, in Transform tx ) => animNative.SetParentSpaceBone( i, tx );
}