增加工作区功能
This commit is contained in:
@@ -5,6 +5,7 @@ using SFMLRenderer;
|
||||
using Spine;
|
||||
using Spine.Exporters;
|
||||
using SpineViewer.Extensions;
|
||||
using SpineViewer.Models;
|
||||
using SpineViewer.Resources;
|
||||
using SpineViewer.ViewModels.MainWindow;
|
||||
using System;
|
||||
@@ -134,9 +135,21 @@ namespace SpineViewer.ViewModels.Exporters
|
||||
return null;
|
||||
}
|
||||
|
||||
public RelayCommand<IList?> Cmd_Export => _cmd_Export ??= new(Export_Execute, args => args is not null && args.Count > 0);
|
||||
public RelayCommand<IList?> Cmd_Export => _cmd_Export ??= new(Export_Execute, Export_CanExecute);
|
||||
private RelayCommand<IList?>? _cmd_Export;
|
||||
|
||||
protected abstract void Export_Execute(IList? args);
|
||||
private void Export_Execute(IList? args)
|
||||
{
|
||||
if (!Export_CanExecute(args)) return;
|
||||
Export(args.Cast<SpineObjectModel>().ToArray());
|
||||
// XXX: 导出途中应该停掉渲染好一些, 让性能专注在导出上
|
||||
}
|
||||
|
||||
private bool Export_CanExecute(IList? args)
|
||||
{
|
||||
return args is not null && args.Count > 0;
|
||||
}
|
||||
|
||||
protected abstract void Export(SpineObjectModel[] models);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,11 +47,10 @@ namespace SpineViewer.ViewModels.Exporters
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override void Export_Execute(IList? args)
|
||||
protected override void Export(SpineObjectModel[] models)
|
||||
{
|
||||
if (args is null || args.Count <= 0) return;
|
||||
if (!DialogService.ShowCustomFFmpegExporterDialog(this)) return;
|
||||
SpineObject[] spines = args.Cast<SpineObjectModel>().Select(m => m.GetSpineObject()).ToArray();
|
||||
SpineObject[] spines = models.Select(m => m.GetSpineObject()).ToArray();
|
||||
ProgressService.RunAsync((pr, ct) => ExportTask(spines, pr, ct), AppResource.Str_CustomFFmpegExporterTitle);
|
||||
foreach (var sp in spines) sp.Dispose();
|
||||
}
|
||||
|
||||
@@ -34,11 +34,10 @@ namespace SpineViewer.ViewModels.Exporters
|
||||
|
||||
private string FormatSuffix => $".{_format.ToString().ToLower()}";
|
||||
|
||||
protected override void Export_Execute(IList? args)
|
||||
protected override void Export(SpineObjectModel[] models)
|
||||
{
|
||||
if (args is null || args.Count <= 0) return;
|
||||
if (!DialogService.ShowFFmpegVideoExporterDialog(this)) return;
|
||||
SpineObject[] spines = args.Cast<SpineObjectModel>().Select(m => m.GetSpineObject()).ToArray();
|
||||
SpineObject[] spines = models.Select(m => m.GetSpineObject()).ToArray();
|
||||
ProgressService.RunAsync((pr, ct) => ExportTask(spines, pr, ct), AppResource.Str_FFmpegVideoExporterTitle);
|
||||
foreach (var sp in spines) sp.Dispose();
|
||||
}
|
||||
|
||||
@@ -38,11 +38,10 @@ namespace SpineViewer.ViewModels.Exporters
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Export_Execute(IList? args)
|
||||
protected override void Export(SpineObjectModel[] models)
|
||||
{
|
||||
if (args is null || args.Count <= 0) return;
|
||||
if (!DialogService.ShowFrameExporterDialog(this)) return;
|
||||
SpineObject[] spines = args.Cast<SpineObjectModel>().Select(m => m.GetSpineObject(true)).ToArray();
|
||||
SpineObject[] spines = models.Select(m => m.GetSpineObject(true)).ToArray();
|
||||
ProgressService.RunAsync((pr, ct) => ExportTask(spines, pr, ct), AppResource.Str_FrameExporterTitle);
|
||||
foreach (var sp in spines) sp.Dispose();
|
||||
}
|
||||
|
||||
@@ -17,11 +17,10 @@ namespace SpineViewer.ViewModels.Exporters
|
||||
{
|
||||
public class FrameSequenceExporterViewModel(MainWindowViewModel vmMain) : VideoExporterViewModel(vmMain)
|
||||
{
|
||||
protected override void Export_Execute(IList? args)
|
||||
protected override void Export(SpineObjectModel[] models)
|
||||
{
|
||||
if (args is null || args.Count <= 0) return;
|
||||
if (!DialogService.ShowFrameSequenceExporterDialog(this)) return;
|
||||
SpineObject[] spines = args.Cast<SpineObjectModel>().Select(m => m.GetSpineObject()).ToArray();
|
||||
SpineObject[] spines = models.Select(m => m.GetSpineObject()).ToArray();
|
||||
ProgressService.RunAsync((pr, ct) => ExportTask(spines, pr, ct), AppResource.Str_FrameSequenceExporterTitle);
|
||||
foreach (var sp in spines) sp.Dispose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user