Editor helper for bone name conversion during VMDL export. Replaces colons with underscores to match ModelDoc's import behavior, and validates that no two bone names collide after conversion.
namespace HumanoidRigger.EditorTools.Core.Export;
/// <summary>ModelDoc replaces namespace colons with underscores when importing bones.</summary>
public static class VmdlBoneNames
{
public static string Convert(string name)=>name.Replace(':','_');
public static void Validate(IEnumerable<RigBone> bones)
{
var names=new Dictionary<string,string>(StringComparer.OrdinalIgnoreCase);
foreach(var bone in bones)
{
string converted=Convert(bone.Name);
if(names.TryGetValue(converted,out var previous))
throw new InvalidOperationException($"Bone names '{previous}' and '{bone.Name}' both become '{converted}' in s&box. Rename one bone in the profile.");
names.Add(converted,bone.Name);
}
}
}