修复问题
This commit is contained in:
@@ -194,7 +194,7 @@
|
|||||||
tabPage_Slot.Name = "tabPage_Slot";
|
tabPage_Slot.Name = "tabPage_Slot";
|
||||||
tabPage_Slot.Size = new Size(364, 370);
|
tabPage_Slot.Size = new Size(364, 370);
|
||||||
tabPage_Slot.TabIndex = 6;
|
tabPage_Slot.TabIndex = 6;
|
||||||
tabPage_Slot.Text = "槽位";
|
tabPage_Slot.Text = "插槽";
|
||||||
//
|
//
|
||||||
// propertyGrid_Slot
|
// propertyGrid_Slot
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
//private SkeletonClipping clipping = new();
|
//private SkeletonClipping clipping = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所有槽位在所有皮肤中可用的附件集合
|
/// 所有插槽在所有皮肤中可用的附件集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Dictionary<string, Dictionary<string, Attachment>> slotAttachments = [];
|
private readonly Dictionary<string, Dictionary<string, Attachment>> slotAttachments = [];
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
private readonly SkeletonClipping clipping = new();
|
private readonly SkeletonClipping clipping = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所有槽位在所有皮肤中可用的附件集合
|
/// 所有插槽在所有皮肤中可用的附件集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Dictionary<string, Dictionary<string, Attachment>> slotAttachments = [];
|
private readonly Dictionary<string, Dictionary<string, Attachment>> slotAttachments = [];
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
private readonly SkeletonClipping clipping = new();
|
private readonly SkeletonClipping clipping = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所有槽位在所有皮肤中可用的附件集合
|
/// 所有插槽在所有皮肤中可用的附件集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Dictionary<string, Dictionary<string, Attachment>> slotAttachments = [];
|
private readonly Dictionary<string, Dictionary<string, Attachment>> slotAttachments = [];
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
private readonly SkeletonClipping clipping = new();
|
private readonly SkeletonClipping clipping = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所有槽位在所有皮肤中可用的附件集合
|
/// 所有插槽在所有皮肤中可用的附件集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Dictionary<string, Dictionary<string, Attachment>> slotAttachments = [];
|
private readonly Dictionary<string, Dictionary<string, Attachment>> slotAttachments = [];
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
private readonly SkeletonClipping clipping = new();
|
private readonly SkeletonClipping clipping = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所有槽位在所有皮肤中可用的附件集合
|
/// 所有插槽在所有皮肤中可用的附件集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Dictionary<string, Dictionary<string, Attachment>> slotAttachments = [];
|
private readonly Dictionary<string, Dictionary<string, Attachment>> slotAttachments = [];
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
private readonly SkeletonClipping clipping = new();
|
private readonly SkeletonClipping clipping = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所有槽位在所有皮肤中可用的附件集合
|
/// 所有插槽在所有皮肤中可用的附件集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Dictionary<string, Dictionary<string, Attachment>> slotAttachments = [];
|
private readonly Dictionary<string, Dictionary<string, Attachment>> slotAttachments = [];
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace SpineViewer.Spine.Implementations.SpineObject
|
|||||||
private readonly SkeletonClipping clipping = new();
|
private readonly SkeletonClipping clipping = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所有槽位在所有皮肤中可用的附件集合
|
/// 所有插槽在所有皮肤中可用的附件集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Dictionary<string, Dictionary<string, Attachment>> slotAttachments = [];
|
private readonly Dictionary<string, Dictionary<string, Attachment>> slotAttachments = [];
|
||||||
|
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ namespace SpineViewer.Spine
|
|||||||
protected bool debugClippings = false;
|
protected bool debugClippings = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 所有槽位下可用的附件名
|
/// 所有插槽下可用的附件名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public FrozenDictionary<string, ImmutableArray<string>> SlotAttachmentNames { get; protected set; }
|
public FrozenDictionary<string, ImmutableArray<string>> SlotAttachmentNames { get; protected set; }
|
||||||
|
|
||||||
@@ -340,13 +340,13 @@ namespace SpineViewer.Spine
|
|||||||
public ImmutableArray<string> AnimationNames { get; protected set; }
|
public ImmutableArray<string> AnimationNames { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取某个槽位当前加载的附件
|
/// 获取某个插槽当前加载的附件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string GetSlotAttachment(string slot) { lock (_lock) return getSlotAttachment(slot); }
|
public string GetSlotAttachment(string slot) { lock (_lock) return getSlotAttachment(slot); }
|
||||||
protected abstract string getSlotAttachment(string slot);
|
protected abstract string getSlotAttachment(string slot);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置某个槽位当前加载的附件
|
/// 设置某个插槽当前加载的附件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetSlotAttachment(string slot, string name) { lock (_lock) setSlotAttachment(slot, name); }
|
public void SetSlotAttachment(string slot, string name) { lock (_lock) setSlotAttachment(slot, name); }
|
||||||
protected abstract void setSlotAttachment(string slot, string name);
|
protected abstract void setSlotAttachment(string slot, string name);
|
||||||
|
|||||||
@@ -186,17 +186,13 @@ namespace SpineViewer.Spine.SpineView
|
|||||||
{
|
{
|
||||||
return new StandardValuesCollection(tracks.Spine.AnimationNames);
|
return new StandardValuesCollection(tracks.Spine.AnimationNames);
|
||||||
}
|
}
|
||||||
else if (context?.Instance is SpineAnimationProperty[] animTracks)
|
else if (context?.Instance is object[] instances)
|
||||||
{
|
{
|
||||||
// XXX: 莫名其妙好了, 不是 object[] 类型是具体的类型了
|
IEnumerable<string> common = [];
|
||||||
if (animTracks.Length > 0)
|
foreach (SpineAnimationProperty prop in instances.Where(inst => inst is SpineAnimationProperty))
|
||||||
{
|
common = common.Union(prop.Spine.AnimationNames);
|
||||||
IEnumerable<string> common = animTracks[0].Spine.AnimationNames;
|
|
||||||
foreach (var t in animTracks.Skip(1))
|
|
||||||
common = common.Union(t.Spine.AnimationNames);
|
|
||||||
return new StandardValuesCollection(common.ToArray());
|
return new StandardValuesCollection(common.ToArray());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return base.GetStandardValues(context);
|
return base.GetStandardValues(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace SpineViewer.Spine.SpineView
|
|||||||
public SpineSkinProperty Skin { get; } = new(spine);
|
public SpineSkinProperty Skin { get; } = new(spine);
|
||||||
|
|
||||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||||
[DisplayName("皮肤")]
|
[DisplayName("插槽")]
|
||||||
public SpineSlotProperty Slot { get; } = new(spine);
|
public SpineSlotProperty Slot { get; } = new(spine);
|
||||||
|
|
||||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using System.Threading.Tasks;
|
|||||||
namespace SpineViewer.Spine.SpineView
|
namespace SpineViewer.Spine.SpineView
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用于在 PropertyGrid 上显示槽位附件加载情况包装类
|
/// 用于在 PropertyGrid 上显示插槽附件加载情况包装类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SpineSlotProperty(SpineObject spine) : ICustomTypeDescriptor
|
public class SpineSlotProperty(SpineObject spine) : ICustomTypeDescriptor
|
||||||
{
|
{
|
||||||
@@ -18,7 +18,7 @@ namespace SpineViewer.Spine.SpineView
|
|||||||
public SpineObject Spine { get; } = spine;
|
public SpineObject Spine { get; } = spine;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示所有槽位集合
|
/// 显示所有插槽集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override string ToString() => $"[{string.Join(", ", Spine.SlotAttachmentNames.Keys)}]";
|
public override string ToString() => $"[{string.Join(", ", Spine.SlotAttachmentNames.Keys)}]";
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ namespace SpineViewer.Spine.SpineView
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 槽位属性描述符, 实现对属性的读取和赋值
|
/// 插槽属性描述符, 实现对属性的读取和赋值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class SlotPropertyDescriptor(string name, Attribute[]? attributes) : PropertyDescriptor(name, attributes)
|
internal class SlotPropertyDescriptor(string name, Attribute[]? attributes) : PropertyDescriptor(name, attributes)
|
||||||
{
|
{
|
||||||
@@ -153,21 +153,17 @@ namespace SpineViewer.Spine.SpineView
|
|||||||
if (slots.Spine.SlotAttachmentNames.TryGetValue(pd.Name, out var names))
|
if (slots.Spine.SlotAttachmentNames.TryGetValue(pd.Name, out var names))
|
||||||
return new StandardValuesCollection(names);
|
return new StandardValuesCollection(names);
|
||||||
}
|
}
|
||||||
else if (context?.Instance is SpineSlotProperty[] spinesSlots)
|
else if (context?.Instance is object[] instances)
|
||||||
{
|
|
||||||
// XXX: 莫名其妙好了, 不是 object[] 类型是具体的类型了
|
|
||||||
if (spinesSlots.Length > 0)
|
|
||||||
{
|
{
|
||||||
IEnumerable<string> common = [];
|
IEnumerable<string> common = [];
|
||||||
foreach (var t in spinesSlots)
|
foreach (SpineSlotProperty prop in instances.Where(inst => inst is SpineSlotProperty))
|
||||||
{
|
{
|
||||||
if (t.Spine.SlotAttachmentNames.TryGetValue(pd.Name, out var names))
|
if (prop.Spine.SlotAttachmentNames.TryGetValue(pd.Name, out var names))
|
||||||
common = common.Union(names);
|
common = common.Union(names);
|
||||||
}
|
}
|
||||||
return new StandardValuesCollection(common.ToArray());
|
return new StandardValuesCollection(common.ToArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return base.GetStandardValues(context);
|
return base.GetStandardValues(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user