增加显示和渲染选中首选项

This commit is contained in:
ww-rm
2025-06-15 11:08:43 +08:00
parent 9a62d7eb53
commit 0dcf8c5577
5 changed files with 67 additions and 37 deletions

View File

@@ -33,6 +33,9 @@ namespace SpineViewer.Models
#region #region
[ObservableProperty]
private bool _isShown = true;
[ObservableProperty] [ObservableProperty]
private bool _usePma; private bool _usePma;
@@ -70,6 +73,9 @@ namespace SpineViewer.Models
#region #region
[ObservableProperty]
private bool _renderSelectedOnly;
[ObservableProperty] [ObservableProperty]
private AppLanguage _appLanguage; private AppLanguage _appLanguage;

View File

@@ -101,7 +101,7 @@ namespace SpineViewer.Models
get { lock (_lock) return _isShown; } get { lock (_lock) return _isShown; }
set { lock (_lock) SetProperty(ref _isShown, value); } set { lock (_lock) SetProperty(ref _isShown, value); }
} }
private bool _isShown = true; private bool _isShown = _loadOptions.IsShown;
public bool UsePma public bool UsePma
{ {
@@ -497,7 +497,7 @@ namespace SpineViewer.Models
public class SpineObjectLoadOptions public class SpineObjectLoadOptions
{ {
public bool AutoSave { get; set; } public bool IsShown { get; set; } = true;
public bool UsePma { get; set; } public bool UsePma { get; set; }
public bool DebugTexture { get; set; } = true; public bool DebugTexture { get; set; } = true;
public bool DebugBounds { get; set; } public bool DebugBounds { get; set; }

View File

@@ -96,6 +96,8 @@ namespace SpineViewer.ViewModels.MainWindow
ForcePremul = ForcePremul, ForcePremul = ForcePremul,
ForceNearest = ForceNearest, ForceNearest = ForceNearest,
ForceMipmap = ForceMipmap, ForceMipmap = ForceMipmap,
IsShown = IsShown,
UsePma = UsePma, UsePma = UsePma,
DebugTexture = DebugTexture, DebugTexture = DebugTexture,
DebugBounds = DebugBounds, DebugBounds = DebugBounds,
@@ -107,6 +109,8 @@ namespace SpineViewer.ViewModels.MainWindow
DebugPaths = DebugPaths, DebugPaths = DebugPaths,
DebugPoints = DebugPoints, DebugPoints = DebugPoints,
DebugClippings = DebugClippings, DebugClippings = DebugClippings,
RenderSelectedOnly = RenderSelectedOnly,
AppLanguage = AppLanguage, AppLanguage = AppLanguage,
}; };
} }
@@ -115,7 +119,10 @@ namespace SpineViewer.ViewModels.MainWindow
ForcePremul = value.ForcePremul; ForcePremul = value.ForcePremul;
ForceNearest = value.ForceNearest; ForceNearest = value.ForceNearest;
ForceMipmap = value.ForceMipmap; ForceMipmap = value.ForceMipmap;
IsShown = value.IsShown;
UsePma = value.UsePma; UsePma = value.UsePma;
DebugTexture = value.DebugTexture; DebugTexture = value.DebugTexture;
DebugBounds = value.DebugBounds; DebugBounds = value.DebugBounds;
DebugBones = value.DebugBones; DebugBones = value.DebugBones;
@@ -126,6 +133,8 @@ namespace SpineViewer.ViewModels.MainWindow
DebugPaths = value.DebugPaths; DebugPaths = value.DebugPaths;
DebugPoints = value.DebugPoints; DebugPoints = value.DebugPoints;
DebugClippings = value.DebugClippings; DebugClippings = value.DebugClippings;
RenderSelectedOnly = value.RenderSelectedOnly;
AppLanguage = value.AppLanguage; AppLanguage = value.AppLanguage;
} }
} }
@@ -152,9 +161,14 @@ namespace SpineViewer.ViewModels.MainWindow
#endregion #endregion
#region #region
public bool IsShown
{
get => SpineObjectModel.LoadOptions.IsShown;
set => SetProperty(SpineObjectModel.LoadOptions.IsShown, value, v => SpineObjectModel.LoadOptions.IsShown = v);
}
public bool UsePma public bool UsePma
{ {
get => SpineObjectModel.LoadOptions.UsePma; get => SpineObjectModel.LoadOptions.UsePma;
@@ -227,6 +241,12 @@ namespace SpineViewer.ViewModels.MainWindow
public static ImmutableArray<AppLanguage> AppLanguageOptions { get; } = Enum.GetValues<AppLanguage>().ToImmutableArray(); public static ImmutableArray<AppLanguage> AppLanguageOptions { get; } = Enum.GetValues<AppLanguage>().ToImmutableArray();
public bool RenderSelectedOnly
{
get => _vmMain.SFMLRendererViewModel.RenderSelectedOnly;
set => SetProperty(_vmMain.SFMLRendererViewModel.RenderSelectedOnly, value, v => _vmMain.SFMLRendererViewModel.RenderSelectedOnly = v);
}
public AppLanguage AppLanguage public AppLanguage AppLanguage
{ {
get => ((App)App.Current).Language; get => ((App)App.Current).Language;

View File

@@ -691,7 +691,6 @@
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!-- 水平分辨率 --> <!-- 水平分辨率 -->
@@ -730,17 +729,13 @@
<Label Grid.Row="8" Grid.Column="0" Content="{DynamicResource Str_MaxFps}"/> <Label Grid.Row="8" Grid.Column="0" Content="{DynamicResource Str_MaxFps}"/>
<TextBox Grid.Row="8" Grid.Column="1" Text="{Binding MaxFps}"/> <TextBox Grid.Row="8" Grid.Column="1" Text="{Binding MaxFps}"/>
<!-- 仅渲染选中 -->
<Label Grid.Row="9" Grid.Column="0" Content="{DynamicResource Str_RenderSelectedOnly}"/>
<ToggleButton Grid.Row="9" Grid.Column="1" IsChecked="{Binding RenderSelectedOnly}"/>
<!-- 显示坐标轴 --> <!-- 显示坐标轴 -->
<Label Grid.Row="10" Grid.Column="0" Content="{DynamicResource Str_ShowAxis}"/> <Label Grid.Row="9" Grid.Column="0" Content="{DynamicResource Str_ShowAxis}"/>
<ToggleButton Grid.Row="10" Grid.Column="1" IsChecked="{Binding ShowAxis}"/> <ToggleButton Grid.Row="9" Grid.Column="1" IsChecked="{Binding ShowAxis}"/>
<!-- 背景颜色 --> <!-- 背景颜色 -->
<Label Grid.Row="11" Grid.Column="0" Content="{DynamicResource Str_BackgroundColor}" ToolTip="#AARRGGBB"/> <Label Grid.Row="10" Grid.Column="0" Content="{DynamicResource Str_BackgroundColor}" ToolTip="#AARRGGBB"/>
<TextBox Grid.Row="11" Grid.Column="1" Text="{Binding BackgroundColor}" ToolTip="#AARRGGBB"/> <TextBox Grid.Row="10" Grid.Column="1" Text="{Binding BackgroundColor}" ToolTip="#AARRGGBB"/>
<!-- 背景图案 --> <!-- 背景图案 -->
<!-- 背景图案模式 --> <!-- 背景图案模式 -->

View File

@@ -10,7 +10,7 @@
d:DataContext="{d:DesignInstance Type=models:PreferenceModel}" d:DataContext="{d:DesignInstance Type=models:PreferenceModel}"
mc:Ignorable="d" mc:Ignorable="d"
Title="{DynamicResource Str_Preference}" Title="{DynamicResource Str_Preference}"
Height="660" Height="650"
Width="600" Width="600"
ShowInTaskbar="False" ShowInTaskbar="False"
WindowStartupLocation="CenterOwner"> WindowStartupLocation="CenterOwner">
@@ -44,6 +44,7 @@
<Setter Property="HorizontalAlignment" Value="Right"/> <Setter Property="HorizontalAlignment" Value="Right"/>
</Style> </Style>
<Style TargetType="{x:Type GroupBox}" BasedOn="{StaticResource GroupBoxTab}"> <Style TargetType="{x:Type GroupBox}" BasedOn="{StaticResource GroupBoxTab}">
<Setter Property="BorderBrush" Value="LightGray"/>
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent"/>
<Setter Property="hc:TitleElement.Background" Value="Transparent"/> <Setter Property="hc:TitleElement.Background" Value="Transparent"/>
<Setter Property="Margin" Value="0 5 0 10"/> <Setter Property="Margin" Value="0 5 0 10"/>
@@ -92,40 +93,44 @@
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="{DynamicResource Str_UsePma}"/> <Label Grid.Row="0" Grid.Column="0" Content="{DynamicResource Str_IsShown}"/>
<ToggleButton Grid.Row="0" Grid.Column="1" IsChecked="{Binding UsePma}"/> <ToggleButton Grid.Row="0" Grid.Column="1" IsChecked="{Binding IsShown}"/>
<Label Grid.Row="1" Grid.Column="0" Content="{DynamicResource Str_DebugTexture}"/> <Label Grid.Row="1" Grid.Column="0" Content="{DynamicResource Str_UsePma}"/>
<ToggleButton Grid.Row="1" Grid.Column="1" IsChecked="{Binding DebugTexture}"/> <ToggleButton Grid.Row="1" Grid.Column="1" IsChecked="{Binding UsePma}"/>
<Label Grid.Row="2" Grid.Column="0" Content="{DynamicResource Str_DebugBounds}"/> <Label Grid.Row="2" Grid.Column="0" Content="{DynamicResource Str_DebugTexture}"/>
<ToggleButton Grid.Row="2" Grid.Column="1" IsChecked="{Binding DebugBounds}"/> <ToggleButton Grid.Row="2" Grid.Column="1" IsChecked="{Binding DebugTexture}"/>
<Label Grid.Row="3" Grid.Column="0" Content="{DynamicResource Str_DebugBones}"/> <Label Grid.Row="3" Grid.Column="0" Content="{DynamicResource Str_DebugBounds}"/>
<ToggleButton Grid.Row="3" Grid.Column="1" IsChecked="{Binding DebugBones}"/> <ToggleButton Grid.Row="3" Grid.Column="1" IsChecked="{Binding DebugBounds}"/>
<Label Grid.Row="4" Grid.Column="0" Content="{DynamicResource Str_DebugRegions}"/> <Label Grid.Row="4" Grid.Column="0" Content="{DynamicResource Str_DebugBones}"/>
<ToggleButton Grid.Row="4" Grid.Column="1" IsChecked="{Binding DebugRegions}"/> <ToggleButton Grid.Row="4" Grid.Column="1" IsChecked="{Binding DebugBones}"/>
<Label Grid.Row="5" Grid.Column="0" Content="{DynamicResource Str_DebugMeshHulls}"/> <Label Grid.Row="5" Grid.Column="0" Content="{DynamicResource Str_DebugRegions}"/>
<ToggleButton Grid.Row="5" Grid.Column="1" IsChecked="{Binding DebugMeshHulls}"/> <ToggleButton Grid.Row="5" Grid.Column="1" IsChecked="{Binding DebugRegions}"/>
<Label Grid.Row="6" Grid.Column="0" Content="{DynamicResource Str_DebugMeshes}"/> <Label Grid.Row="6" Grid.Column="0" Content="{DynamicResource Str_DebugMeshHulls}"/>
<ToggleButton Grid.Row="6" Grid.Column="1" IsChecked="{Binding DebugMeshes}"/> <ToggleButton Grid.Row="6" Grid.Column="1" IsChecked="{Binding DebugMeshHulls}"/>
<Label Grid.Row="7" Grid.Column="0" Content="{DynamicResource Str_DebugBoundingBoxes}"/> <Label Grid.Row="7" Grid.Column="0" Content="{DynamicResource Str_DebugMeshes}"/>
<ToggleButton Grid.Row="7" Grid.Column="1" IsChecked="{Binding DebugBoundingBoxes}"/> <ToggleButton Grid.Row="7" Grid.Column="1" IsChecked="{Binding DebugMeshes}"/>
<Label Grid.Row="8" Grid.Column="0" Content="{DynamicResource Str_DebugPaths}"/> <Label Grid.Row="8" Grid.Column="0" Content="{DynamicResource Str_DebugClippings}"/>
<ToggleButton Grid.Row="8" Grid.Column="1" IsChecked="{Binding DebugPaths}"/> <ToggleButton Grid.Row="8" Grid.Column="1" IsChecked="{Binding DebugClippings}"/>
<Label Grid.Row="9" Grid.Column="0" Content="{DynamicResource Str_DebugPoints}"/> <!--<Label Grid.Row="9" Grid.Column="0" Content="{DynamicResource Str_DebugBoundingBoxes}"/>
<ToggleButton Grid.Row="9" Grid.Column="1" IsChecked="{Binding DebugPoints}"/> <ToggleButton Grid.Row="9" Grid.Column="1" IsChecked="{Binding DebugBoundingBoxes}"/>
<Label Grid.Row="10" Grid.Column="0" Content="{DynamicResource Str_DebugClippings}"/> <Label Grid.Row="10" Grid.Column="0" Content="{DynamicResource Str_DebugPaths}"/>
<ToggleButton Grid.Row="10" Grid.Column="1" IsChecked="{Binding DebugClippings}"/> <ToggleButton Grid.Row="10" Grid.Column="1" IsChecked="{Binding DebugPaths}"/>
<Label Grid.Row="11" Grid.Column="0" Content="{DynamicResource Str_DebugPoints}"/>
<ToggleButton Grid.Row="11" Grid.Column="1" IsChecked="{Binding DebugPoints}"/>-->
</Grid> </Grid>
</GroupBox> </GroupBox>
@@ -137,10 +142,14 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="{DynamicResource Str_Language}"/> <Label Grid.Row="0" Grid.Column="0" Content="{DynamicResource Str_RenderSelectedOnly}"/>
<ComboBox Grid.Row="0" Grid.Column="1" <ToggleButton Grid.Row="0" Grid.Column="1" IsChecked="{Binding RenderSelectedOnly}"/>
<Label Grid.Row="1" Grid.Column="0" Content="{DynamicResource Str_Language}"/>
<ComboBox Grid.Row="1" Grid.Column="1"
SelectedItem="{Binding AppLanguage}" SelectedItem="{Binding AppLanguage}"
ItemsSource="{x:Static vm:PreferenceViewModel.AppLanguageOptions}"/> ItemsSource="{x:Static vm:PreferenceViewModel.AppLanguageOptions}"/>