From 0a999ceb41f046399c5e2624dde064c91820ba4d Mon Sep 17 00:00:00 2001 From: ww-rm Date: Tue, 8 Apr 2025 13:21:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20SpinePropertyGrid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SpineViewer/Controls/SpineListView.cs | 21 +- SpineViewer/Controls/SpinePreviewer.cs | 4 +- .../Controls/SpinePropertyGrid.Designer.cs | 267 ++++++++++++++++++ SpineViewer/Controls/SpinePropertyGrid.cs | 126 +++++++++ .../SpinePropertyGrid.resx} | 6 + .../SpineAnimationEditorDialog.Designer.cs | 153 ---------- .../Dialogs/SpineAnimationEditorDialog.cs | 49 ---- .../Dialogs/SpineAnimationEditorDialog.resx | 120 -------- .../Dialogs/SpineSkinEditorDialog.Designer.cs | 153 ---------- SpineViewer/Dialogs/SpineSkinEditorDialog.cs | 51 ---- SpineViewer/MainForm.Designer.cs | 59 ++-- .../Spine/SpineSkinWrapper.cs | 4 +- .../Spine/SpineWrapper.cs | 2 - .../PropertyGridWrappers/UITypeEditor.cs | 48 ---- 14 files changed, 444 insertions(+), 619 deletions(-) create mode 100644 SpineViewer/Controls/SpinePropertyGrid.Designer.cs create mode 100644 SpineViewer/Controls/SpinePropertyGrid.cs rename SpineViewer/{Dialogs/SpineSkinEditorDialog.resx => Controls/SpinePropertyGrid.resx} (93%) delete mode 100644 SpineViewer/Dialogs/SpineAnimationEditorDialog.Designer.cs delete mode 100644 SpineViewer/Dialogs/SpineAnimationEditorDialog.cs delete mode 100644 SpineViewer/Dialogs/SpineAnimationEditorDialog.resx delete mode 100644 SpineViewer/Dialogs/SpineSkinEditorDialog.Designer.cs delete mode 100644 SpineViewer/Dialogs/SpineSkinEditorDialog.cs diff --git a/SpineViewer/Controls/SpineListView.cs b/SpineViewer/Controls/SpineListView.cs index e5a5659..f9f715a 100644 --- a/SpineViewer/Controls/SpineListView.cs +++ b/SpineViewer/Controls/SpineListView.cs @@ -49,8 +49,8 @@ namespace SpineViewer.Controls /// /// 显示骨骼信息的属性面板 /// - [Category("自定义"), Description("用于显示骨骼属性的属性页")] - public PropertyGrid? PropertyGrid { get; set; } + [Category("自定义"), Description("用于显示模型属性的组合属性页")] + public SpinePropertyGrid? SpinePropertyGrid { get; set; } /// /// 选中的索引 @@ -248,14 +248,14 @@ namespace SpineViewer.Controls { lock (Spines) { - if (PropertyGrid is not null) + if (SpinePropertyGrid is not null) { if (listView.SelectedIndices.Count <= 0) - PropertyGrid.SelectedObject = null; + SpinePropertyGrid.SelectedSpines = null; else if (listView.SelectedIndices.Count <= 1) - PropertyGrid.SelectedObject = spinePropertyWrappers[spines[listView.SelectedIndices[0]].ID]; + SpinePropertyGrid.SelectedSpines = [spinePropertyWrappers[spines[listView.SelectedIndices[0]].ID]]; else - PropertyGrid.SelectedObjects = listView.SelectedIndices.Cast().Select(index => spinePropertyWrappers[spines[index].ID]).ToArray(); + SpinePropertyGrid.SelectedSpines = listView.SelectedIndices.Cast().Select(index => spinePropertyWrappers[spines[index].ID]).ToArray(); } // 标记选中的 Spine @@ -522,8 +522,8 @@ namespace SpineViewer.Controls listView.SmallImageList.Images.Clear(); listView.LargeImageList.Images.Clear(); } - if (PropertyGrid is not null) - PropertyGrid.SelectedObject = null; + if (SpinePropertyGrid is not null) + SpinePropertyGrid.SelectedSpines = null; } private void toolStripMenuItem_CopyPreview_Click(object sender, EventArgs e) @@ -581,4 +581,9 @@ namespace SpineViewer.Controls listView.View = View.Details; } } + + public class DefaultSpineConfig + { + + } } diff --git a/SpineViewer/Controls/SpinePreviewer.cs b/SpineViewer/Controls/SpinePreviewer.cs index 6b55487..49040b5 100644 --- a/SpineViewer/Controls/SpinePreviewer.cs +++ b/SpineViewer/Controls/SpinePreviewer.cs @@ -561,7 +561,7 @@ namespace SpineViewer.Controls // 右键高优先级, 结束画面拖动模式 if ((e.Button & MouseButtons.Right) != 0) { - SpineListView?.PropertyGrid?.Refresh(); + SpineListView?.SpinePropertyGrid?.Refresh(); draggingSrc = null; Cursor = Cursors.Default; @@ -571,7 +571,7 @@ namespace SpineViewer.Controls else if ((e.Button & MouseButtons.Left) != 0 && (MouseButtons & MouseButtons.Right) == 0) { draggingSrc = null; - SpineListView?.PropertyGrid?.Refresh(); + SpineListView?.SpinePropertyGrid?.Refresh(); } } diff --git a/SpineViewer/Controls/SpinePropertyGrid.Designer.cs b/SpineViewer/Controls/SpinePropertyGrid.Designer.cs new file mode 100644 index 0000000..551a107 --- /dev/null +++ b/SpineViewer/Controls/SpinePropertyGrid.Designer.cs @@ -0,0 +1,267 @@ +namespace SpineViewer.Controls +{ + partial class SpinePropertyGrid + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + tabControl = new TabControl(); + tabPage_BaseInfo = new TabPage(); + propertyGrid_BaseInfo = new PropertyGrid(); + tabPage_Render = new TabPage(); + propertyGrid_Render = new PropertyGrid(); + tabPage_Transform = new TabPage(); + propertyGrid_Transform = new PropertyGrid(); + tabPage_Skin = new TabPage(); + propertyGrid_Skin = new PropertyGrid(); + contextMenuStrip_Skin = new ContextMenuStrip(components); + toolStripMenuItem_AddSkin = new ToolStripMenuItem(); + toolStripMenuItem_RemoveSkin = new ToolStripMenuItem(); + tabPage_Animation = new TabPage(); + propertyGrid_Animation = new PropertyGrid(); + contextMenuStrip_Animation = new ContextMenuStrip(components); + toolStripMenuItem_AddAnimation = new ToolStripMenuItem(); + toolStripMenuItem_RemoveAnimation = new ToolStripMenuItem(); + tabControl.SuspendLayout(); + tabPage_BaseInfo.SuspendLayout(); + tabPage_Render.SuspendLayout(); + tabPage_Transform.SuspendLayout(); + tabPage_Skin.SuspendLayout(); + contextMenuStrip_Skin.SuspendLayout(); + tabPage_Animation.SuspendLayout(); + contextMenuStrip_Animation.SuspendLayout(); + SuspendLayout(); + // + // tabControl + // + tabControl.Alignment = TabAlignment.Bottom; + tabControl.Controls.Add(tabPage_BaseInfo); + tabControl.Controls.Add(tabPage_Render); + tabControl.Controls.Add(tabPage_Transform); + tabControl.Controls.Add(tabPage_Skin); + tabControl.Controls.Add(tabPage_Animation); + tabControl.Dock = DockStyle.Fill; + tabControl.ItemSize = new Size(100, 35); + tabControl.Location = new Point(0, 0); + tabControl.Multiline = true; + tabControl.Name = "tabControl"; + tabControl.Padding = new Point(0, 0); + tabControl.SelectedIndex = 0; + tabControl.Size = new Size(365, 448); + tabControl.SizeMode = TabSizeMode.FillToRight; + tabControl.TabIndex = 0; + // + // tabPage_BaseInfo + // + tabPage_BaseInfo.Controls.Add(propertyGrid_BaseInfo); + tabPage_BaseInfo.Location = new Point(4, 4); + tabPage_BaseInfo.Name = "tabPage_BaseInfo"; + tabPage_BaseInfo.Size = new Size(357, 405); + tabPage_BaseInfo.TabIndex = 0; + tabPage_BaseInfo.Text = "基本信息"; + tabPage_BaseInfo.UseVisualStyleBackColor = true; + // + // propertyGrid_BaseInfo + // + propertyGrid_BaseInfo.Dock = DockStyle.Fill; + propertyGrid_BaseInfo.HelpVisible = false; + propertyGrid_BaseInfo.Location = new Point(0, 0); + propertyGrid_BaseInfo.Name = "propertyGrid_BaseInfo"; + propertyGrid_BaseInfo.PropertySort = PropertySort.Alphabetical; + propertyGrid_BaseInfo.Size = new Size(357, 405); + propertyGrid_BaseInfo.TabIndex = 0; + propertyGrid_BaseInfo.ToolbarVisible = false; + // + // tabPage_Render + // + tabPage_Render.Controls.Add(propertyGrid_Render); + tabPage_Render.Location = new Point(4, 4); + tabPage_Render.Name = "tabPage_Render"; + tabPage_Render.Size = new Size(357, 405); + tabPage_Render.TabIndex = 1; + tabPage_Render.Text = "渲染"; + tabPage_Render.UseVisualStyleBackColor = true; + // + // propertyGrid_Render + // + propertyGrid_Render.Dock = DockStyle.Fill; + propertyGrid_Render.HelpVisible = false; + propertyGrid_Render.Location = new Point(0, 0); + propertyGrid_Render.Name = "propertyGrid_Render"; + propertyGrid_Render.PropertySort = PropertySort.Alphabetical; + propertyGrid_Render.Size = new Size(357, 405); + propertyGrid_Render.TabIndex = 1; + propertyGrid_Render.ToolbarVisible = false; + // + // tabPage_Transform + // + tabPage_Transform.Controls.Add(propertyGrid_Transform); + tabPage_Transform.Location = new Point(4, 4); + tabPage_Transform.Name = "tabPage_Transform"; + tabPage_Transform.Size = new Size(357, 405); + tabPage_Transform.TabIndex = 2; + tabPage_Transform.Text = "变换"; + tabPage_Transform.UseVisualStyleBackColor = true; + // + // propertyGrid_Transform + // + propertyGrid_Transform.Dock = DockStyle.Fill; + propertyGrid_Transform.HelpVisible = false; + propertyGrid_Transform.Location = new Point(0, 0); + propertyGrid_Transform.Name = "propertyGrid_Transform"; + propertyGrid_Transform.PropertySort = PropertySort.Alphabetical; + propertyGrid_Transform.Size = new Size(357, 405); + propertyGrid_Transform.TabIndex = 1; + propertyGrid_Transform.ToolbarVisible = false; + // + // tabPage_Skin + // + tabPage_Skin.Controls.Add(propertyGrid_Skin); + tabPage_Skin.Location = new Point(4, 4); + tabPage_Skin.Name = "tabPage_Skin"; + tabPage_Skin.Size = new Size(357, 405); + tabPage_Skin.TabIndex = 3; + tabPage_Skin.Text = "皮肤"; + tabPage_Skin.UseVisualStyleBackColor = true; + // + // propertyGrid_Skin + // + propertyGrid_Skin.ContextMenuStrip = contextMenuStrip_Skin; + propertyGrid_Skin.Dock = DockStyle.Fill; + propertyGrid_Skin.HelpVisible = false; + propertyGrid_Skin.Location = new Point(0, 0); + propertyGrid_Skin.Name = "propertyGrid_Skin"; + propertyGrid_Skin.PropertySort = PropertySort.NoSort; + propertyGrid_Skin.Size = new Size(357, 405); + propertyGrid_Skin.TabIndex = 1; + propertyGrid_Skin.ToolbarVisible = false; + // + // contextMenuStrip_Skin + // + contextMenuStrip_Skin.ImageScalingSize = new Size(24, 24); + contextMenuStrip_Skin.Items.AddRange(new ToolStripItem[] { toolStripMenuItem_AddSkin, toolStripMenuItem_RemoveSkin }); + contextMenuStrip_Skin.Name = "contextMenuStrip1"; + contextMenuStrip_Skin.Size = new Size(117, 64); + contextMenuStrip_Skin.Opening += contextMenuStrip_Skin_Opening; + // + // toolStripMenuItem_AddSkin + // + toolStripMenuItem_AddSkin.Name = "toolStripMenuItem_AddSkin"; + toolStripMenuItem_AddSkin.Size = new Size(116, 30); + toolStripMenuItem_AddSkin.Text = "添加"; + toolStripMenuItem_AddSkin.Click += toolStripMenuItem_AddSkin_Click; + // + // toolStripMenuItem_RemoveSkin + // + toolStripMenuItem_RemoveSkin.Name = "toolStripMenuItem_RemoveSkin"; + toolStripMenuItem_RemoveSkin.Size = new Size(116, 30); + toolStripMenuItem_RemoveSkin.Text = "移除"; + toolStripMenuItem_RemoveSkin.Click += toolStripMenuItem_RemoveSkin_Click; + // + // tabPage_Animation + // + tabPage_Animation.Controls.Add(propertyGrid_Animation); + tabPage_Animation.Location = new Point(4, 4); + tabPage_Animation.Name = "tabPage_Animation"; + tabPage_Animation.Size = new Size(357, 405); + tabPage_Animation.TabIndex = 4; + tabPage_Animation.Text = "动画"; + tabPage_Animation.UseVisualStyleBackColor = true; + // + // propertyGrid_Animation + // + propertyGrid_Animation.ContextMenuStrip = contextMenuStrip_Animation; + propertyGrid_Animation.Dock = DockStyle.Fill; + propertyGrid_Animation.HelpVisible = false; + propertyGrid_Animation.Location = new Point(0, 0); + propertyGrid_Animation.Name = "propertyGrid_Animation"; + propertyGrid_Animation.PropertySort = PropertySort.NoSort; + propertyGrid_Animation.Size = new Size(357, 405); + propertyGrid_Animation.TabIndex = 1; + propertyGrid_Animation.ToolbarVisible = false; + // + // contextMenuStrip_Animation + // + contextMenuStrip_Animation.ImageScalingSize = new Size(24, 24); + contextMenuStrip_Animation.Items.AddRange(new ToolStripItem[] { toolStripMenuItem_AddAnimation, toolStripMenuItem_RemoveAnimation }); + contextMenuStrip_Animation.Name = "contextMenuStrip1"; + contextMenuStrip_Animation.Size = new Size(117, 64); + contextMenuStrip_Animation.Opening += contextMenuStrip_Animation_Opening; + // + // toolStripMenuItem_AddAnimation + // + toolStripMenuItem_AddAnimation.Name = "toolStripMenuItem_AddAnimation"; + toolStripMenuItem_AddAnimation.Size = new Size(116, 30); + toolStripMenuItem_AddAnimation.Text = "添加"; + toolStripMenuItem_AddAnimation.Click += toolStripMenuItem_AddAnimation_Click; + // + // toolStripMenuItem_RemoveAnimation + // + toolStripMenuItem_RemoveAnimation.Name = "toolStripMenuItem_RemoveAnimation"; + toolStripMenuItem_RemoveAnimation.Size = new Size(116, 30); + toolStripMenuItem_RemoveAnimation.Text = "移除"; + toolStripMenuItem_RemoveAnimation.Click += toolStripMenuItem_RemoveAnimation_Click; + // + // SpinePropertyGrid + // + AutoScaleDimensions = new SizeF(11F, 24F); + AutoScaleMode = AutoScaleMode.Font; + Controls.Add(tabControl); + Name = "SpinePropertyGrid"; + Size = new Size(365, 448); + tabControl.ResumeLayout(false); + tabPage_BaseInfo.ResumeLayout(false); + tabPage_Render.ResumeLayout(false); + tabPage_Transform.ResumeLayout(false); + tabPage_Skin.ResumeLayout(false); + contextMenuStrip_Skin.ResumeLayout(false); + tabPage_Animation.ResumeLayout(false); + contextMenuStrip_Animation.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private TabControl tabControl; + private TabPage tabPage_BaseInfo; + private TabPage tabPage_Render; + private TabPage tabPage_Transform; + private TabPage tabPage_Skin; + private TabPage tabPage_Animation; + private PropertyGrid propertyGrid_BaseInfo; + private PropertyGrid propertyGrid_Render; + private PropertyGrid propertyGrid_Transform; + private PropertyGrid propertyGrid_Skin; + private PropertyGrid propertyGrid_Animation; + private ContextMenuStrip contextMenuStrip_Skin; + private ContextMenuStrip contextMenuStrip_Animation; + private ToolStripMenuItem toolStripMenuItem_AddSkin; + private ToolStripMenuItem toolStripMenuItem_RemoveSkin; + private ToolStripMenuItem toolStripMenuItem_AddAnimation; + private ToolStripMenuItem toolStripMenuItem_RemoveAnimation; + } +} diff --git a/SpineViewer/Controls/SpinePropertyGrid.cs b/SpineViewer/Controls/SpinePropertyGrid.cs new file mode 100644 index 0000000..a423fdb --- /dev/null +++ b/SpineViewer/Controls/SpinePropertyGrid.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using SpineViewer.PropertyGridWrappers.Spine; + +namespace SpineViewer.Controls +{ + public partial class SpinePropertyGrid : UserControl + { + public SpinePropertyGrid() + { + InitializeComponent(); + } + + /// + /// 设置选中的对象列表, 可以赋值 null 来清空选中, 行为与 PropertyGrid.SelectedObjects 类似 + /// + public SpineWrapper[] SelectedSpines + { + get => selectedSpines ?? []; + set + { + if (value is null || value.Length <= 0) + { + selectedSpines = null; + propertyGrid_BaseInfo.SelectedObject = null; + propertyGrid_Render.SelectedObject = null; + propertyGrid_Transform.SelectedObject = null; + propertyGrid_Skin.SelectedObject = null; + propertyGrid_Animation.SelectedObject = null; + } + else + { + selectedSpines = value; + propertyGrid_BaseInfo.SelectedObjects = value.Select(e => e.BaseInfo).ToArray(); + propertyGrid_Render.SelectedObjects = value.Select(e => e.Render).ToArray(); + propertyGrid_Transform.SelectedObjects = value.Select(e => e.Transform).ToArray(); + propertyGrid_Skin.SelectedObjects = value.Select(e => e.Skin).ToArray(); + propertyGrid_Animation.SelectedObjects = value.Select(e => e.Animation).ToArray(); + } + } + } + private SpineWrapper[]? selectedSpines = null; + + private void contextMenuStrip_Skin_Opening(object sender, CancelEventArgs e) + { + if (selectedSpines?.Length == 1) + { + toolStripMenuItem_AddSkin.Enabled = true; + toolStripMenuItem_RemoveSkin.Enabled = propertyGrid_Skin.SelectedGridItem.Value is SkinWrapper; + } + else + { + toolStripMenuItem_AddSkin.Enabled = false; + toolStripMenuItem_RemoveSkin.Enabled = false; + } + } + + private void contextMenuStrip_Animation_Opening(object sender, CancelEventArgs e) + { + if (selectedSpines?.Length == 1) + { + toolStripMenuItem_AddAnimation.Enabled = true; + toolStripMenuItem_RemoveAnimation.Enabled = propertyGrid_Animation.SelectedGridItem.Value is TrackWrapper; + } + else + { + toolStripMenuItem_AddAnimation.Enabled = false; + toolStripMenuItem_RemoveAnimation.Enabled = false; + } + } + + private void toolStripMenuItem_AddSkin_Click(object sender, EventArgs e) + { + if (selectedSpines?.Length != 1) return; + + var spine = selectedSpines[0].Skin.Spine; + + if (spine.SkinNames.Count <= 0) + { + MessageBox.Info("没有可用的皮肤"); + return; + } + + spine.LoadSkin(spine.SkinNames[0]); + propertyGrid_Skin.Refresh(); + } + + private void toolStripMenuItem_RemoveSkin_Click(object sender, EventArgs e) + { + if (selectedSpines?.Length != 1) return; + + if (propertyGrid_Skin.SelectedGridItem.Value is SkinWrapper wrapper) + { + selectedSpines[0].Skin.Spine.UnloadSkin(wrapper.Index); + propertyGrid_Skin.Refresh(); + } + } + + private void toolStripMenuItem_AddAnimation_Click(object sender, EventArgs e) + { + if (selectedSpines?.Length != 1) return; + + var spine = selectedSpines[0].Animation.Spine; + spine.SetAnimation(spine.GetTrackIndices().Max() + 1, spine.AnimationNames[0]); + propertyGrid_Animation.Refresh(); + } + + private void toolStripMenuItem_RemoveAnimation_Click(object sender, EventArgs e) + { + if (selectedSpines?.Length != 1) return; + + if (propertyGrid_Animation.SelectedGridItem.Value is TrackWrapper wrapper) + { + selectedSpines[0].Animation.Spine.ClearTrack(wrapper.Index); + propertyGrid_Animation.Refresh(); + } + } + } +} diff --git a/SpineViewer/Dialogs/SpineSkinEditorDialog.resx b/SpineViewer/Controls/SpinePropertyGrid.resx similarity index 93% rename from SpineViewer/Dialogs/SpineSkinEditorDialog.resx rename to SpineViewer/Controls/SpinePropertyGrid.resx index 8b2ff64..972f8a9 100644 --- a/SpineViewer/Dialogs/SpineSkinEditorDialog.resx +++ b/SpineViewer/Controls/SpinePropertyGrid.resx @@ -117,4 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 29, 26 + + + 318, 25 + \ No newline at end of file diff --git a/SpineViewer/Dialogs/SpineAnimationEditorDialog.Designer.cs b/SpineViewer/Dialogs/SpineAnimationEditorDialog.Designer.cs deleted file mode 100644 index 99ea2e2..0000000 --- a/SpineViewer/Dialogs/SpineAnimationEditorDialog.Designer.cs +++ /dev/null @@ -1,153 +0,0 @@ -namespace SpineViewer.Dialogs -{ - partial class SpineAnimationEditorDialog - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - panel = new Panel(); - tableLayoutPanel1 = new TableLayoutPanel(); - flowLayoutPanel1 = new FlowLayoutPanel(); - button_Add = new Button(); - button_Delete = new Button(); - button_Ok = new Button(); - propertyGrid_AnimationTracks = new PropertyGrid(); - panel.SuspendLayout(); - tableLayoutPanel1.SuspendLayout(); - flowLayoutPanel1.SuspendLayout(); - SuspendLayout(); - // - // panel - // - panel.Controls.Add(tableLayoutPanel1); - panel.Dock = DockStyle.Fill; - panel.Location = new Point(0, 0); - panel.Name = "panel"; - panel.Padding = new Padding(50, 15, 50, 10); - panel.Size = new Size(666, 483); - panel.TabIndex = 0; - // - // tableLayoutPanel1 - // - tableLayoutPanel1.ColumnCount = 1; - tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); - tableLayoutPanel1.Controls.Add(flowLayoutPanel1, 0, 1); - tableLayoutPanel1.Controls.Add(propertyGrid_AnimationTracks, 0, 0); - tableLayoutPanel1.Dock = DockStyle.Fill; - tableLayoutPanel1.Location = new Point(50, 15); - tableLayoutPanel1.Name = "tableLayoutPanel1"; - tableLayoutPanel1.RowCount = 2; - tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); - tableLayoutPanel1.RowStyles.Add(new RowStyle()); - tableLayoutPanel1.Size = new Size(566, 458); - tableLayoutPanel1.TabIndex = 0; - // - // flowLayoutPanel1 - // - flowLayoutPanel1.AutoSize = true; - flowLayoutPanel1.Controls.Add(button_Add); - flowLayoutPanel1.Controls.Add(button_Delete); - flowLayoutPanel1.Controls.Add(button_Ok); - flowLayoutPanel1.Dock = DockStyle.Fill; - flowLayoutPanel1.Location = new Point(3, 415); - flowLayoutPanel1.Name = "flowLayoutPanel1"; - flowLayoutPanel1.Size = new Size(560, 40); - flowLayoutPanel1.TabIndex = 2; - // - // button_Add - // - button_Add.Location = new Point(3, 3); - button_Add.Name = "button_Add"; - button_Add.Size = new Size(112, 34); - button_Add.TabIndex = 0; - button_Add.Text = "添加"; - button_Add.UseVisualStyleBackColor = true; - button_Add.Click += button_Add_Click; - // - // button_Delete - // - button_Delete.Location = new Point(121, 3); - button_Delete.Name = "button_Delete"; - button_Delete.Size = new Size(112, 34); - button_Delete.TabIndex = 1; - button_Delete.Text = "删除"; - button_Delete.UseVisualStyleBackColor = true; - button_Delete.Click += button_Delete_Click; - // - // button_Ok - // - button_Ok.Location = new Point(239, 3); - button_Ok.Name = "button_Ok"; - button_Ok.Size = new Size(112, 34); - button_Ok.TabIndex = 2; - button_Ok.Text = "确定"; - button_Ok.UseVisualStyleBackColor = true; - button_Ok.Click += button_Ok_Click; - // - // propertyGrid_AnimationTracks - // - propertyGrid_AnimationTracks.Dock = DockStyle.Fill; - propertyGrid_AnimationTracks.HelpVisible = false; - propertyGrid_AnimationTracks.Location = new Point(3, 3); - propertyGrid_AnimationTracks.Name = "propertyGrid_AnimationTracks"; - propertyGrid_AnimationTracks.PropertySort = PropertySort.NoSort; - propertyGrid_AnimationTracks.Size = new Size(560, 406); - propertyGrid_AnimationTracks.TabIndex = 1; - propertyGrid_AnimationTracks.ToolbarVisible = false; - // - // AnimationTracksEditorDialog - // - AcceptButton = button_Ok; - AutoScaleDimensions = new SizeF(11F, 24F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(666, 483); - Controls.Add(panel); - FormBorderStyle = FormBorderStyle.FixedDialog; - MaximizeBox = false; - MinimizeBox = false; - Name = "AnimationTracksEditorDialog"; - ShowIcon = false; - ShowInTaskbar = false; - StartPosition = FormStartPosition.CenterScreen; - Text = "多轨道动画实时编辑器"; - panel.ResumeLayout(false); - tableLayoutPanel1.ResumeLayout(false); - tableLayoutPanel1.PerformLayout(); - flowLayoutPanel1.ResumeLayout(false); - ResumeLayout(false); - } - - #endregion - - private Panel panel; - private TableLayoutPanel tableLayoutPanel1; - private FlowLayoutPanel flowLayoutPanel1; - private Button button_Add; - private Button button_Delete; - private PropertyGrid propertyGrid_AnimationTracks; - private Button button_Ok; - } -} \ No newline at end of file diff --git a/SpineViewer/Dialogs/SpineAnimationEditorDialog.cs b/SpineViewer/Dialogs/SpineAnimationEditorDialog.cs deleted file mode 100644 index 64cba30..0000000 --- a/SpineViewer/Dialogs/SpineAnimationEditorDialog.cs +++ /dev/null @@ -1,49 +0,0 @@ -using SpineViewer.PropertyGridWrappers.Spine; -using SpineViewer.Spine; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace SpineViewer.Dialogs -{ - public partial class SpineAnimationEditorDialog : Form - { - private readonly Spine.Spine spine; - public SpineAnimationEditorDialog(Spine.Spine spine) - { - InitializeComponent(); - this.spine = spine; - propertyGrid_AnimationTracks.SelectedObject = new SpineAnimationWrapper(spine); - } - - private void button_Add_Click(object sender, EventArgs e) - { - spine.SetAnimation(spine.GetTrackIndices().Max() + 1, spine.AnimationNames[0]); - propertyGrid_AnimationTracks.Refresh(); - } - - private void button_Delete_Click(object sender, EventArgs e) - { - if (propertyGrid_AnimationTracks.SelectedGridItem?.Value is TrackWrapper tr) - { - if (tr.Index == 0) - MessageBox.Info("必须保留轨道 0"); - else - spine.ClearTrack(tr.Index); - } - propertyGrid_AnimationTracks.Refresh(); - propertyGrid_AnimationTracks.SelectedGridItem = propertyGrid_AnimationTracks.SelectedGridItem?.Parent?.GridItems?.Cast().Last(); - } - - private void button_Ok_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.OK; - } - } -} diff --git a/SpineViewer/Dialogs/SpineAnimationEditorDialog.resx b/SpineViewer/Dialogs/SpineAnimationEditorDialog.resx deleted file mode 100644 index 8b2ff64..0000000 --- a/SpineViewer/Dialogs/SpineAnimationEditorDialog.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/SpineViewer/Dialogs/SpineSkinEditorDialog.Designer.cs b/SpineViewer/Dialogs/SpineSkinEditorDialog.Designer.cs deleted file mode 100644 index 2bb054e..0000000 --- a/SpineViewer/Dialogs/SpineSkinEditorDialog.Designer.cs +++ /dev/null @@ -1,153 +0,0 @@ -namespace SpineViewer.Dialogs -{ - partial class SpineSkinEditorDialog - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - panel = new Panel(); - tableLayoutPanel1 = new TableLayoutPanel(); - flowLayoutPanel1 = new FlowLayoutPanel(); - button_Add = new Button(); - button_Delete = new Button(); - button_Ok = new Button(); - propertyGrid_SkinManager = new PropertyGrid(); - panel.SuspendLayout(); - tableLayoutPanel1.SuspendLayout(); - flowLayoutPanel1.SuspendLayout(); - SuspendLayout(); - // - // panel - // - panel.Controls.Add(tableLayoutPanel1); - panel.Dock = DockStyle.Fill; - panel.Location = new Point(0, 0); - panel.Name = "panel"; - panel.Padding = new Padding(50, 15, 50, 10); - panel.Size = new Size(666, 483); - panel.TabIndex = 0; - // - // tableLayoutPanel1 - // - tableLayoutPanel1.ColumnCount = 1; - tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); - tableLayoutPanel1.Controls.Add(flowLayoutPanel1, 0, 1); - tableLayoutPanel1.Controls.Add(propertyGrid_SkinManager, 0, 0); - tableLayoutPanel1.Dock = DockStyle.Fill; - tableLayoutPanel1.Location = new Point(50, 15); - tableLayoutPanel1.Name = "tableLayoutPanel1"; - tableLayoutPanel1.RowCount = 2; - tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); - tableLayoutPanel1.RowStyles.Add(new RowStyle()); - tableLayoutPanel1.Size = new Size(566, 458); - tableLayoutPanel1.TabIndex = 0; - // - // flowLayoutPanel1 - // - flowLayoutPanel1.AutoSize = true; - flowLayoutPanel1.Controls.Add(button_Add); - flowLayoutPanel1.Controls.Add(button_Delete); - flowLayoutPanel1.Controls.Add(button_Ok); - flowLayoutPanel1.Dock = DockStyle.Fill; - flowLayoutPanel1.Location = new Point(3, 415); - flowLayoutPanel1.Name = "flowLayoutPanel1"; - flowLayoutPanel1.Size = new Size(560, 40); - flowLayoutPanel1.TabIndex = 2; - // - // button_Add - // - button_Add.Location = new Point(3, 3); - button_Add.Name = "button_Add"; - button_Add.Size = new Size(112, 34); - button_Add.TabIndex = 0; - button_Add.Text = "添加"; - button_Add.UseVisualStyleBackColor = true; - button_Add.Click += button_Add_Click; - // - // button_Delete - // - button_Delete.Location = new Point(121, 3); - button_Delete.Name = "button_Delete"; - button_Delete.Size = new Size(112, 34); - button_Delete.TabIndex = 1; - button_Delete.Text = "删除"; - button_Delete.UseVisualStyleBackColor = true; - button_Delete.Click += button_Delete_Click; - // - // button_Ok - // - button_Ok.Location = new Point(239, 3); - button_Ok.Name = "button_Ok"; - button_Ok.Size = new Size(112, 34); - button_Ok.TabIndex = 3; - button_Ok.Text = "确定"; - button_Ok.UseVisualStyleBackColor = true; - button_Ok.Click += button_Ok_Click; - // - // propertyGrid_SkinManager - // - propertyGrid_SkinManager.Dock = DockStyle.Fill; - propertyGrid_SkinManager.HelpVisible = false; - propertyGrid_SkinManager.Location = new Point(3, 3); - propertyGrid_SkinManager.Name = "propertyGrid_SkinManager"; - propertyGrid_SkinManager.PropertySort = PropertySort.NoSort; - propertyGrid_SkinManager.Size = new Size(560, 406); - propertyGrid_SkinManager.TabIndex = 1; - propertyGrid_SkinManager.ToolbarVisible = false; - // - // SkinManagerEditorDialog - // - AcceptButton = button_Ok; - AutoScaleDimensions = new SizeF(11F, 24F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(666, 483); - Controls.Add(panel); - FormBorderStyle = FormBorderStyle.FixedDialog; - MaximizeBox = false; - MinimizeBox = false; - Name = "SkinManagerEditorDialog"; - ShowIcon = false; - ShowInTaskbar = false; - StartPosition = FormStartPosition.CenterScreen; - Text = "皮肤列表实时编辑器"; - panel.ResumeLayout(false); - tableLayoutPanel1.ResumeLayout(false); - tableLayoutPanel1.PerformLayout(); - flowLayoutPanel1.ResumeLayout(false); - ResumeLayout(false); - } - - #endregion - - private Panel panel; - private TableLayoutPanel tableLayoutPanel1; - private FlowLayoutPanel flowLayoutPanel1; - private Button button_Add; - private Button button_Delete; - private PropertyGrid propertyGrid_SkinManager; - private Button button_Ok; - } -} \ No newline at end of file diff --git a/SpineViewer/Dialogs/SpineSkinEditorDialog.cs b/SpineViewer/Dialogs/SpineSkinEditorDialog.cs deleted file mode 100644 index fd84e59..0000000 --- a/SpineViewer/Dialogs/SpineSkinEditorDialog.cs +++ /dev/null @@ -1,51 +0,0 @@ -using SpineViewer.PropertyGridWrappers.Spine; -using SpineViewer.Spine; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace SpineViewer.Dialogs -{ - public partial class SpineSkinEditorDialog : Form - { - private readonly Spine.Spine spine; - public SpineSkinEditorDialog(Spine.Spine spine) - { - InitializeComponent(); - this.spine = spine; - propertyGrid_SkinManager.SelectedObject = new SpineSkinWrapper(spine); // TODO: 去掉对话框 - } - - private void button_Add_Click(object sender, EventArgs e) - { - if (spine.SkinNames.Count <= 0) - { - MessageBox.Info($"{spine.Name} 没有可用的皮肤"); - return; - } - spine.LoadSkin(spine.SkinNames[0]); - propertyGrid_SkinManager.Refresh(); - } - - private void button_Delete_Click(object sender, EventArgs e) - { - if (propertyGrid_SkinManager.SelectedGridItem?.Value is SkinWrapper sk) - spine.UnloadSkin(sk.Index); - propertyGrid_SkinManager.Refresh(); - - if (propertyGrid_SkinManager.SelectedGridItem?.Parent?.GridItems?.Cast().Last() is GridItem gt) - propertyGrid_SkinManager.SelectedGridItem = gt; - } - - private void button_Ok_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.OK; - } - } -} diff --git a/SpineViewer/MainForm.Designer.cs b/SpineViewer/MainForm.Designer.cs index ee08d52..732f5aa 100644 --- a/SpineViewer/MainForm.Designer.cs +++ b/SpineViewer/MainForm.Designer.cs @@ -60,11 +60,11 @@ splitContainer_Information = new SplitContainer(); groupBox_SkelList = new GroupBox(); spineListView = new SpineViewer.Controls.SpineListView(); - propertyGrid_Spine = new PropertyGrid(); splitContainer_Config = new SplitContainer(); groupBox_PreviewConfig = new GroupBox(); propertyGrid_Previewer = new PropertyGrid(); groupBox_SkelConfig = new GroupBox(); + spinePropertyGrid = new SpineViewer.Controls.SpinePropertyGrid(); groupBox_Preview = new GroupBox(); spinePreviewer = new SpineViewer.Controls.SpinePreviewer(); panel_MainForm = new Panel(); @@ -115,27 +115,27 @@ // toolStripMenuItem_Open.Name = "toolStripMenuItem_Open"; toolStripMenuItem_Open.ShortcutKeys = Keys.Control | Keys.O; - toolStripMenuItem_Open.Size = new Size(270, 34); + toolStripMenuItem_Open.Size = new Size(254, 34); toolStripMenuItem_Open.Text = "打开(&O)..."; toolStripMenuItem_Open.Click += toolStripMenuItem_Open_Click; // // toolStripMenuItem_BatchOpen // toolStripMenuItem_BatchOpen.Name = "toolStripMenuItem_BatchOpen"; - toolStripMenuItem_BatchOpen.Size = new Size(270, 34); + toolStripMenuItem_BatchOpen.Size = new Size(254, 34); toolStripMenuItem_BatchOpen.Text = "批量打开(&B)..."; toolStripMenuItem_BatchOpen.Click += toolStripMenuItem_BatchOpen_Click; // // toolStripSeparator1 // toolStripSeparator1.Name = "toolStripSeparator1"; - toolStripSeparator1.Size = new Size(267, 6); + toolStripSeparator1.Size = new Size(251, 6); // // toolStripMenuItem_Export // toolStripMenuItem_Export.DropDownItems.AddRange(new ToolStripItem[] { toolStripMenuItem_ExportFrame, toolStripMenuItem_ExportFrameSequence, toolStripMenuItem_ExportGif, toolStripMenuItem_ExportMp4, toolStripMenuItem_ExportWebm, toolStripMenuItem_ExportMkv, toolStripMenuItem_ExportMov, toolStripMenuItem_ExportCustom }); toolStripMenuItem_Export.Name = "toolStripMenuItem_Export"; - toolStripMenuItem_Export.Size = new Size(270, 34); + toolStripMenuItem_Export.Size = new Size(254, 34); toolStripMenuItem_Export.Text = "导出(&E)"; // // toolStripMenuItem_ExportFrame @@ -197,13 +197,13 @@ // toolStripSeparator2 // toolStripSeparator2.Name = "toolStripSeparator2"; - toolStripSeparator2.Size = new Size(267, 6); + toolStripSeparator2.Size = new Size(251, 6); // // toolStripMenuItem_Exit // toolStripMenuItem_Exit.Name = "toolStripMenuItem_Exit"; toolStripMenuItem_Exit.ShortcutKeys = Keys.Alt | Keys.F4; - toolStripMenuItem_Exit.Size = new Size(270, 34); + toolStripMenuItem_Exit.Size = new Size(254, 34); toolStripMenuItem_Exit.Text = "退出(&X)"; toolStripMenuItem_Exit.Click += toolStripMenuItem_Exit_Click; // @@ -271,7 +271,7 @@ rtbLog.Margin = new Padding(3, 2, 3, 2); rtbLog.Name = "rtbLog"; rtbLog.ReadOnly = true; - rtbLog.Size = new Size(1758, 124); + rtbLog.Size = new Size(1758, 136); rtbLog.TabIndex = 0; rtbLog.Text = ""; rtbLog.WordWrap = false; @@ -295,7 +295,7 @@ splitContainer_MainForm.Panel2.Controls.Add(rtbLog); splitContainer_MainForm.Panel2.Cursor = Cursors.Default; splitContainer_MainForm.Size = new Size(1758, 1097); - splitContainer_MainForm.SplitterDistance = 965; + splitContainer_MainForm.SplitterDistance = 953; splitContainer_MainForm.SplitterWidth = 8; splitContainer_MainForm.TabIndex = 3; splitContainer_MainForm.TabStop = false; @@ -319,7 +319,7 @@ // splitContainer_Functional.Panel2.Controls.Add(groupBox_Preview); splitContainer_Functional.Panel2.Cursor = Cursors.Default; - splitContainer_Functional.Size = new Size(1758, 965); + splitContainer_Functional.Size = new Size(1758, 953); splitContainer_Functional.SplitterDistance = 759; splitContainer_Functional.SplitterWidth = 8; splitContainer_Functional.TabIndex = 2; @@ -343,7 +343,7 @@ // splitContainer_Information.Panel2.Controls.Add(splitContainer_Config); splitContainer_Information.Panel2.Cursor = Cursors.Default; - splitContainer_Information.Size = new Size(759, 965); + splitContainer_Information.Size = new Size(759, 953); splitContainer_Information.SplitterDistance = 354; splitContainer_Information.SplitterWidth = 8; splitContainer_Information.TabIndex = 1; @@ -357,7 +357,7 @@ groupBox_SkelList.Dock = DockStyle.Fill; groupBox_SkelList.Location = new Point(0, 0); groupBox_SkelList.Name = "groupBox_SkelList"; - groupBox_SkelList.Size = new Size(354, 965); + groupBox_SkelList.Size = new Size(354, 953); groupBox_SkelList.TabIndex = 0; groupBox_SkelList.TabStop = false; groupBox_SkelList.Text = "模型列表"; @@ -367,21 +367,10 @@ spineListView.Dock = DockStyle.Fill; spineListView.Location = new Point(3, 26); spineListView.Name = "spineListView"; - spineListView.PropertyGrid = propertyGrid_Spine; - spineListView.Size = new Size(348, 936); + spineListView.Size = new Size(348, 924); + spineListView.SpinePropertyGrid = spinePropertyGrid; spineListView.TabIndex = 0; // - // propertyGrid_Spine - // - propertyGrid_Spine.Dock = DockStyle.Fill; - propertyGrid_Spine.HelpVisible = false; - propertyGrid_Spine.Location = new Point(3, 26); - propertyGrid_Spine.Name = "propertyGrid_Spine"; - propertyGrid_Spine.Size = new Size(391, 602); - propertyGrid_Spine.TabIndex = 0; - propertyGrid_Spine.ToolbarVisible = false; - propertyGrid_Spine.PropertyValueChanged += propertyGrid_PropertyValueChanged; - // // splitContainer_Config // splitContainer_Config.Cursor = Cursors.SizeNS; @@ -400,7 +389,7 @@ // splitContainer_Config.Panel2.Controls.Add(groupBox_SkelConfig); splitContainer_Config.Panel2.Cursor = Cursors.Default; - splitContainer_Config.Size = new Size(397, 965); + splitContainer_Config.Size = new Size(397, 953); splitContainer_Config.SplitterDistance = 326; splitContainer_Config.SplitterWidth = 8; splitContainer_Config.TabIndex = 0; @@ -432,22 +421,30 @@ // // groupBox_SkelConfig // - groupBox_SkelConfig.Controls.Add(propertyGrid_Spine); + groupBox_SkelConfig.Controls.Add(spinePropertyGrid); groupBox_SkelConfig.Dock = DockStyle.Fill; groupBox_SkelConfig.Location = new Point(0, 0); groupBox_SkelConfig.Name = "groupBox_SkelConfig"; - groupBox_SkelConfig.Size = new Size(397, 631); + groupBox_SkelConfig.Size = new Size(397, 619); groupBox_SkelConfig.TabIndex = 0; groupBox_SkelConfig.TabStop = false; groupBox_SkelConfig.Text = "模型参数"; // + // spinePropertyGrid + // + spinePropertyGrid.Dock = DockStyle.Fill; + spinePropertyGrid.Location = new Point(3, 26); + spinePropertyGrid.Name = "spinePropertyGrid"; + spinePropertyGrid.Size = new Size(391, 590); + spinePropertyGrid.TabIndex = 0; + // // groupBox_Preview // groupBox_Preview.Controls.Add(spinePreviewer); groupBox_Preview.Dock = DockStyle.Fill; groupBox_Preview.Location = new Point(0, 0); groupBox_Preview.Name = "groupBox_Preview"; - groupBox_Preview.Size = new Size(991, 965); + groupBox_Preview.Size = new Size(991, 953); groupBox_Preview.TabIndex = 1; groupBox_Preview.TabStop = false; groupBox_Preview.Text = "预览画面"; @@ -458,7 +455,7 @@ spinePreviewer.Location = new Point(3, 26); spinePreviewer.Name = "spinePreviewer"; spinePreviewer.PropertyGrid = propertyGrid_Previewer; - spinePreviewer.Size = new Size(985, 936); + spinePreviewer.Size = new Size(985, 924); spinePreviewer.SpineListView = spineListView; spinePreviewer.TabIndex = 0; // @@ -540,7 +537,6 @@ private ToolStripMenuItem toolStripMenuItem_BatchOpen; private GroupBox groupBox_Preview; private ToolTip toolTip; - private PropertyGrid propertyGrid_Spine; private Controls.SpineListView spineListView; private PropertyGrid propertyGrid_Previewer; private Controls.SpinePreviewer spinePreviewer; @@ -559,5 +555,6 @@ private ToolStripMenuItem toolStripMenuItem_ExportMkv; private ToolStripMenuItem toolStripMenuItem_ExportWebm; private ToolStripMenuItem toolStripMenuItem_ExportCustom; + private Controls.SpinePropertyGrid spinePropertyGrid; } } diff --git a/SpineViewer/PropertyGridWrappers/Spine/SpineSkinWrapper.cs b/SpineViewer/PropertyGridWrappers/Spine/SpineSkinWrapper.cs index 18df3bc..bbd3460 100644 --- a/SpineViewer/PropertyGridWrappers/Spine/SpineSkinWrapper.cs +++ b/SpineViewer/PropertyGridWrappers/Spine/SpineSkinWrapper.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; namespace SpineViewer.PropertyGridWrappers.Spine { /// - /// 对皮肤的包装类 + /// 对皮肤属性的包装类 /// [TypeConverter(typeof(SkinWrapperConverter))] public class SkinWrapper(SpineViewer.Spine.Spine spine, int i) @@ -37,7 +37,7 @@ namespace SpineViewer.PropertyGridWrappers.Spine } /// - /// SkinManager 动态类型包装类, 用于提供对 Spine 皮肤列表的管理能力 + /// 皮肤列表动态类型包装类, 用于提供对 Spine 皮肤列表的管理能力 /// /// 关联的 Spine 对象 public class SpineSkinWrapper(SpineViewer.Spine.Spine spine) : ICustomTypeDescriptor diff --git a/SpineViewer/PropertyGridWrappers/Spine/SpineWrapper.cs b/SpineViewer/PropertyGridWrappers/Spine/SpineWrapper.cs index 91f82ad..e05f6f4 100644 --- a/SpineViewer/PropertyGridWrappers/Spine/SpineWrapper.cs +++ b/SpineViewer/PropertyGridWrappers/Spine/SpineWrapper.cs @@ -25,12 +25,10 @@ namespace SpineViewer.PropertyGridWrappers.Spine [DisplayName("变换")] public SpineTransformWrapper Transform { get; } = new(spine); - [Editor(typeof(SpineSkinEditor), typeof(UITypeEditor))] [TypeConverter(typeof(ExpandableObjectConverter))] [DisplayName("皮肤")] public SpineSkinWrapper Skin { get; } = new(spine); - [Editor(typeof(SpineAnimationEditor), typeof(UITypeEditor))] [TypeConverter(typeof(ExpandableObjectConverter))] [DisplayName("动画")] public SpineAnimationWrapper Animation { get; } = new(spine); diff --git a/SpineViewer/PropertyGridWrappers/UITypeEditor.cs b/SpineViewer/PropertyGridWrappers/UITypeEditor.cs index 7c5238b..bc2dd4d 100644 --- a/SpineViewer/PropertyGridWrappers/UITypeEditor.cs +++ b/SpineViewer/PropertyGridWrappers/UITypeEditor.cs @@ -121,52 +121,4 @@ namespace SpineViewer.PropertyGridWrappers return new TextureBrush(bitmap); } } - - /// - /// 多轨道动画编辑器 - /// - public class SpineSkinEditor : UITypeEditor - { - public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext? context) => UITypeEditorEditStyle.Modal; - - public override object? EditValue(ITypeDescriptorContext? context, IServiceProvider provider, object? value) - { - if (provider == null || context == null || context.Instance is not SpineWrapper) - return value; - - IWindowsFormsEditorService editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService; - if (editorService == null) - return value; - - using (var dialog = new SpineSkinEditorDialog(((SpineWrapper)context.Instance).Spine)) - editorService.ShowDialog(dialog); - - TypeDescriptor.Refresh(context.Instance); - return value; - } - } - - /// - /// 多轨道动画编辑器 - /// - public class SpineAnimationEditor : UITypeEditor - { - public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext? context) => UITypeEditorEditStyle.Modal; - - public override object? EditValue(ITypeDescriptorContext? context, IServiceProvider provider, object? value) - { - if (provider == null || context == null || context.Instance is not SpineWrapper) - return value; - - IWindowsFormsEditorService editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService; - if (editorService == null) - return value; - - using (var dialog = new SpineAnimationEditorDialog(((SpineWrapper)context.Instance).Spine)) - editorService.ShowDialog(dialog); - - TypeDescriptor.Refresh(context.Instance); - return value; - } - } }