diff --git a/SpineViewer/Dialogs/ExportDialog.Designer.cs b/SpineViewer/Dialogs/ExportDialog.Designer.cs
index 2568017..23f505c 100644
--- a/SpineViewer/Dialogs/ExportDialog.Designer.cs
+++ b/SpineViewer/Dialogs/ExportDialog.Designer.cs
@@ -73,6 +73,7 @@
propertyGrid_ExportArgs.Dock = DockStyle.Fill;
propertyGrid_ExportArgs.Location = new Point(3, 3);
propertyGrid_ExportArgs.Name = "propertyGrid_ExportArgs";
+ propertyGrid_ExportArgs.PropertySort = PropertySort.Categorized;
propertyGrid_ExportArgs.Size = new Size(604, 594);
propertyGrid_ExportArgs.TabIndex = 1;
propertyGrid_ExportArgs.ToolbarVisible = false;
diff --git a/SpineViewer/Dialogs/ExportDialog.cs b/SpineViewer/Dialogs/ExportDialog.cs
index f8f6eef..69bbf4c 100644
--- a/SpineViewer/Dialogs/ExportDialog.cs
+++ b/SpineViewer/Dialogs/ExportDialog.cs
@@ -1,12 +1,15 @@
using SpineViewer.Exporter;
using System;
+using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
+using System.Diagnostics;
using System.Drawing;
using System.Drawing.Design;
using System.Drawing.Imaging;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -18,10 +21,52 @@ namespace SpineViewer.Dialogs
///
/// 要绑定的导出参数
///
- public required ExportArgs ExportArgs
- {
- get => propertyGrid_ExportArgs.SelectedObject as ExportArgs;
- init => propertyGrid_ExportArgs.SelectedObject = value;
+ public required ExportArgs ExportArgs
+ {
+ get => propertyGrid_ExportArgs.SelectedObject as ExportArgs;
+ init
+ {
+ propertyGrid_ExportArgs.SelectedObject = value;
+
+ #region XXX: 通过反射默认高亮指定的项
+ var categories = propertyGrid_ExportArgs.SelectedGridItem?.Parent?.Parent?.GridItems;
+ if (categories is null) return;
+
+ foreach (var category in categories)
+ {
+ // 查找 "导出" 分组
+ if (category == null) continue;
+ PropertyInfo? labelProp = category.GetType().GetProperty("Label", BindingFlags.Instance | BindingFlags.Public);
+ if (labelProp == null) continue;
+ string? label = labelProp.GetValue(category) as string;
+ if (label != "导出") continue;
+
+ // 获取该分组下的所有属性项
+ PropertyInfo? gridItemsProp = category.GetType().GetProperty("GridItems", BindingFlags.Instance | BindingFlags.Public);
+ if (gridItemsProp == null) continue;
+ var gridItemsObj = gridItemsProp.GetValue(category);
+ if (gridItemsObj is not IEnumerable gridItems) continue;
+
+ foreach (object item in gridItems)
+ {
+ if (item == null) continue;
+ PropertyInfo? propDescProp = item.GetType().GetProperty("PropertyDescriptor", BindingFlags.Instance | BindingFlags.Public);
+ if (propDescProp == null) continue;
+ var propDesc = propDescProp.GetValue(item) as PropertyDescriptor;
+ if (propDesc == null) continue;
+ if (propDesc.Name == "OutputDir")
+ {
+
+ if (item is GridItem gridItem)
+ propertyGrid_ExportArgs.SelectedGridItem = gridItem; // 找到后,将此项设为选中项
+ else
+ propertyGrid_ExportArgs.SelectedGridItem = (GridItem)item; // 如果转换失败,则尝试直接赋值
+ }
+ return; // 设置成功后退出
+ }
+ }
+ #endregion
+ }
}
public ExportDialog()
diff --git a/SpineViewer/Exporter/ExportArgs.cs b/SpineViewer/Exporter/ExportArgs.cs
index 604b712..6211dab 100644
--- a/SpineViewer/Exporter/ExportArgs.cs
+++ b/SpineViewer/Exporter/ExportArgs.cs
@@ -22,7 +22,7 @@ namespace SpineViewer.Exporter
public string? OutputDir { get; set; } = null;
///
- /// 逐个导出
+ /// 导出单个
///
[Category("导出"), DisplayName("导出单个"), Description("是否将模型在同一个画面上导出单个文件,否则逐个导出模型")]
public bool ExportSingle { get; set; } = false;
@@ -32,20 +32,21 @@ namespace SpineViewer.Exporter
///
[ReadOnly(true)]
[TypeConverter(typeof(SizeConverter))]
- [Category("导出"), DisplayName("分辨率"), Description("画面的宽高像素大小")]
+ [Category("导出"), DisplayName("分辨率"), Description("画面的宽高像素大小,请在预览画面参数面板进行调整")]
public required Size Resolution { get; init; }
///
/// 渲染视窗
///
- [Browsable(false)]
+ [ReadOnly(true)]
+ [Category("导出"), DisplayName("视图"), Description("画面的视图参数,请在预览画面参数面板进行调整")]
public required SFML.Graphics.View View { get; init; }
///
/// 是否仅渲染选中
///
[ReadOnly(true)]
- [Category("导出"), DisplayName("仅渲染选中"), Description("是否仅导出选中的模型")]
+ [Category("导出"), DisplayName("仅渲染选中"), Description("是否仅导出选中的模型,请在预览画面参数面板进行调整")]
public required bool RenderSelectedOnly { get; init; }
///