Editor/Embedded/ValveResourceFormat/ResourceTypes/ModelAnimation/AnimationActivity.cs

A small readonly struct representing an animation activity in a model animation resource. It stores Name, Activity, Flags and Weight and can be constructed from a KVObject by reading four properties.

#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using HumanoidRetargeter.EditorTools.Embedded.ValveResourceFormat.Utils;
using HumanoidRetargeter.EditorTools.Embedded.ValveResourceFormat.Serialization.KeyValues;

namespace HumanoidRetargeter.EditorTools.Embedded.ValveResourceFormat.ResourceTypes.ModelAnimation;

    /// <summary>
    /// Represents an activity associated with an animation.
    /// </summary>
    public readonly struct AnimationActivity
    {
        /// <summary>
        /// Gets or sets the name of the activity.
        /// </summary>
        public string Name { get; init; }

        /// <summary>
        /// Gets or sets the activity identifier.
        /// </summary>
        public int Activity { get; init; }

        /// <summary>
        /// Gets or sets the activity flags.
        /// </summary>
        public int Flags { get; init; }

        /// <summary>
        /// Gets or sets the activity weight.
        /// </summary>
        public int Weight { get; init; }

        /// <summary>
        /// Initializes a new instance of the <see cref="AnimationActivity"/> struct.
        /// </summary>
        public AnimationActivity(KVObject data)
        {
            Name = data.GetStringProperty("m_name");
            Activity = data.GetInt32Property("m_nActivity");
            Flags = data.GetInt32Property("m_nFlags");
            Weight = data.GetInt32Property("m_nWeight");
        }
    }