修改LoadOptions的归属

This commit is contained in:
ww-rm
2025-06-14 11:14:27 +08:00
parent 6fe639d6dd
commit 0e7e7dd5d9
3 changed files with 59 additions and 59 deletions

View File

@@ -25,6 +25,12 @@ namespace SpineViewer.Models
/// </summary>
public class SpineObjectModel : ObservableObject, SFML.Graphics.Drawable, IDisposable
{
/// <summary>
/// 一些加载默认选项
/// </summary>
public static SpineObjectLoadOptions LoadOptions => _loadOptions;
private static readonly SpineObjectLoadOptions _loadOptions = new();
/// <summary>
/// 日志器
/// </summary>
@@ -42,7 +48,20 @@ namespace SpineViewer.Models
/// </summary>
public SpineObjectModel(string skelPath, string? atlasPath = null)
{
_spineObject = new(skelPath, atlasPath);
_spineObject = new(skelPath, atlasPath)
{
UsePma = _loadOptions.UsePma,
DebugTexture = _loadOptions.DebugTexture,
DebugBounds = _loadOptions.DebugBounds,
DebugRegions = _loadOptions.DebugRegions,
DebugMeshHulls = _loadOptions.DebugMeshHulls,
DebugMeshes = _loadOptions.DebugMeshes,
DebugBoundingBoxes = _loadOptions.DebugBoundingBoxes,
DebugPaths = _loadOptions.DebugPaths,
DebugPoints = _loadOptions.DebugPoints,
DebugClippings = _loadOptions.DebugClippings
};
_skins = _spineObject.Data.Skins.Select(v => v.Name).ToImmutableArray();
_slotAttachments = _spineObject.Data.SlotAttachments.ToFrozenDictionary(it => it.Key, it => it.Value.Keys);
_animations = _spineObject.Data.Animations.Select(v => v.Name).ToImmutableArray();
@@ -475,4 +494,20 @@ namespace SpineViewer.Models
public int TrackIndex { get; } = trackIndex;
public string? AnimationName { get; } = animationName;
}
public class SpineObjectLoadOptions
{
public bool AutoSave { get; set; }
public bool UsePma { get; set; }
public bool DebugTexture { get; set; } = true;
public bool DebugBounds { get; set; }
public bool DebugBones { get; set; }
public bool DebugRegions { get; set; }
public bool DebugMeshHulls { get; set; }
public bool DebugMeshes { get; set; }
public bool DebugBoundingBoxes { get; set; }
public bool DebugPaths { get; set; }
public bool DebugPoints { get; set; }
public bool DebugClippings { get; set; }
}
}