From 6a17ec039721d4eb80d8171328eeacd303296742 Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 19 Oct 2025 04:59:34 -0700 Subject: [PATCH 01/30] Add --warmup option to control physics warmup loops Create a new --warmup argument to specify the number of warmup loops for physics before export. This allows users to control how many times the animation is pre-processed to stabilize physics. --- SpineViewerCLI/SpineViewerCLI.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/SpineViewerCLI/SpineViewerCLI.cs b/SpineViewerCLI/SpineViewerCLI.cs index 4343768..121d73f 100644 --- a/SpineViewerCLI/SpineViewerCLI.cs +++ b/SpineViewerCLI/SpineViewerCLI.cs @@ -33,6 +33,7 @@ options: --speed FLOAT Speed of animation (for video), default 1.0 --color HEX Background color as a hex RGBA color, default 000000ff (opaque black) --quiet Removes console progress log, default false + --warmup INT Warm Up Physics, default 2 loops before export "; public static void Main(string[] args) @@ -57,6 +58,8 @@ options: float speed = 1; Color backgroundColor = Color.Black; bool quiet = false; + bool warmup = false; + int warmUpLoops = 2; for (int i = 0; i < args.Length; i++) { @@ -126,6 +129,10 @@ options: case "--quiet": quiet = true; break; + case "--warmup": + warmUpLoops = int.Parse(args[++i]); + warmup = true; + break; default: Console.Error.WriteLine($"Unknown argument: {args[i]}"); Environment.Exit(2); @@ -172,6 +179,20 @@ options: } sp.Update(0); + if (warmup) + { + float delta = 1f / fps; + for (int i = 0; i < warmUpLoops; i++) + { + float t = 0; + while (t < trackEntry.Animation.Duration) + { + sp.Update(delta); + t += delta; + } + } + } + foreach (var slotName in hideSlots) { if (!sp.SetSlotVisible(slotName, false)) From d335645dc158fb3d4c8ca4a320baa48d76666dcb Mon Sep 17 00:00:00 2001 From: ww-rm <43590561+ww-rm@users.noreply.github.com> Date: Sun, 19 Oct 2025 20:46:42 +0800 Subject: [PATCH 02/30] remove unnecessary frame loops --- SpineViewerCLI/SpineViewerCLI.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/SpineViewerCLI/SpineViewerCLI.cs b/SpineViewerCLI/SpineViewerCLI.cs index 121d73f..9794543 100644 --- a/SpineViewerCLI/SpineViewerCLI.cs +++ b/SpineViewerCLI/SpineViewerCLI.cs @@ -181,16 +181,7 @@ options: if (warmup) { - float delta = 1f / fps; - for (int i = 0; i < warmUpLoops; i++) - { - float t = 0; - while (t < trackEntry.Animation.Duration) - { - sp.Update(delta); - t += delta; - } - } + sp.Update(trackEntry.Animation.Duration * warmUpLoops); } foreach (var slotName in hideSlots) @@ -370,4 +361,4 @@ options: return new(x, y, w, h); } } -} \ No newline at end of file +} From 779500ee8ef9239c4badf1cdd56031416e45dae6 Mon Sep 17 00:00:00 2001 From: ww-rm Date: Sat, 25 Oct 2025 16:47:00 +0800 Subject: [PATCH 03/30] =?UTF-8?q?=E4=BF=AE=E6=94=B9ApngPred=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=90=8D=E4=B8=BAPredMethod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Spine/Exporters/FFmpegVideoExporter.cs | 6 +++--- SpineViewer/Resources/Strings/en.xaml | 4 ++-- SpineViewer/Resources/Strings/ja.xaml | 4 ++-- SpineViewer/Resources/Strings/zh.xaml | 4 ++-- .../ViewModels/Exporters/FFmpegVideoExporterViewModel.cs | 6 +++--- .../Views/ExporterDialogs/FFmpegVideoExporterDialog.xaml | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Spine/Exporters/FFmpegVideoExporter.cs b/Spine/Exporters/FFmpegVideoExporter.cs index ea04666..b73492d 100644 --- a/Spine/Exporters/FFmpegVideoExporter.cs +++ b/Spine/Exporters/FFmpegVideoExporter.cs @@ -62,8 +62,8 @@ namespace Spine.Exporters /// /// [Apng] 预测器算法, 取值范围 0-5, 分别对应 none, sub, up, avg, paeth, mixed /// - public int ApngPred { get => _apngPred; set => _apngPred = Math.Clamp(value, 0, 5); } - private int _apngPred = 5; + public int PredMethod { get => _predMethod; set => _predMethod = Math.Clamp(value, 0, 5); } + private int _predMethod = 5; /// /// [Mp4/Webm/Mkv] CRF @@ -142,7 +142,7 @@ namespace Spine.Exporters private void SetApngOptions(FFMpegArgumentOptions options) { - var customArgs = $"-vf unpremultiply=inplace=1 -plays {(_loop ? 0 : 1)} -pred {_apngPred}"; + var customArgs = $"-vf unpremultiply=inplace=1 -plays {(_loop ? 0 : 1)} -pred {_predMethod}"; options.ForceFormat("apng").WithVideoCodec("apng").ForcePixelFormat("rgba") .WithCustomArgument(customArgs); } diff --git a/SpineViewer/Resources/Strings/en.xaml b/SpineViewer/Resources/Strings/en.xaml index 418e0c5..e53a826 100644 --- a/SpineViewer/Resources/Strings/en.xaml +++ b/SpineViewer/Resources/Strings/en.xaml @@ -206,8 +206,8 @@ [Webp] Quality parameter, range 0-100, higher value means better quality Lossless Compression [Webp] Lossless compression, quality parameter will be ignored - Predictor Method - [Apng] Pred parameter, value range 0-5, corresponding to different encoding strategies: none, sub, up, avg, paeth, and mixed. It affects encoding time and file size. + Predictor Method + [Apng] Pred parameter, value range 0-5, corresponding to different encoding strategies: none, sub, up, avg, paeth, and mixed. It affects encoding time and file size. CRF Parameter [Mp4/Webm/Mkv] CRF parameter, range 0-63, lower value means higher quality Profile Parameter diff --git a/SpineViewer/Resources/Strings/ja.xaml b/SpineViewer/Resources/Strings/ja.xaml index 766eb13..fcecb2c 100644 --- a/SpineViewer/Resources/Strings/ja.xaml +++ b/SpineViewer/Resources/Strings/ja.xaml @@ -206,8 +206,8 @@ [Webp] 品質パラメータ、範囲は0-100。値が高いほど品質が良い 無損失圧縮 [Webp] 無損失圧縮、品質パラメータは無視されます - 予測器方式 - [Apng] Pred パラメータ。値の範囲は 0~5 で、それぞれ none、sub、up、avg、paeth、mixed の異なるエンコード方式に対応します。 エンコード時間とファイルサイズに影響します。 + 予測器方式 + [Apng] Pred パラメータ。値の範囲は 0~5 で、それぞれ none、sub、up、avg、paeth、mixed の異なるエンコード方式に対応します。 エンコード時間とファイルサイズに影響します。 CRF パラメータ [Mp4/Webm/Mkv] CRF パラメータ、範囲0-63。値が小さいほど品質が高い プロファイルパラメータ diff --git a/SpineViewer/Resources/Strings/zh.xaml b/SpineViewer/Resources/Strings/zh.xaml index 95d462f..a621d3f 100644 --- a/SpineViewer/Resources/Strings/zh.xaml +++ b/SpineViewer/Resources/Strings/zh.xaml @@ -206,8 +206,8 @@ [Webp] 质量参数,取值范围 0-100,越高质量越好 无损压缩 [Webp] 无损压缩,会忽略质量参数 - 预测器方法 - [Apng] Pred 参数,取值范围 0-5,分别对应 none、sub、up、avg、paeth、mixed 几种不同的编码策略, 影响编码时间和文件大小 + 预测器方法 + [Apng] Pred 参数,取值范围 0-5,分别对应 none、sub、up、avg、paeth、mixed 几种不同的编码策略, 影响编码时间和文件大小 CRF 参数 [Mp4/Webm/Mkv] CRF 参数,取值范围 0-63,越小质量越高 Profile 参数 diff --git a/SpineViewer/ViewModels/Exporters/FFmpegVideoExporterViewModel.cs b/SpineViewer/ViewModels/Exporters/FFmpegVideoExporterViewModel.cs index 474c03b..f0faa54 100644 --- a/SpineViewer/ViewModels/Exporters/FFmpegVideoExporterViewModel.cs +++ b/SpineViewer/ViewModels/Exporters/FFmpegVideoExporterViewModel.cs @@ -57,8 +57,8 @@ namespace SpineViewer.ViewModels.Exporters public bool EnableParamLossless => _format == FFmpegVideoExporter.VideoFormat.Webp; - public int ApngPred { get => _apngPred; set => SetProperty(ref _apngPred, Math.Clamp(value, 0, 5)); } - protected int _apngPred = 5; + public int PredMethod { get => _predMethod; set => SetProperty(ref _predMethod, Math.Clamp(value, 0, 5)); } + protected int _predMethod = 5; public bool EnableParamApngPred => _format == FFmpegVideoExporter.VideoFormat.Apng; @@ -102,7 +102,7 @@ namespace SpineViewer.ViewModels.Exporters Loop = _loop, Quality = _quality, Lossless = _lossless, - ApngPred = _apngPred, + PredMethod = _predMethod, Crf = _crf, Profile = _profile, }; diff --git a/SpineViewer/Views/ExporterDialogs/FFmpegVideoExporterDialog.xaml b/SpineViewer/Views/ExporterDialogs/FFmpegVideoExporterDialog.xaml index 1d60ef6..fbfaae2 100644 --- a/SpineViewer/Views/ExporterDialogs/FFmpegVideoExporterDialog.xaml +++ b/SpineViewer/Views/ExporterDialogs/FFmpegVideoExporterDialog.xaml @@ -247,8 +247,8 @@ -