增加皮肤和插槽的全部启用禁用菜单项

This commit is contained in:
ww-rm
2025-10-19 15:10:45 +08:00
parent dae5d0b7c7
commit 3dcd7b22ca
5 changed files with 44 additions and 16 deletions

View File

@@ -78,13 +78,13 @@
<s:String x:Key="Str_Y">Y</s:String> <s:String x:Key="Str_Y">Y</s:String>
<s:String x:Key="Str_Skin">Skin</s:String> <s:String x:Key="Str_Skin">Skin</s:String>
<s:String x:Key="Str_EnableSkins">Enable Skins</s:String> <s:String x:Key="Str_Enable">Enable</s:String>
<s:String x:Key="Str_DisableSkins">Disable Skins</s:String> <s:String x:Key="Str_Disable">Disable</s:String>
<s:String x:Key="Str_EnableAll">Enable All</s:String>
<s:String x:Key="Str_DisableAll">Disable All</s:String>
<s:String x:Key="Str_Slot">Slot</s:String> <s:String x:Key="Str_Slot">Slot</s:String>
<s:String x:Key="Str_ClearSlotsAttachment">Clear Slots Attachment</s:String> <s:String x:Key="Str_ClearSlotsAttachment">Clear Slots Attachment</s:String>
<s:String x:Key="Str_EnableSlots">Enable Slots</s:String>
<s:String x:Key="Str_DisableSlots">Disable Slots</s:String>
<s:String x:Key="Str_Animation">Animation</s:String> <s:String x:Key="Str_Animation">Animation</s:String>
<s:String x:Key="Str_AppendTrack">Add</s:String> <s:String x:Key="Str_AppendTrack">Add</s:String>

View File

@@ -78,13 +78,13 @@
<s:String x:Key="Str_Y">Y座標</s:String> <s:String x:Key="Str_Y">Y座標</s:String>
<s:String x:Key="Str_Skin">スキン</s:String> <s:String x:Key="Str_Skin">スキン</s:String>
<s:String x:Key="Str_EnableSkins">有効</s:String> <s:String x:Key="Str_Enable">有効にする</s:String>
<s:String x:Key="Str_DisableSkins">無効</s:String> <s:String x:Key="Str_Disable">無効にする</s:String>
<s:String x:Key="Str_EnableAll">すべて有効にする</s:String>
<s:String x:Key="Str_DisableAll">すべて無効にする</s:String>
<s:String x:Key="Str_Slot">スロット</s:String> <s:String x:Key="Str_Slot">スロット</s:String>
<s:String x:Key="Str_ClearSlotsAttachment">アタッチメントをクリア</s:String> <s:String x:Key="Str_ClearSlotsAttachment">アタッチメントをクリア</s:String>
<s:String x:Key="Str_EnableSlots">有効</s:String>
<s:String x:Key="Str_DisableSlots">無効</s:String>
<s:String x:Key="Str_Animation">アニメーション</s:String> <s:String x:Key="Str_Animation">アニメーション</s:String>
<s:String x:Key="Str_AppendTrack">追加</s:String> <s:String x:Key="Str_AppendTrack">追加</s:String>

View File

@@ -78,13 +78,13 @@
<s:String x:Key="Str_Y">纵坐标</s:String> <s:String x:Key="Str_Y">纵坐标</s:String>
<s:String x:Key="Str_Skin">皮肤</s:String> <s:String x:Key="Str_Skin">皮肤</s:String>
<s:String x:Key="Str_EnableSkins">启用</s:String> <s:String x:Key="Str_Enable">启用</s:String>
<s:String x:Key="Str_DisableSkins">禁用</s:String> <s:String x:Key="Str_Disable">禁用</s:String>
<s:String x:Key="Str_EnableAll">全部启用</s:String>
<s:String x:Key="Str_DisableAll">全部禁用</s:String>
<s:String x:Key="Str_Slot">插槽</s:String> <s:String x:Key="Str_Slot">插槽</s:String>
<s:String x:Key="Str_ClearSlotsAttachment">清除附件</s:String> <s:String x:Key="Str_ClearSlotsAttachment">清除附件</s:String>
<s:String x:Key="Str_EnableSlots">启用</s:String>
<s:String x:Key="Str_DisableSlots">禁用</s:String>
<s:String x:Key="Str_Animation">动画</s:String> <s:String x:Key="Str_Animation">动画</s:String>
<s:String x:Key="Str_AppendTrack">添加</s:String> <s:String x:Key="Str_AppendTrack">添加</s:String>

View File

