Editor model entry type for the AutoRig tool. It represents one imported model file, tracking its path, filename, current status, analysis, mesh and rig results, and a state token for UI updates.
using AutoRig.Analyze;
using AutoRig.Mesh;
using AutoRig.Rig;
namespace AutoRig.Editor;
/// <summary>Lifecycle of one added model file.</summary>
public enum EntryStatus
{
Analyzing,
Ready,
Rigging,
Rigged,
Exported,
Failed,
}
/// <summary>One model in the window's list: source file, analysis, and (later) its rig.</summary>
public sealed class ModelEntry
{
public required string Path { get; init; }
public required string FileName { get; init; }
public EntryStatus Status { get; set; } = EntryStatus.Analyzing;
public string Detail { get; set; } = "";
/// <summary>Bumped on every state change so a transient error flash can tell
/// whether it is still the most recent thing to have happened to this row.</summary>
public int StateToken { get; set; }
public RigMesh Mesh { get; set; }
public AnalysisResult Analysis { get; set; }
public RigResult Rig { get; set; }
/// <summary>Chip text: analysis summary, or the current state.</summary>
public string ChipText => Status switch
{
EntryStatus.Analyzing => "Analyzing…",
EntryStatus.Failed => Detail.Length > 0 ? Detail : "Failed",
_ => Analysis?.Summary ?? "",
};
}