From b63b8c66a11174597c654e2cbd2cf6cae0db9ecc Mon Sep 17 00:00:00 2001 From: routersys Date: Wed, 7 Oct 2026 07:41:02 +0900 Subject: [PATCH] =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E3=81=AB=E3=82=88=E3=81=A3?= =?UTF-8?q?=E3=81=A6=E5=8A=B9=E3=81=8B=E3=81=AA=E3=81=84=E9=A0=85=E7=9B=AE?= =?UTF-8?q?=E3=82=92=E8=A8=AD=E5=AE=9A=E3=81=AE=E7=94=BB=E9=9D=A2=E3=81=A7?= =?UTF-8?q?=E9=9A=A0=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ・円形の開口では羽根枚数と開口回転を、線形光がオフではハイライトの2項目を表示しないよう変更-M --- WaveOptics/Effects/WaveOpticsEffect.cs | 4 +++ WaveOptics/Effects/WaveOpticsVisibility.cs | 35 ++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 WaveOptics/Effects/WaveOpticsVisibility.cs diff --git a/WaveOptics/Effects/WaveOpticsEffect.cs b/WaveOptics/Effects/WaveOpticsEffect.cs index fcd5ad0..d53ae70 100644 --- a/WaveOptics/Effects/WaveOpticsEffect.cs +++ b/WaveOptics/Effects/WaveOpticsEffect.cs @@ -33,10 +33,12 @@ public sealed class WaveOpticsEffect : VideoEffectBase private bool _linear; [Display(GroupName = nameof(Texts.OutputGroup), Name = nameof(Texts.HighlightThreshold), Description = nameof(Texts.HighlightThresholdDescription), Order = 3, ResourceType = typeof(Texts))] + [LinearLightVisible] [AnimationSlider("F1", "%", 0, 100)] public Animation HighlightThreshold { get; } = new(95, 0, 100); [Display(GroupName = nameof(Texts.OutputGroup), Name = nameof(Texts.HighlightBoost), Description = nameof(Texts.HighlightBoostDescription), Order = 4, ResourceType = typeof(Texts))] + [LinearLightVisible] [AnimationSlider("F1", "x", 1, 100)] public Animation HighlightBoost { get; } = new(1, 1, 1000); @@ -75,6 +77,7 @@ public sealed class WaveOpticsEffect : VideoEffectBase private WaveOpticsApertureShape _apertureShape; [Display(GroupName = nameof(Texts.ApertureGroup), Name = nameof(Texts.BladeCount), Description = nameof(Texts.BladeCountDescription), Order = 21, ResourceType = typeof(Texts))] + [PolygonApertureVisible] [TextBoxSlider("F0", "", 3, 16)] [Range(3, 32)] [DefaultValue(6)] @@ -82,6 +85,7 @@ public sealed class WaveOpticsEffect : VideoEffectBase private int _bladeCount = 6; [Display(GroupName = nameof(Texts.ApertureGroup), Name = nameof(Texts.BladeRotation), Description = nameof(Texts.BladeRotationDescription), Order = 22, ResourceType = typeof(Texts))] + [PolygonApertureVisible] [AnimationSlider("F1", "°", -180, 180)] public Animation BladeRotation { get; } = new(0, -360, 360); diff --git a/WaveOptics/Effects/WaveOpticsVisibility.cs b/WaveOptics/Effects/WaveOpticsVisibility.cs new file mode 100644 index 0000000..9351d58 --- /dev/null +++ b/WaveOptics/Effects/WaveOpticsVisibility.cs @@ -0,0 +1,35 @@ +using System.Globalization; +using System.Windows; +using System.Windows.Data; +using YukkuriMovieMaker.ItemEditor; + +namespace WaveOptics.Effects; + +[AttributeUsage(AttributeTargets.Property)] +internal sealed class PolygonApertureVisibleAttribute : Attribute, ICustomVisibilityAttribute2 +{ + public Binding GetBinding(object item, object propertyOwner) => new(nameof(WaveOpticsEffect.ApertureShape)) + { + Source = item, + Converter = new VisibilityConverter(value => value is WaveOpticsApertureShape.RegularPolygon) + }; +} + +[AttributeUsage(AttributeTargets.Property)] +internal sealed class LinearLightVisibleAttribute : Attribute, ICustomVisibilityAttribute2 +{ + public Binding GetBinding(object item, object propertyOwner) => new(nameof(WaveOpticsEffect.Linear)) + { + Source = item, + Converter = new VisibilityConverter(value => value is true) + }; +} + +internal sealed class VisibilityConverter(Func isVisible) : IValueConverter +{ + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) + => isVisible(value) ? Visibility.Visible : Visibility.Collapsed; + + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) + => throw new NotSupportedException(); +}