Compare commits

...

5 Commits

Author SHA1 Message Date
ww-rm
b3cd0b9349 Merge pull request #99 from ww-rm/dev/wpf
v0.15.15
2025-09-11 23:20:45 +08:00
ww-rm
1c545b8c37 update to v0.15.15 2025-09-11 23:19:24 +08:00
ww-rm
d660dd1c4a update changelog 2025-09-11 23:19:18 +08:00
ww-rm
9c0acf7302 增加报错信息 2025-09-11 23:17:13 +08:00
ww-rm
415df555c7 增加导入后自动选中最后一项 2025-09-08 21:50:11 +08:00
16 changed files with 181 additions and 53 deletions

View File

@@ -1,5 +1,10 @@
# CHANGELOG # CHANGELOG
## v0.15.15
- 增加报错信息
- 导入后自动选中最后一项
## v0.15.14 ## v0.15.14
- 将预览画面的首选项移动至上一次状态参数中 - 将预览画面的首选项移动至上一次状态参数中

View File

@@ -30,8 +30,15 @@ namespace Spine.Implementations.SpineWrappers.V21
: base(skelPath, atlasPath, textureLoader) : base(skelPath, atlasPath, textureLoader)
{ {
// 加载 atlas // 加载 atlas
try { _atlas = new Atlas(atlasPath, textureLoader); } try
catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } {
_atlas = new Atlas(atlasPath, textureLoader);
}
catch (Exception ex)
{
_logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load atlas '{atlasPath}'");
}
try try
{ {
@@ -41,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V21
{ {
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -52,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V21
{ {
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -61,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V21
catch (Exception ex) catch (Exception ex)
{ {
_atlas.Dispose(); _atlas.Dispose();
throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); _logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load skeleton file {skelPath}");
} }
// 加载动画数据 // 加载动画数据

View File

@@ -30,8 +30,15 @@ namespace Spine.Implementations.SpineWrappers.V34
: base(skelPath, atlasPath, textureLoader) : base(skelPath, atlasPath, textureLoader)
{ {
// 加载 atlas // 加载 atlas
try { _atlas = new Atlas(atlasPath, textureLoader); } try
catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } {
_atlas = new Atlas(atlasPath, textureLoader);
}
catch (Exception ex)
{
_logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load atlas '{atlasPath}'");
}
try try
{ {
@@ -41,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V34
{ {
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -52,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V34
{ {
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -61,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V34
catch (Exception ex) catch (Exception ex)
{ {
_atlas.Dispose(); _atlas.Dispose();
throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); _logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load skeleton file {skelPath}");
} }
// 加载动画数据 // 加载动画数据

View File

@@ -30,8 +30,15 @@ namespace Spine.Implementations.SpineWrappers.V35
: base(skelPath, atlasPath, textureLoader) : base(skelPath, atlasPath, textureLoader)
{ {
// 加载 atlas // 加载 atlas
try { _atlas = new Atlas(atlasPath, textureLoader); } try
catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } {
_atlas = new Atlas(atlasPath, textureLoader);
}
catch (Exception ex)
{
_logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load atlas '{atlasPath}'");
}
try try
{ {
@@ -41,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V35
{ {
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -52,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V35
{ {
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -61,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V35
catch (Exception ex) catch (Exception ex)
{ {
_atlas.Dispose(); _atlas.Dispose();
throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); _logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load skeleton file {skelPath}");
} }
// 加载动画数据 // 加载动画数据

View File

@@ -30,8 +30,15 @@ namespace Spine.Implementations.SpineWrappers.V36
: base(skelPath, atlasPath, textureLoader) : base(skelPath, atlasPath, textureLoader)
{ {
// 加载 atlas // 加载 atlas
try { _atlas = new Atlas(atlasPath, textureLoader); } try
catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } {
_atlas = new Atlas(atlasPath, textureLoader);
}
catch (Exception ex)
{
_logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load atlas '{atlasPath}'");
}
try try
{ {
@@ -41,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V36
{ {
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -52,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V36
{ {
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -61,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V36
catch (Exception ex) catch (Exception ex)
{ {
_atlas.Dispose(); _atlas.Dispose();
throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); _logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load skeleton file {skelPath}");
} }
// 加载动画数据 // 加载动画数据

View File

@@ -30,8 +30,15 @@ namespace Spine.Implementations.SpineWrappers.V37
: base(skelPath, atlasPath, textureLoader) : base(skelPath, atlasPath, textureLoader)
{ {
// 加载 atlas // 加载 atlas
try { _atlas = new Atlas(atlasPath, textureLoader); } try
catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } {
_atlas = new Atlas(atlasPath, textureLoader);
}
catch (Exception ex)
{
_logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load atlas '{atlasPath}'");
}
try try
{ {
@@ -41,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V37
{ {
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -52,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V37
{ {
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -61,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V37
catch (Exception ex) catch (Exception ex)
{ {
_atlas.Dispose(); _atlas.Dispose();
throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); _logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load skeleton file {skelPath}");
} }
// 加载动画数据 // 加载动画数据

View File

@@ -31,8 +31,15 @@ namespace Spine.Implementations.SpineWrappers.V38
: base(skelPath, atlasPath, textureLoader) : base(skelPath, atlasPath, textureLoader)
{ {
// 加载 atlas // 加载 atlas
try { _atlas = new Atlas(atlasPath, textureLoader); } try
catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } {
_atlas = new Atlas(atlasPath, textureLoader);
}
catch (Exception ex)
{
_logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load atlas '{atlasPath}'");
}
try try
{ {
@@ -42,8 +49,9 @@ namespace Spine.Implementations.SpineWrappers.V38
{ {
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -53,8 +61,9 @@ namespace Spine.Implementations.SpineWrappers.V38
{ {
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -62,7 +71,8 @@ namespace Spine.Implementations.SpineWrappers.V38
catch (Exception ex) catch (Exception ex)
{ {
_atlas.Dispose(); _atlas.Dispose();
throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); _logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load skeleton file {skelPath}");
} }
// 加载动画数据 // 加载动画数据

View File

@@ -30,10 +30,16 @@ namespace Spine.Implementations.SpineWrappers.V40
: base(skelPath, atlasPath, textureLoader) : base(skelPath, atlasPath, textureLoader)
{ {
// 加载 atlas // 加载 atlas
try { _atlas = new Atlas(atlasPath, textureLoader); } try
catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } {
_atlas = new Atlas(atlasPath, textureLoader);
}
catch (Exception ex)
{
_logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load atlas '{atlasPath}'");
}
// 加载 skel
try try
{ {
if (Utf8Validator.IsUtf8(skelPath)) if (Utf8Validator.IsUtf8(skelPath))
@@ -42,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V40
{ {
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -53,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V40
{ {
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -62,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V40
catch (Exception ex) catch (Exception ex)
{ {
_atlas.Dispose(); _atlas.Dispose();
throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); _logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load skeleton file {skelPath}");
} }
// 加载动画数据 // 加载动画数据

View File

@@ -30,10 +30,16 @@ namespace Spine.Implementations.SpineWrappers.V41
: base(skelPath, atlasPath, textureLoader) : base(skelPath, atlasPath, textureLoader)
{ {
// 加载 atlas // 加载 atlas
try { _atlas = new Atlas(atlasPath, textureLoader); } try
catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } {
_atlas = new Atlas(atlasPath, textureLoader);
}
catch (Exception ex)
{
_logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load atlas '{atlasPath}'");
}
// 加载 skel
try try
{ {
if (Utf8Validator.IsUtf8(skelPath)) if (Utf8Validator.IsUtf8(skelPath))
@@ -42,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V41
{ {
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -53,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V41
{ {
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -62,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V41
catch (Exception ex) catch (Exception ex)
{ {
_atlas.Dispose(); _atlas.Dispose();
throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); _logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load skeleton file {skelPath}");
} }
// 加载动画数据 // 加载动画数据

View File

@@ -30,10 +30,16 @@ namespace Spine.Implementations.SpineWrappers.V42
: base(skelPath, atlasPath, textureLoader) : base(skelPath, atlasPath, textureLoader)
{ {
// 加载 atlas // 加载 atlas
try { _atlas = new Atlas(atlasPath, textureLoader); } try
catch (Exception ex) { throw new InvalidDataException($"Failed to load atlas '{atlasPath}'", ex); } {
_atlas = new Atlas(atlasPath, textureLoader);
}
catch (Exception ex)
{
_logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load atlas '{atlasPath}'");
}
// 加载 skel
try try
{ {
if (Utf8Validator.IsUtf8(skelPath)) if (Utf8Validator.IsUtf8(skelPath))
@@ -42,8 +48,9 @@ namespace Spine.Implementations.SpineWrappers.V42
{ {
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -53,8 +60,9 @@ namespace Spine.Implementations.SpineWrappers.V42
{ {
_skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonBinary(_atlas).ReadSkeletonData(skelPath);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
_skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath); _skeletonData = new SkeletonJson(_atlas).ReadSkeletonData(skelPath);
} }
} }
@@ -62,7 +70,8 @@ namespace Spine.Implementations.SpineWrappers.V42
catch (Exception ex) catch (Exception ex)
{ {
_atlas.Dispose(); _atlas.Dispose();
throw new InvalidDataException($"Failed to load skeleton file {skelPath}", ex); _logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load skeleton file {skelPath}");
} }
// 加载动画数据 // 加载动画数据

View File

@@ -7,7 +7,7 @@
<TargetFramework>net8.0-windows</TargetFramework> <TargetFramework>net8.0-windows</TargetFramework>
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath> <BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion> <IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<Version>0.15.14</Version> <Version>0.15.15</Version>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>

View File

@@ -115,8 +115,9 @@ namespace Spine
{ {
_data = SpineObjectData.New(Version, skelPath, atlasPath, textureLoader); _data = SpineObjectData.New(Version, skelPath, atlasPath, textureLoader);
} }
catch catch (Exception ex)
{ {
_logger.Trace(ex.ToString());
throw new InvalidDataException($"Failed to load spine with version '{version}'"); throw new InvalidDataException($"Failed to load spine with version '{version}'");
} }
} }

View File

@@ -5,6 +5,7 @@ using System.Collections.Immutable;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using NLog;
using Spine.SpineWrappers.Attachments; using Spine.SpineWrappers.Attachments;
namespace Spine.SpineWrappers namespace Spine.SpineWrappers
@@ -17,6 +18,8 @@ namespace Spine.SpineWrappers
ISpineObjectData, ISpineObjectData,
IDisposable IDisposable
{ {
protected static readonly Logger _logger = LogManager.GetCurrentClassLogger();
/// <summary> /// <summary>
/// 构建版本对象 /// 构建版本对象
/// </summary> /// </summary>

View File

@@ -7,7 +7,7 @@
<TargetFramework>net8.0-windows</TargetFramework> <TargetFramework>net8.0-windows</TargetFramework>
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath> <BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion> <IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<Version>0.15.14</Version> <Version>0.15.15</Version>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
</PropertyGroup> </PropertyGroup>

View File

@@ -11,6 +11,7 @@ using SpineViewer.ViewModels.Exporters;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -45,6 +46,11 @@ namespace SpineViewer.ViewModels.MainWindow
_customFFmpegExporterViewModel = new(_vmMain); _customFFmpegExporterViewModel = new(_vmMain);
} }
/// <summary>
/// 请求选中项发生变化
/// </summary>
public event NotifyCollectionChangedEventHandler? RequestSelectionChanging;
/// <summary> /// <summary>
/// 单帧导出 ViewModel /// 单帧导出 ViewModel
/// </summary> /// </summary>
@@ -489,6 +495,19 @@ namespace SpineViewer.ViewModels.MainWindow
{ {
var sp = new SpineObjectModel(skelPath, atlasPath); var sp = new SpineObjectModel(skelPath, atlasPath);
lock (_spineObjectModels.Lock) _spineObjectModels.Add(sp); lock (_spineObjectModels.Lock) _spineObjectModels.Add(sp);
if (Application.Current.Dispatcher.CheckAccess())
{
RequestSelectionChanging?.Invoke(this, new(NotifyCollectionChangedAction.Reset));
RequestSelectionChanging?.Invoke(this, new(NotifyCollectionChangedAction.Add, sp));
}
else
{
Application.Current.Dispatcher.Invoke(() =>
{
RequestSelectionChanging?.Invoke(this, new(NotifyCollectionChangedAction.Reset));
RequestSelectionChanging?.Invoke(this, new(NotifyCollectionChangedAction.Add, sp));
});
}
return true; return true;
} }
catch (Exception ex) catch (Exception ex)
@@ -505,6 +524,19 @@ namespace SpineViewer.ViewModels.MainWindow
{ {
var sp = new SpineObjectModel(cfg); var sp = new SpineObjectModel(cfg);
lock (_spineObjectModels.Lock) _spineObjectModels.Add(sp); lock (_spineObjectModels.Lock) _spineObjectModels.Add(sp);
if (Application.Current.Dispatcher.CheckAccess())
{
RequestSelectionChanging?.Invoke(this, new(NotifyCollectionChangedAction.Reset));
RequestSelectionChanging?.Invoke(this, new(NotifyCollectionChangedAction.Add, sp));
}
else
{
Application.Current.Dispatcher.Invoke(() =>
{
RequestSelectionChanging?.Invoke(this, new(NotifyCollectionChangedAction.Reset));
RequestSelectionChanging?.Invoke(this, new(NotifyCollectionChangedAction.Add, sp));
});
}
return true; return true;
} }
catch (Exception ex) catch (Exception ex)

View File

@@ -30,7 +30,7 @@ namespace SpineViewer.Views;
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
/// <summary> /// <summary>
/// 布局文件保存路径 /// 上一次状态文件保存路径
/// </summary> /// </summary>
public static readonly string LastStateFilePath = Path.Combine(Path.GetDirectoryName(Environment.ProcessPath), "laststate.json"); public static readonly string LastStateFilePath = Path.Combine(Path.GetDirectoryName(Environment.ProcessPath), "laststate.json");
@@ -46,8 +46,8 @@ public partial class MainWindow : Window
InitializeLogConfiguration(); InitializeLogConfiguration();
_vm = new (_renderPanel); _vm = new (_renderPanel);
DataContext = _vm; DataContext = _vm;
_vm.SpineObjectListViewModel.RequestSelectionChanging += SpinesListView_RequestSelectionChanging;
_vm.SFMLRendererViewModel.RequestSelectionChanging += SpinesListView_RequestSelectionChanging; _vm.SFMLRendererViewModel.RequestSelectionChanging += SpinesListView_RequestSelectionChanging;
Loaded += MainWindow_Loaded; Loaded += MainWindow_Loaded;
Closed += MainWindow_Closed; Closed += MainWindow_Closed;
} }