修改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

@@ -159,68 +159,68 @@ namespace SpineViewer.ViewModels.MainWindow
public bool UsePma
{
get => SpineObjectListViewModel.LoadOptions.UsePma;
set => SetProperty(SpineObjectListViewModel.LoadOptions.UsePma, value, v => SpineObjectListViewModel.LoadOptions.UsePma = v);
get => SpineObjectModel.LoadOptions.UsePma;
set => SetProperty(SpineObjectModel.LoadOptions.UsePma, value, v => SpineObjectModel.LoadOptions.UsePma = v);
}
public bool DebugTexture
{
get => SpineObjectListViewModel.LoadOptions.DebugTexture;
set => SetProperty(SpineObjectListViewModel.LoadOptions.DebugTexture, value, v => SpineObjectListViewModel.LoadOptions.DebugTexture = v);
get => SpineObjectModel.LoadOptions.DebugTexture;
set => SetProperty(SpineObjectModel.LoadOptions.DebugTexture, value, v => SpineObjectModel.LoadOptions.DebugTexture = v);
}
public bool DebugBounds
{
get => SpineObjectListViewModel.LoadOptions.DebugBounds;
set => SetProperty(SpineObjectListViewModel.LoadOptions.DebugBounds, value, v => SpineObjectListViewModel.LoadOptions.DebugBounds = v);
get => SpineObjectModel.LoadOptions.DebugBounds;
set => SetProperty(SpineObjectModel.LoadOptions.DebugBounds, value, v => SpineObjectModel.LoadOptions.DebugBounds = v);
}
public bool DebugBones
{
get => SpineObjectListViewModel.LoadOptions.DebugBones;
set => SetProperty(SpineObjectListViewModel.LoadOptions.DebugBones, value, v => SpineObjectListViewModel.LoadOptions.DebugBones = v);
get => SpineObjectModel.LoadOptions.DebugBones;
set => SetProperty(SpineObjectModel.LoadOptions.DebugBones, value, v => SpineObjectModel.LoadOptions.DebugBones = v);
}
public bool DebugRegions
{
get => SpineObjectListViewModel.LoadOptions.DebugRegions;
set => SetProperty(SpineObjectListViewModel.LoadOptions.DebugRegions, value, v => SpineObjectListViewModel.LoadOptions.DebugRegions = v);
get => SpineObjectModel.LoadOptions.DebugRegions;
set => SetProperty(SpineObjectModel.LoadOptions.DebugRegions, value, v => SpineObjectModel.LoadOptions.DebugRegions = v);
}
public bool DebugMeshHulls
{
get => SpineObjectListViewModel.LoadOptions.DebugMeshHulls;
set => SetProperty(SpineObjectListViewModel.LoadOptions.DebugMeshHulls, value, v => SpineObjectListViewModel.LoadOptions.DebugMeshHulls = v);
get => SpineObjectModel.LoadOptions.DebugMeshHulls;
set => SetProperty(SpineObjectModel.LoadOptions.DebugMeshHulls, value, v => SpineObjectModel.LoadOptions.DebugMeshHulls = v);
}
public bool DebugMeshes
{
get => SpineObjectListViewModel.LoadOptions.DebugMeshes;
set => SetProperty(SpineObjectListViewModel.LoadOptions.DebugMeshes, value, v => SpineObjectListViewModel.LoadOptions.DebugMeshes = v);
get => SpineObjectModel.LoadOptions.DebugMeshes;
set => SetProperty(SpineObjectModel.LoadOptions.DebugMeshes, value, v => SpineObjectModel.LoadOptions.DebugMeshes = v);
}
public bool DebugBoundingBoxes
{
get => SpineObjectListViewModel.LoadOptions.DebugBoundingBoxes;
set => SetProperty(SpineObjectListViewModel.LoadOptions.DebugBoundingBoxes, value, v => SpineObjectListViewModel.LoadOptions.DebugBoundingBoxes = v);
get => SpineObjectModel.LoadOptions.DebugBoundingBoxes;
set => SetProperty(SpineObjectModel.LoadOptions.DebugBoundingBoxes, value, v => SpineObjectModel.LoadOptions.DebugBoundingBoxes = v);
}
public bool DebugPaths
{
get => SpineObjectListViewModel.LoadOptions.DebugPaths;
set => SetProperty(SpineObjectListViewModel.LoadOptions.DebugPaths, value, v => SpineObjectListViewModel.LoadOptions.DebugPaths = v);
get => SpineObjectModel.LoadOptions.DebugPaths;
set => SetProperty(SpineObjectModel.LoadOptions.DebugPaths, value, v => SpineObjectModel.LoadOptions.DebugPaths = v);
}
public bool DebugPoints
{
get => SpineObjectListViewModel.LoadOptions.DebugPoints;
set => SetProperty(SpineObjectListViewModel.LoadOptions.DebugPoints, value, v => SpineObjectListViewModel.LoadOptions.DebugPoints = v);
get => SpineObjectModel.LoadOptions.DebugPoints;
set => SetProperty(SpineObjectModel.LoadOptions.DebugPoints, value, v => SpineObjectModel.LoadOptions.DebugPoints = v);
}
public bool DebugClippings
{
get => SpineObjectListViewModel.LoadOptions.DebugClippings;
set => SetProperty(SpineObjectListViewModel.LoadOptions.DebugClippings, value, v => SpineObjectListViewModel.LoadOptions.DebugClippings = v);
get => SpineObjectModel.LoadOptions.DebugClippings;
set => SetProperty(SpineObjectModel.LoadOptions.DebugClippings, value, v => SpineObjectModel.LoadOptions.DebugClippings = v);
}
#endregion

View File

@@ -21,12 +21,6 @@ namespace SpineViewer.ViewModels.MainWindow
{
public class SpineObjectListViewModel : ObservableObject
{
/// <summary>
/// 加载选项
/// </summary>
public static SpineLoadOptions LoadOptions => _loadOptions;
private static readonly SpineLoadOptions _loadOptions = new();
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
/// <summary>
@@ -349,20 +343,7 @@ namespace SpineViewer.ViewModels.MainWindow
{
try
{
var sp = new SpineObjectModel(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
};
var sp = new SpineObjectModel(skelPath, atlasPath);
lock (_spineObjectModels.Lock) _spineObjectModels.Add(sp);
return true;
}
@@ -373,21 +354,5 @@ namespace SpineViewer.ViewModels.MainWindow
}
return false;
}
public class SpineLoadOptions
{
// TODO: 判断是否记忆参数
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; }
}
}
}