Compare commits

..

4 Commits

Author SHA1 Message Date
ww-rm
4e293daf62 更新至v0.10.9 2025-03-24 15:18:09 +08:00
ww-rm
f9d7fdc516 update readme 2025-03-24 15:17:42 +08:00
ww-rm
6a04f3955c 完善预览图导出参数 2025-03-24 15:15:59 +08:00
ww-rm
dce3b1780c update readme 2025-03-24 14:44:44 +08:00
5 changed files with 27 additions and 9 deletions

View File

@@ -1,5 +1,9 @@
# CHANGELOG # CHANGELOG
## v0.10.9
- 预览图导出增加名称后缀参数
## v0.10.8 ## v0.10.8
- 完善预览图导出 - 完善预览图导出

View File

@@ -81,7 +81,7 @@
### 格式与版本转换 ### 格式与版本转换
可以通过工具菜单进行骨骼文件换, 允许二进制和文本格式之间的转换, 以及不同版本间的转换. 可以通过工具菜单进行骨骼文件换, 允许二进制和文本格式之间的转换, 以及不同版本间的转换.
目前处于施工中, 仅支持转换 `3.8.x` 二进制到文本格式. 目前处于施工中, 仅支持转换 `3.8.x` 二进制到文本格式.

View File

@@ -37,7 +37,7 @@ namespace SpineViewer.Dialogs
var outputDir = textBox_OutputDir.Text; var outputDir = textBox_OutputDir.Text;
if (string.IsNullOrEmpty(outputDir)) if (string.IsNullOrEmpty(outputDir))
{ {
Result.OutputDir = null; outputDir = null;
} }
else else
{ {
@@ -63,9 +63,16 @@ namespace SpineViewer.Dialogs
return; return;
} }
} }
Result.OutputDir = Path.GetFullPath(outputDir); outputDir = Path.GetFullPath(outputDir);
} }
if (outputDir is null && string.IsNullOrEmpty(Result.NameSuffix))
{
MessageBox.Info("输出文件夹和名称后缀不可同时为空,存在文件覆盖风险");
return;
}
Result.OutputDir = outputDir;
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
} }
@@ -87,7 +94,7 @@ namespace SpineViewer.Dialogs
/// 预览图格式 /// 预览图格式
/// </summary> /// </summary>
[TypeConverter(typeof(ImageFormatConverter))] [TypeConverter(typeof(ImageFormatConverter))]
[Category("导出参数"), DisplayName("预览图格式")] [Category("图像"), DisplayName("预览图格式")]
public ImageFormat ImageFormat public ImageFormat ImageFormat
{ {
get => imageFormat; get => imageFormat;
@@ -103,7 +110,7 @@ namespace SpineViewer.Dialogs
/// 预览图分辨率 /// 预览图分辨率
/// </summary> /// </summary>
[TypeConverter(typeof(SizeConverter))] [TypeConverter(typeof(SizeConverter))]
[Category("导出参数"), DisplayName("分辨率")] [Category("图像"), DisplayName("分辨率")]
public Size Resolution public Size Resolution
{ {
get => resolution; get => resolution;
@@ -120,7 +127,7 @@ namespace SpineViewer.Dialogs
/// 四周填充像素值 /// 四周填充像素值
/// </summary> /// </summary>
[TypeConverter(typeof(PaddingConverter))] [TypeConverter(typeof(PaddingConverter))]
[Category("导出参数"), DisplayName("四周填充像素值")] [Category("图像"), DisplayName("四周填充像素值")]
public Padding Padding public Padding Padding
{ {
get => padding; get => padding;
@@ -139,7 +146,7 @@ namespace SpineViewer.Dialogs
/// DPI /// DPI
/// </summary> /// </summary>
[TypeConverter(typeof(SizeFConverter))] [TypeConverter(typeof(SizeFConverter))]
[Category("导出参数"), DisplayName("DPI")] [Category("图像"), DisplayName("DPI")]
public SizeF DPI public SizeF DPI
{ {
get => dpi; get => dpi;
@@ -151,6 +158,12 @@ namespace SpineViewer.Dialogs
} }
} }
private SizeF dpi = new(144, 144); private SizeF dpi = new(144, 144);
/// <summary>
/// 名称后缀
/// </summary>
[Category("其他"), DisplayName("名称后缀")]
public string NameSuffix { get; set; } = "(preview)";
} }
} }

View File

@@ -301,6 +301,7 @@ namespace SpineViewer
var resolution = arguments.Resolution; var resolution = arguments.Resolution;
var padding = arguments.Padding; var padding = arguments.Padding;
var dpi = arguments.DPI; var dpi = arguments.DPI;
var nameSuffix = arguments.NameSuffix;
var renderSelectedOnly = spinePreviewer.RenderSelectedOnly; var renderSelectedOnly = spinePreviewer.RenderSelectedOnly;
var tex = new SFML.Graphics.RenderTexture((uint)resolution.Width, (uint)resolution.Height); var tex = new SFML.Graphics.RenderTexture((uint)resolution.Width, (uint)resolution.Height);
@@ -325,7 +326,7 @@ namespace SpineViewer
if (renderSelectedOnly && !spine.IsSelected) if (renderSelectedOnly && !spine.IsSelected)
continue; continue;
var filename = $"(preview) {spine.Name}{imageFormat.GetSuffix()}"; // 加上 preview 是为了防止覆盖同名的 png 文件 var filename = $"{spine.Name}{nameSuffix}{imageFormat.GetSuffix()}";
var savePath = outputDir is null ? Path.Combine(spine.AssetsDir, filename) : Path.Combine(outputDir, filename); var savePath = outputDir is null ? Path.Combine(spine.AssetsDir, filename) : Path.Combine(outputDir, filename);
var tmp = spine.CurrentAnimation; var tmp = spine.CurrentAnimation;

View File

@@ -8,7 +8,7 @@
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath> <BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion> <IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<Version>0.10.8</Version> <Version>0.10.9</Version>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>appicon.ico</ApplicationIcon> <ApplicationIcon>appicon.ico</ApplicationIcon>