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

A small class that represents a flex operation which pushes a constant float onto a runtime stack. It inherits from FlexOp and stores the constant in the base Data field, then pushes it into the provided FlexRuleContext.Stack when Run is called.

#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);
        }
    }