Skip to content

Commit

Permalink
Merge pull request #20 from sinBetaKun/v1.0.4.0
Browse files Browse the repository at this point in the history
V1.0.4.0
  • Loading branch information
sinBetaKun authored Nov 14, 2024
2 parents a076120 + 08b4ed4 commit 6d6d3bc
Show file tree
Hide file tree
Showing 10 changed files with 268 additions and 236 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,21 @@
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Background="#FF808080">
<StackPanel Margin="0,0,0,0" VerticalAlignment="Center" Orientation="Horizontal">
<TextBlock Text="(" Margin="4,4,0,4" VerticalAlignment="Stretch" Foreground="Black" FontSize="12"/>
<Border BorderBrush="#FF484848" Margin="4,2,0,2" Background="Black" BorderThickness="1" VerticalAlignment="Center">
<TextBlock Text="{Binding Cerrar.Values[0].Value,StringFormat={}{0:F1}%}" Margin="4,0,4,0" VerticalAlignment="Stretch" Foreground="White" FontSize="12" ToolTip="セラール(の最初の)値"/>
</Border>
<TextBlock Text="~" Margin="4,4,0,4" VerticalAlignment="Stretch" Foreground="Black" FontSize="12"/>
<Border BorderBrush="#FF484848" Margin="4,2,0,2" Background="Black" BorderThickness="1" VerticalAlignment="Center">
<TextBlock Text="{Binding Abrir.Values[0].Value,StringFormat={}{0:F1}%}" Margin="4,0,4,0" VerticalAlignment="Stretch" Foreground="White" FontSize="12" ToolTip="アブリール(の最初の)値"/>
</Border>
<TextBlock Text=")" Margin="4,4,0,4" VerticalAlignment="Stretch" Foreground="Black" FontSize="12"/>
<TextBlock Text="{Binding Comment}" Margin="10,4,0,4" VerticalAlignment="Stretch" Foreground="Black" FontSize="12"/>
</StackPanel>
<Grid>
<Border BorderBrush="#FF808080" BorderThickness="1">
<StackPanel Margin="0,0,0,0" VerticalAlignment="Center" Orientation="Horizontal">
<TextBlock Text="(" Margin="4,4,0,4" VerticalAlignment="Center" FontSize="12"/>
<Border Margin="4,4,0,4" Background="#80808080" BorderThickness="1" VerticalAlignment="Center">
<TextBlock Text="{Binding Cerrar.Values[0].Value,StringFormat={}{0:F1}%}" Margin="4,0,4,0" VerticalAlignment="Center" FontSize="12" ToolTip="セラール(の最初の)値"/>
</Border>
<TextBlock Text="~" Margin="4,4,0,4" VerticalAlignment="Center" FontSize="12"/>
<Border Margin="4,4,0,4" Background="#80808080" BorderThickness="1" VerticalAlignment="Center">
<TextBlock Text="{Binding Abrir.Values[0].Value,StringFormat={}{0:F1}%}" Margin="4,0,4,0" VerticalAlignment="Center" FontSize="12" ToolTip="アブリール(の最初の)値"/>
</Border>
<TextBlock Text=")" Margin="4,4,0,4" VerticalAlignment="Center" FontSize="12"/>
<TextBlock Text="{Binding Comment}" Margin="10,4,0,4" VerticalAlignment="Center" FontSize="12"/>
</StackPanel>
</Border>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
Expand Down
94 changes: 48 additions & 46 deletions SinTachiePlugin/Parts/PartBlockUI.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,55 @@
xmlns:c="clr-namespace:YukkuriMovieMaker.Controls;assembly=YukkuriMovieMaker.Controls"
d:DataContext="{d:DesignInstance Type=local:PartBlock}"
mc:Ignorable="d">
<Grid Background="#FF808080">
<StackPanel Margin="4,4,4,4" Orientation="Vertical">
<WrapPanel>
<Border BorderBrush="#FF3F3F3F" BorderThickness="2" VerticalAlignment="Center">
<WrapPanel Margin="0,0,0,0" Orientation="Horizontal">
<CheckBox Margin="2,3,5,0" VerticalAlignment="Top" Width="15" Height="15" HorizontalAlignment="Left"
IsChecked="{Binding Appear, Mode=TwoWay}" Unchecked="Update_CheckBox" Checked="Update_CheckBox"
ToolTip="描画するか否かを切り替えられます。"/>
<StackPanel Orientation="Horizontal">
<TextBlock Text="タグ" Margin="5,0,3,0" VerticalAlignment="Top" Foreground="Black" FontSize="15"/>
<Border BorderBrush="#FF484848" Margin="3,0,10,0" Background="Black" BorderThickness="1" Height="20"
VerticalAlignment="Top">
<TextBlock Text="{Binding TagName}" Margin="4,0,4,0" VerticalAlignment="Center" Foreground="White"
FontSize="16" ToolTip="パーツの名前です。他のパーツの親にしたいときに名前を付けましょう。"/>
</Border>
</StackPanel>
</WrapPanel>
</Border>
<StackPanel Margin="10,0,0,0" VerticalAlignment="Center" Orientation="Horizontal">
<TextBlock Text="バス" Margin="0,0,0,0" VerticalAlignment="Top" Foreground="Black"/>
<Border BorderBrush="#FF484848" Margin="5,0,0,0" Background="Black" BorderThickness="1" Height="16"
VerticalAlignment="Top">
<TextBlock Text="{Binding BusNum.Values[0].Value,StringFormat={}{0:F0}}"
Margin="4,0,4,0" VerticalAlignment="Center" Foreground="White"
ToolTip="パーツの描画優先度。数字が高い方が後の方で描画され、画像上では手前に映ります。&#xa;(表示される数値は、アイテム上で最初のフレームにおける数値です。)"/>
</Border>
</StackPanel>
<StackPanel Margin="10,0,0,0" VerticalAlignment="Center" Orientation="Horizontal">
<TextBlock Text="" VerticalAlignment="Top" Foreground="Black"/>
<Border BorderBrush="#FF484848" Margin="5,0,0,0" Background="Black" BorderThickness="1" Height="16"
<Grid>
<Border BorderBrush="#FF808080" BorderThickness="1">
<StackPanel Margin="4,4,4,4" Orientation="Vertical">
<WrapPanel>
<Border BorderBrush="#FF808080" BorderThickness="2" VerticalAlignment="Center">
<StackPanel Margin="0,0,0,0" Orientation="Horizontal">
<CheckBox Margin="2,3,5,0" VerticalAlignment="Top" Width="15" Height="15" HorizontalAlignment="Left"
IsChecked="{Binding Appear, Mode=TwoWay}" Unchecked="Update_CheckBox" Checked="Update_CheckBox"
ToolTip="描画するか否かを切り替えられます。"/>
<StackPanel Orientation="Horizontal">
<TextBlock Text="タグ" Margin="5,0,3,0" VerticalAlignment="Top" FontSize="15"/>
<Border Margin="3,0,10,0" Background="#60808080" BorderThickness="1" Height="20"
VerticalAlignment="Top">
<TextBlock Text="{Binding Parent}" Margin="4,0,4,0" VerticalAlignment="Center" Foreground="White"
ToolTip="タグ名が一致するパーツと動きを連動します。Blenderでいう親ボーンに相当します。"/>
</Border>
</StackPanel>
<StackPanel Margin="10,0,0,0" VerticalAlignment="Center" Orientation="Horizontal">
<TextBlock Text="備考" VerticalAlignment="Top" Foreground="Black"/>
<Border BorderBrush="#FF484848" Margin="5,0,0,0" Background="Black" BorderThickness="1" Height="16"
VerticalAlignment="Top">
<TextBlock Text="{Binding Comment}" Margin="4,0,4,0" VerticalAlignment="Center" Foreground="White"
ToolTip="タグ名が一致するパーツと動きを連動します。Blenderでいう親ボーンに相当します。"/>
<TextBlock Text="{Binding TagName}" Margin="4,0,4,0" VerticalAlignment="Center"
FontSize="16" ToolTip="パーツの名前です。他のパーツの親にしたいときに名前を付けましょう。"/>
</Border>
</StackPanel>
</StackPanel>
</Border>
</StackPanel>
</WrapPanel>
<c:FileSelector x:Name="selector" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,4,0,0"
Value="{Binding ImagePath}" ShowThumbnail="True" FileType="画像"
BeginEdit="PropertiesEditor_BeginEdit" EndEdit="PropertiesEditor_EndEdit"/>
</StackPanel>
<StackPanel Margin="10,0,0,0" VerticalAlignment="Center" Orientation="Horizontal">
<TextBlock Text="バス" Margin="0,0,0,0" VerticalAlignment="Top"/>
<Border Margin="5,0,0,0" Background="#60808080" BorderThickness="1" Height="16"
VerticalAlignment="Top">
<TextBlock Text="{Binding BusNum.Values[0].Value,StringFormat={}{0:F0}}"
Margin="4,0,4,0" VerticalAlignment="Center"
ToolTip="パーツの描画優先度。数字が高い方が後の方で描画され、画像上では手前に映ります。&#xa;(表示される数値は、アイテム上で最初のフレームにおける数値です。)"/>
</Border>
</StackPanel>
<StackPanel Margin="10,0,0,0" VerticalAlignment="Center" Orientation="Horizontal">
<TextBlock Text="" VerticalAlignment="Top"/>
<Border Margin="5,0,0,0" Background="#60808080" BorderThickness="1" Height="16"
VerticalAlignment="Top">
<TextBlock Text="{Binding Parent}" Margin="4,0,4,0" VerticalAlignment="Center"
ToolTip="タグ名が一致するパーツと動きを連動します。Blenderでいう親ボーンに相当します。"/>
</Border>
</StackPanel>
<StackPanel Margin="10,0,0,0" VerticalAlignment="Center" Orientation="Horizontal">
<TextBlock Text="備考" VerticalAlignment="Top"/>
<Border Margin="5,0,0,0" Background="#60808080" BorderThickness="1" Height="16"
VerticalAlignment="Top">
<TextBlock Text="{Binding Comment}" Margin="4,0,4,0" VerticalAlignment="Center"
ToolTip="タグ名が一致するパーツと動きを連動します。Blenderでいう親ボーンに相当します。"/>
</Border>
</StackPanel>
</WrapPanel>
<c:FileSelector x:Name="selector" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,4,0,0"
Value="{Binding ImagePath}" ShowThumbnail="True" FileType="画像"
BeginEdit="PropertiesEditor_BeginEdit" EndEdit="PropertiesEditor_EndEdit"/>
</StackPanel>
</Border>
</Grid>
</UserControl>
71 changes: 71 additions & 0 deletions SinTachiePlugin/Parts/PartNameTreeNode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using SinTachiePlugin.Informations;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using YukkuriMovieMaker.Settings;

