diff --git a/src/Beutl.ProjectSystem/Operation/IPublishOperator.cs b/src/Beutl.ProjectSystem/Operation/IPublishOperator.cs new file mode 100644 index 000000000..c195413eb --- /dev/null +++ b/src/Beutl.ProjectSystem/Operation/IPublishOperator.cs @@ -0,0 +1,8 @@ +using Beutl.Graphics.Rendering; + +namespace Beutl.Operation; + +public interface IPublishOperator +{ + Renderable Value { get; } +} diff --git a/src/Beutl.ProjectSystem/Operation/PublishOperator.cs b/src/Beutl.ProjectSystem/Operation/PublishOperator.cs index 91fe25c6e..f845a3725 100644 --- a/src/Beutl.ProjectSystem/Operation/PublishOperator.cs +++ b/src/Beutl.ProjectSystem/Operation/PublishOperator.cs @@ -31,7 +31,7 @@ public static implicit operator PropertyWithDefaultValue(CoreProperty property) } } -public abstract class PublishOperator : SourceOperator +public abstract class PublishOperator : SourceOperator, IPublishOperator where T : Renderable, new() { public static readonly CoreProperty ValueProperty; @@ -64,6 +64,8 @@ public T Value set => SetAndRaise(ValueProperty, ref _value, value); } + Renderable IPublishOperator.Value => Value; + public override EvaluationTarget GetEvaluationTarget() => _evaluationTarget; public override void Evaluate(OperatorEvaluationContext context) @@ -166,7 +168,8 @@ protected override void OnPropertyChanged(PropertyChangedEventArgs args) } catch { - value = TypeDescriptor.GetConverter(value!.GetType()).ConvertTo(value, propertyType); + value = TypeDescriptor.GetConverter(value!.GetType()) + .ConvertTo(value, propertyType); } } diff --git a/src/Beutl/ViewModels/PathEditorViewModel.cs b/src/Beutl/ViewModels/PathEditorViewModel.cs index c249ab02e..ef41049e4 100644 --- a/src/Beutl/ViewModels/PathEditorViewModel.cs +++ b/src/Beutl/ViewModels/PathEditorViewModel.cs @@ -43,10 +43,10 @@ public PathEditorViewModel(EditViewModel editViewModel, PlayerViewModel playerVi Element = Context.Select(v => v?.GetService()) .ToReadOnlyReactivePropertySlim() .DisposeWith(_disposables); - SourceOperator = Context.Select(v => v?.GetService() as StyledSourcePublisher) + SourceOperator = Context.Select(v => v?.GetService() as IPublishOperator) .ToReadOnlyReactivePropertySlim() .DisposeWith(_disposables); - Drawable = SourceOperator.Select(v => v?.Instance?.Target as Drawable) + Drawable = SourceOperator.Select(v => v?.Value as Drawable) .ToReadOnlyReactivePropertySlim() .DisposeWith(_disposables); @@ -129,7 +129,7 @@ private Matrix CalculateMatrix(Drawable drawable, Geometry? geometry) public IReadOnlyReactiveProperty Element { get; } - public ReadOnlyReactivePropertySlim SourceOperator { get; } + public ReadOnlyReactivePropertySlim SourceOperator { get; } public ReadOnlyReactivePropertySlim Drawable { get; } diff --git a/src/Beutl/ViewModels/Tools/PathEditorTabViewModel.cs b/src/Beutl/ViewModels/Tools/PathEditorTabViewModel.cs index f35cfcd3e..4a2556e65 100644 --- a/src/Beutl/ViewModels/Tools/PathEditorTabViewModel.cs +++ b/src/Beutl/ViewModels/Tools/PathEditorTabViewModel.cs @@ -38,7 +38,7 @@ public PathEditorTabViewModel(EditViewModel editViewModel) Element = Context.Select(v => v?.GetService()) .ToReadOnlyReactivePropertySlim() .DisposeWith(_disposables); - SourceOperator = Context.Select(v => v?.GetService() as StyledSourcePublisher) + SourceOperator = Context.Select(v => v?.GetService() as IPublishOperator) .ToReadOnlyReactivePropertySlim() .DisposeWith(_disposables); @@ -63,7 +63,7 @@ public PathEditorTabViewModel(EditViewModel editViewModel) public IReadOnlyReactiveProperty Element { get; } - public ReadOnlyReactivePropertySlim SourceOperator { get; } + public ReadOnlyReactivePropertySlim SourceOperator { get; } public IReactiveProperty SelectedOperation { get; } = new ReactiveProperty();