@@ -346,6 +346,18 @@ namespace SpineViewer.ViewModels.MainWindow
); );
private RelayCommand<IList?> _cmd_DisableSkins; private RelayCommand<IList?> _cmd_DisableSkins;
public RelayCommand Cmd_EnableAllSkins => _cmd_EnableAllSkins ??= new(
() => { if (_skins.Count <= 0) return; foreach (var s in _skins) s.Status = true; },
() => { return _skins.Count > 0; }
);
private RelayCommand _cmd_EnableAllSkins;
public RelayCommand Cmd_DisableAllSkins => _cmd_DisableAllSkins ??= new(
() => { if (_skins.Count <= 0) return; foreach (var s in _skins) s.Status = false; },
() => { return _skins.Count > 0; }
);
private RelayCommand _cmd_DisableAllSkins;
public ObservableCollection<SlotViewModel> Slots => _slots; public ObservableCollection<SlotViewModel> Slots => _slots;
public RelayCommand<IList?> Cmd_EnableSlots => _cmd_EnableSlots ??= new ( public RelayCommand<IList?> Cmd_EnableSlots => _cmd_EnableSlots ??= new (
@@ -360,6 +372,18 @@ namespace SpineViewer.ViewModels.MainWindow
); );
private RelayCommand<IList?> _cmd_DisableSlots; private RelayCommand<IList?> _cmd_DisableSlots;
public RelayCommand Cmd_EnableAllSlots => _cmd_EnableAllSlots ??= new(
() => { if (_slots.Count <= 0) return; foreach (var s in _slots) s.Visible = true; },
() => { return _slots.Count > 0; }
);
private RelayCommand _cmd_EnableAllSlots;
public RelayCommand Cmd_DisableAllSlots => _cmd_DisableAllSlots ??= new(
() => { if (_slots.Count <= 0) return; foreach (var s in _slots) s.Visible = false; },
() => { return _slots.Count > 0; }
);
private RelayCommand _cmd_DisableAllSlots;
public ObservableCollection<AnimationTrackViewModel> AnimationTracks => _animationTracks; public ObservableCollection<AnimationTrackViewModel> AnimationTracks => _animationTracks;
public RelayCommand Cmd_AppendTrack => _cmd_AppendTrack ??= new( public RelayCommand Cmd_AppendTrack => _cmd_AppendTrack ??= new(

View File

@@ -437,12 +437,14 @@
<ListBox ItemsSource="{Binding Skins}"> <ListBox ItemsSource="{Binding Skins}">
<ListBox.ContextMenu> <ListBox.ContextMenu>
<ContextMenu> <ContextMenu>
<MenuItem Header="{DynamicResource Str_EnableSkins}" <MenuItem Header="{DynamicResource Str_Enable}"
Command="{Binding Cmd_EnableSkins}" Command="{Binding Cmd_EnableSkins}"
CommandParameter="{Binding PlacementTarget.SelectedItems, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"/> CommandParameter="{Binding PlacementTarget.SelectedItems, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"/>
<MenuItem Header="{DynamicResource Str_DisableSkins}" <MenuItem Header="{DynamicResource Str_Disable}"
Command="{Binding Cmd_DisableSkins}" Command="{Binding Cmd_DisableSkins}"
CommandParameter="{Binding PlacementTarget.SelectedItems, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"/> CommandParameter="{Binding PlacementTarget.SelectedItems, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"/>
<MenuItem Header="{DynamicResource Str_EnableAll}" Command="{Binding Cmd_EnableAllSkins}"/>
<MenuItem Header="{DynamicResource Str_DisableAll}" Command="{Binding Cmd_DisableAllSkins}"/>
</ContextMenu> </ContextMenu>
</ListBox.ContextMenu> </ListBox.ContextMenu>
@@ -468,12 +470,14 @@
<ListBox ItemsSource="{Binding Slots}" Grid.IsSharedSizeScope="True"> <ListBox ItemsSource="{Binding Slots}" Grid.IsSharedSizeScope="True">
<ListBox.ContextMenu> <ListBox.ContextMenu>
<ContextMenu> <ContextMenu>
<MenuItem Header="{DynamicResource Str_EnableSlots}" <MenuItem Header="{DynamicResource Str_Enable}"
Command="{Binding Cmd_EnableSlots}" Command="{Binding Cmd_EnableSlots}"
CommandParameter="{Binding PlacementTarget.SelectedItems, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"/> CommandParameter="{Binding PlacementTarget.SelectedItems, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"/>
<MenuItem Header="{DynamicResource Str_DisableSlots}" <MenuItem Header="{DynamicResource Str_Disable}"
Command="{Binding Cmd_DisableSlots}" Command="{Binding Cmd_DisableSlots}"
CommandParameter="{Binding PlacementTarget.SelectedItems, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"/> CommandParameter="{Binding PlacementTarget.SelectedItems, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}"/>
<MenuItem Header="{DynamicResource Str_EnableAll}" Command="{Binding Cmd_EnableAllSlots}"/>
<MenuItem Header="{DynamicResource Str_DisableAll}" Command="{Binding Cmd_DisableAllSlots}"/>
</ContextMenu> </ContextMenu>
</ListBox.ContextMenu> </ListBox.ContextMenu>