Editor/Embedded/ValveResourceFormat/ResourceTypes/ModelFlex/FlexOps/FlexOpConst.cs

This class defines a constant operation for the Flex model format. It pushes a constant float value onto the operational stack when executed.

#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using HumanoidRetargeter.EditorTools.Embedded.ValveResourceFormat.Utils;
namespace HumanoidRetargeter.EditorTools.Embedded.ValveResourceFormat.ResourceTypes.ModelFlex.FlexOps;

    /// <summary>
    /// Flex operation that pushes a constant value.
    /// </summary>
    public class FlexOpConst : FlexOp
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="FlexOpConst"/> class.
        /// </summary>
        public FlexOpConst(float data) : base(data) { }

        /// <inheritdoc/>
        /// <remarks>
        /// Pushes the constant data value onto the stack.
        /// </remarks>
        public override void Run(in FlexRuleContext context)
        {
            context.Stack.Push(Data);
        }
    }