namespace SinTachiePlugin.Parts
{
public class PartNameTreeNode
{
public string Name { get; set; }

public string FullName { get; set; }

public List<PartNameTreeNode> Children { get; set; } = [];

public PartNameTreeNode()
{
FullName = string.Empty;
Name = string.Empty;
}

public PartNameTreeNode(FileInfo fi)
{
Name = fi.Name;
FullName = fi.FullName;
}

public PartNameTreeNode(DirectoryInfo di)
{
try
{
DirectoryInfo[] subdis = di.GetDirectories();
foreach (DirectoryInfo subdi in subdis)
{
PartNameTreeNode preChild = new(subdi);
if (!string.IsNullOrEmpty(preChild.Name))
{
Children.Add(preChild);
}
}
var fis = (from x in di.GetFiles()
where FileSettings.Default.FileExtensions.GetFileType(x.FullName) == FileType.画像
where !(from c in Path.GetFileName(x.FullName)
where c == '.'
select c).Skip(1).Any()
select new PartNameTreeNode(x)).ToList();
Children.AddRange(fis);

if (!Children.Any())
{
FullName = string.Empty;
Name = string.Empty;
return;
}

FullName = di.FullName;
Name = di.Name;
}
catch (Exception)
{
FullName = string.Empty;
Name = string.Empty;
}
}
}
}
20 changes: 9 additions & 11 deletions SinTachiePlugin/Parts/PartsListController.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,23 @@
<Button Grid.Row="4" Content="" Command="{Binding MoveDownCommand}" CommandParameter="{Binding ElementName=list,Path=SelectedIndex}" ToolTip="選択されているパーツを一つ下のパーツと入れ替えます。"/>
</Grid>
<Popup IsOpen="{Binding PopupIsOpen}" Placement="Left" StaysOpen="False" VerticalAlignment="Top" >
<ListBox Panel.ZIndex="100" ItemsSource ="{Binding Path=PopupListSource}" SelectedIndex="{Binding Path=SelectedAddingPartIndex, Mode=TwoWay}"/>
<ScrollViewer MaxHeight="300" PreviewMouseWheel="ScrollViewer_PreviewMouseWheel">
<TreeView Panel.ZIndex="100" ItemsSource ="{Binding PartNameTree}" SelectedItemChanged="TreeView_SelectedItemChanged">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<TextBlock Text="{Binding Name}" />
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</ScrollViewer>
</Popup>
</Grid>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<!--<ColumnDefinition Width="100"/>-->
<ColumnDefinition Width="194"/>
</Grid.ColumnDefinitions>
<!--
<Grid Grid.Column="0">
<Grid Margin="10,8,0,10">

