From 55ebcc1857a08a51ed39ab2e15e25fd22d7fdaca Mon Sep 17 00:00:00 2001 From: ww-rm Date: Wed, 11 Jun 2025 13:38:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=AF=BC=E5=87=BA=E6=97=B6?= =?UTF-8?q?=E4=B9=9F=E5=85=81=E8=AE=B8=E8=87=AA=E5=8A=A8=E6=97=B6=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Spine/SpineExporter/VideoExporter.cs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/SpineViewer/Spine/SpineExporter/VideoExporter.cs b/SpineViewer/Spine/SpineExporter/VideoExporter.cs index 7b55087..db13c80 100644 --- a/SpineViewer/Spine/SpineExporter/VideoExporter.cs +++ b/SpineViewer/Spine/SpineExporter/VideoExporter.cs @@ -30,15 +30,6 @@ namespace SpineViewer.Spine.SpineExporter /// public bool KeepLast { get; set; } = true; - public override string? Validate() - { - if (base.Validate() is string error) - return error; - if (IsExportSingle && Duration < 0) - return Properties.Resources.negativeDuration; - return null; - } - /// /// 生成单个模型的帧序列 /// @@ -93,8 +84,16 @@ namespace SpineViewer.Spine.SpineExporter /// protected IEnumerable GetFrames(SpineObject[] spinesToRender, BackgroundWorker? worker = null) { - // 导出单个时必须根据 Duration 决定导出时长 + // 导出单个时取所有模型的所有轨道时长最大值 var duration = Duration; + if (duration < 0) + { + duration = spinesToRender.Select( + sp => sp.GetTrackIndices().Select( + i => sp.GetAnimationDuration(sp.GetAnimation(i)) + ).DefaultIfEmpty(0).Max() + ).Max(); + } float delta = 1f / FPS; int total = (int)(duration * FPS); // 完整帧的数量