不提供时长时按所有轨道动画时长最大值导出
This commit is contained in:
@@ -19,7 +19,7 @@ namespace SpineViewer.Exporter.Implementations.ExportArgs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 导出时长
|
/// 导出时长
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Category("[1] 视频参数"), DisplayName("时长"), Description("可以从模型列表查看动画时长, 如果小于 0, 则在逐个导出时每个模型使用各自的当前动画时长")]
|
[Category("[1] 视频参数"), DisplayName("时长"), Description("可以从模型列表查看动画时长, 如果小于 0, 则在逐个导出时每个模型使用各自的所有轨道动画时长最大值")]
|
||||||
public float Duration
|
public float Duration
|
||||||
{
|
{
|
||||||
get => duration;
|
get => duration;
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ namespace SpineViewer.Exporter.Implementations.Exporter
|
|||||||
{
|
{
|
||||||
var args = (VideoExportArgs)ExportArgs;
|
var args = (VideoExportArgs)ExportArgs;
|
||||||
|
|
||||||
// 独立导出时如果 args.Duration 小于 0 则使用 Track0 的动画时长
|
// 独立导出时如果 args.Duration 小于 0 则使用所有轨道上动画时长最大值
|
||||||
var duration = args.Duration;
|
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;
|
float delta = 1f / args.FPS;
|
||||||
int total = Math.Max(1, (int)(duration * args.FPS)); // 至少导出 1 帧
|
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)
|
public override void Export(Spine.Spine[] spines, BackgroundWorker? worker = null)
|
||||||
{
|
{
|
||||||
// 导出视频格式需要把模型时间都重置到 0
|
// 导出视频格式需要把模型时间都重置到 0
|
||||||
foreach (var spine in spines) spine.Track0Animation = spine.Track0Animation; // TODO: 多轨道重置
|
foreach (var spine in spines) spine.ResetAnimationsTime();
|
||||||
base.Export(spines, worker);
|
base.Export(spines, worker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user