<Button Margin="10,10,10,0" Command="{Binding RelodeImageCommand}" CommandParameter="{Binding ElementName=list,Path=SelectedIndex}" Content="画像枠&#xa;リロード" ToolTip="ブロックの画像表示枠が突然空っぽになった時に押してみてください。"/>
</Grid>
</Grid>
-->

<Grid Grid.Column="0">
<Border BorderBrush="#FF3F3F3F" BorderThickness="2" Margin="0,8,0,0"/>
<Grid Margin="10,8,0,10">
Expand Down
49 changes: 19 additions & 30 deletions SinTachiePlugin/Parts/PartsListController.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,36 +64,25 @@ private void PropertiesEditor_EndEdit(object? sender, EventArgs e)
EndEdit?.Invoke(this, e);
}

//private void ItemListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
//{
// var vm = DataContext as PartsListControllerViewModel;
// if (vm.SelectedAddingPart != null)
// {
// if (String.IsNullOrWhiteSpace(vm.SelectedAddingPart))
// {
// SinTachieDialog.ShowWarning("「追加するパーツ」が選択されていないため、パーツを追加できません。");
// return;
// }

// var tmpSelectedIndex = vm.SelectedIndex;
// BeginEdit?.Invoke(this, EventArgs.Empty);
// string partImagePath = vm.FindFirstImageOfPart(vm.SelectedAddingPart);
// string tag = vm.SelectedAddingPart;
// var tags = from part in vm.Parts select part.TagName;
// if (tags.Contains(tag))
// {
// int sideNum = 1;
// while (tags.Contains($"{tag}({sideNum})")) sideNum++;
// tag += $"({sideNum})";
// }
// vm.Parts = vm.Parts.Insert(tmpSelectedIndex + 1, new PartBlock(partImagePath, tag));
// foreach (var property in vm.properties)
// property.SetValue(vm.Parts);
private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
var scrollViewer = sender as ScrollViewer;
if (scrollViewer != null)
{
if (e.Delta > 0)
scrollViewer.LineUp();
else
scrollViewer.LineDown();

// vm.AddPopupOpen = false;
// EndEdit?.Invoke(this, EventArgs.Empty);
// vm.SelectedIndex = tmpSelectedIndex + 1;
// }
//}
e.Handled = true;
}
}
private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
if (DataContext is PartsListControllerViewModel viewModel)
{
viewModel.SelectedTreeViewItem = e.NewValue; // ViewModelに設定
}
}
}
}
Loading

0 comments on commit 6d6d3bc

Please sign in to comment.