static void Write(JmadDataContainer header) { Write($"Type: {header.Type}"); Write($" OrientationCount: {header.OrientationCount}"); Write($" TranslationCount: {header.TranslationCount}"); Write($" ScaleCount: {header.ScaleCount}"); }
static void Main(string[] args) { var mapPath = @"D:\H2vMaps\01a_tutorial.map"; var outRoot = @"D:\h2scratch\animations\export"; var factory = new MapFactory(Path.GetDirectoryName(mapPath)); var h2map = factory.Load(Path.GetFileName(mapPath)); if (h2map is not H2vMap map) { throw new NotSupportedException("Only Vista maps are supported in this tool"); } var animations = map.GetLocalTagsOfType <AnimationGraphTag>(); var types = new HashSet <JmadDataType>(); foreach (var tag in animations) { foreach (var anim in tag.Animations) { Write($"{tag.Name} {anim.Description}, T{anim.AnimationType}, F{anim.FrameCount}, B{anim.BoneCount}"); Span <byte> data = anim.Data; var zeroHeader = JmadDataContainer.Create(data); if (zeroHeader.Type != JmadDataType.Flat) { Write(zeroHeader); types.Add(zeroHeader.Type); } var innerHeader = JmadDataContainer.Create(data.Slice(anim.SizeE)); if (innerHeader.Type != JmadDataType.Flat) { Write(innerHeader); types.Add(innerHeader.Type); } var outFile = Path.Combine(outRoot, tag.Name, anim.Description.Replace(":", "-")) + ".jmad"; Directory.CreateDirectory(Path.GetDirectoryName(outFile)); File.WriteAllBytes(outFile, anim.Data); Write("====================="); } } Write($" Encountered Data Types: {string.Join(",", types)}"); TextCopy.ClipboardService.SetText(outb.ToString()); }