From 6ecdca73f516a2589bc81164c211967490c9e259 Mon Sep 17 00:00:00 2001 From: ww-rm Date: Thu, 3 Apr 2025 00:30:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E6=8F=90=E4=BE=9B=E6=97=B6=E9=95=BF?= =?UTF-8?q?=E6=97=B6=E6=8C=89=E6=89=80=E6=9C=89=E8=BD=A8=E9=81=93=E5=8A=A8?= =?UTF-8?q?=E7=94=BB=E6=97=B6=E9=95=BF=E6=9C=80=E5=A4=A7=E5=80=BC=E5=AF=BC?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Exporter/Implementations/ExportArgs/VideoExportArgs.cs | 2 +- .../Exporter/Implementations/Exporter/VideoExporter.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SpineViewer/Exporter/Implementations/ExportArgs/VideoExportArgs.cs b/SpineViewer/Exporter/Implementations/ExportArgs/VideoExportArgs.cs index 8d1f685..0d44007 100644 --- a/SpineViewer/Exporter/Implementations/ExportArgs/VideoExportArgs.cs +++ b/SpineViewer/Exporter/Implementations/ExportArgs/VideoExportArgs.cs @@ -19,7 +19,7 @@ namespace SpineViewer.Exporter.Implementations.ExportArgs /// /// 导出时长 /// - [Category("[1] 视频参数"), DisplayName("时长"), Description("可以从模型列表查看动画时长, 如果小于 0, 则在逐个导出时每个模型使用各自的当前动画时长")] + [Category("[1] 视频参数"), DisplayName("时长"), Description("可以从模型列表查看动画时长, 如果小于 0, 则在逐个导出时每个模型使用各自的所有轨道动画时长最大值")] public float Duration { get => duration; diff --git a/SpineViewer/Exporter/Implementations/Exporter/VideoExporter.cs b/SpineViewer/Exporter/Implementations/Exporter/VideoExporter.cs index 0cfda8f..aa6e273 100644 --- a/SpineViewer/Exporter/Implementations/Exporter/VideoExporter.cs +++ b/SpineViewer/Exporter/Implementations/Exporter/VideoExporter.cs @@ -23,9 +23,9 @@ namespace SpineViewer.Exporter.Implementations.Exporter { var args = (VideoExportArgs)ExportArgs; - // 独立导出时如果 args.Duration 小于 0 则使用 Track0 的动画时长 + // 独立导出时如果 args.Duration 小于 0 则使用所有轨道上动画时长最大值 var duration = args.Duration; - if (duration < 0) duration = spine.GetAnimationDuration(spine.Track0Animation); // TODO: 也许可以使用所有轨道的最大值 + if (duration < 0) duration = spine.GetTrackIndices().Select(i => spine.GetAnimationDuration(spine.GetAnimation(i))).Max(); float delta = 1f / args.FPS; int total = Math.Max(1, (int)(duration * args.FPS)); // 至少导出 1 帧 @@ -75,7 +75,7 @@ namespace SpineViewer.Exporter.Implementations.Exporter public override void Export(Spine.Spine[] spines, BackgroundWorker? worker = null) { // 导出视频格式需要把模型时间都重置到 0 - foreach (var spine in spines) spine.Track0Animation = spine.Track0Animation; // TODO: 多轨道重置 + foreach (var spine in spines) spine.ResetAnimationsTime(); base.Export(spines, worker); } }