### Get Files for IFileItem (C#)
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base
This C# method implements the IFileItem interface's GetFiles method. It returns an empty string array, indicating no associated files for this specific implementation.
```csharp
public string[] GetFiles()
```
--------------------------------
### ResourceType Property
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/is-aviutl-supported
Gets the resource type of the effect.
```APIDOC
## ResourceType Property
### Description
Gets the resource type of the effect.
### Namespace
YukkuriMovieMaker.Plugin.Effects
### Assembly
YukkuriMovieMaker.Plugin.dll
```
--------------------------------
### C# Custom Shader Effect Implementation with D2D1CustomShaderEffectBase
Source: https://ymmapi.pages.dev/example/sample/video-effect
This C# code demonstrates how to implement a custom Direct2D effect by inheriting from `D2D1CustomShaderEffectBase`. It includes defining properties, handling constant buffers for HLSL shaders, and overriding methods for mapping input and output rectangles. The `EffectImpl` class within the example manages the shader's constant buffer and integrates with the shader resource loader.
```csharp
using System.Runtime.InteropServices;
using Vortice.Direct2D1;
using YukkuriMovieMaker.Commons;
using YukkuriMovieMaker.Player.Video;
namespace YMM4SamplePlugin.VideoEffect.SampleHLSLShaderVideoEffect
{
///
/// ID2D1Effectとして動作するカスタムエフェクト
/// D2D1CustomShaderEffectBaseを継承する
///
internal class SampleHLSLShaderCustomEffect : D2D1CustomShaderEffectBase
{
public float Value
{
set => SetValue((int)EffectImpl.Properties.Value, value);
get => GetFloatValue((int)EffectImpl.Properties.Value);
}
public SampleHLSLShaderCustomEffect(IGraphicsDevicesAndContext devices) : base(Create(devices))
{
}
///
/// エフェクトの実装
/// [CustomEffect]を設定する必要がある。inputCountは入力画像の数。
///
[CustomEffect(1)]
class EffectImpl : D2D1CustomShaderEffectImplBase
{
///
/// HLSLに渡すバッファ
///
ConstantBuffer constantBuffer;
///
/// エフェクトのプロパティ
/// [CustomEffectProperty]属性でプロパティの型とIDを設定する必要がある。
///
[CustomEffectProperty(PropertyType.Float, (int)Properties.Value)]
public float Value
{
get => constantBuffer.Value;
set
{
constantBuffer.Value = value;
UpdateConstants();
}
}
public EffectImpl() : base(ShaderResourceLoader.GetShaderResource("PixelShader.cso")/*ここでシェーダーのbyte列を渡す*/)
{
}
///
/// 設定をシェーダーに渡す
///
protected override void UpdateConstants()
{
drawInformation?.SetPixelShaderConstantBuffer(constantBuffer);
}
///
/// 入力画像の範囲から出力画像の範囲を計算する
/// 例:
/// 画像に対して10pxの縁取りエフェクトを掛ける場合、outputRectをinputRectsの範囲から10px大きくする
/// 画像に対して10pxのモザイクエフェクトをかける場合、出力範囲は変わらないのでinputRects[0]をそのままoutputRectに設定する
///
/// 入力画像の範囲。inputの数だけ渡される。最適化のため、入力画像の範囲がそのまま渡されるわけではなく、分割されることもある。
/// 入力画像の不透明な部分の範囲。最適化のため、入力画像の範囲がそのまま渡されるわけではなく、分割されることもある。
/// 入力画像をもとに計算した出力画像の範囲。
/// 入力画像を元に計算した出力画像の不透明な部分
public override void MapInputRectsToOutputRect(Vortice.RawRect[] inputRects, Vortice.RawRect[] inputOpaqueSubRects, out Vortice.RawRect outputRect, out Vortice.RawRect outputOpaqueSubRect)
{
base.MapInputRectsToOutputRect(inputRects, inputOpaqueSubRects, out outputRect, out outputOpaqueSubRect);
}
///
/// 出力画像を生成するために入力する必要のある入力画像の範囲を計算する
/// 例:
/// 画像に対して10pxの縁取りエフェクトを掛ける場合、縁取りの計算に周囲10pxの画像が必要なのでinputRects[0]をoutputRectから10px大きくしたものに設定する
/// 画像に対して10pxのモザイクエフェクトを掛ける場合、モザイクの計算に周囲10pxの画像が必要なのでinputRects[0]をoutputRectから10px大きくしたものに設定する
///
/// 出力画像の範囲。最適化のため、出力画像の範囲がそのまま渡されるわけではなく、分割されることもある。
/// 出力画像を生成するために入力する必要のある入力画像の範囲。
public override void MapOutputRectToInputRects(Vortice.RawRect outputRect, Vortice.RawRect[] inputRects)
{
base.MapOutputRectToInputRects(outputRect, inputRects);
}
[StructLayout(LayoutKind.Sequential)]
struct ConstantBuffer
{
public float Value;
}
public enum Properties
{
Value = 0
}
}
}
}
```
--------------------------------
### Get Resources for IResourceItem (C#)
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base
This C# method implements the IResourceItem interface's GetResources method. It generates and returns a sequence of TimelineResource objects, likely for managing resources used by the video effect.
```csharp
public IEnumerable GetResources()
```
--------------------------------
### ResourceType Property
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/name
Gets the resource type of the effect.
```APIDOC
## ResourceType Property
### Description
Gets the resource type of the effect.
### Method
N/A
### Endpoint
N/A
### Parameters
N/A
### Request Example
N/A
### Response
N/A
```
--------------------------------
### Categories Property
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/is-aviutl-supported
Gets the categories associated with the effect.
```APIDOC
## Categories Property
### Description
Gets the categories associated with the effect.
### Namespace
YukkuriMovieMaker.Plugin.Effects
### Assembly
YukkuriMovieMaker.Plugin.dll
```
--------------------------------
### Categories Property
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/name
Gets the categories associated with the effect.
```APIDOC
## Categories Property
### Description
Gets the categories associated with the effect.
### Method
N/A
### Endpoint
N/A
### Parameters
N/A
### Request Example
N/A
### Response
N/A
```
--------------------------------
### MSBuild Target for Compiling HLSL Shaders
Source: https://ymmapi.pages.dev/example/sample/video-effect
Configures MSBuild to compile HLSL shader files into shader object code (.cso) using the fxc.exe compiler. It defines an output directory for compiled shaders and embeds them as resources. This setup is crucial for using custom HLSL shaders in a C# project.
```xml
$(IntermediateOutputPath)Shaders\
$([System.IO.Path]::Combine('$(WindowsSdkDir)', 'bin', '$(TargetPlatformVersion)', 'x64', 'fxc.exe'))
fxc.exe
$(RootNamespace).Shaders.%(Filename)%(Extension)
```
--------------------------------
### IAudioEffect Interface Documentation
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/audio-effect-base
Documentation for the IAudioEffect interface, defining the contract for audio effects.
```APIDOC
## IAudioEffect Interface
### Description
An interface that must be implemented by any class representing an audio effect within the YukkuriMovieMaker API.
### Method
N/A (Interface Documentation)
### Endpoint
N/A (Interface Documentation)
### Parameters
N/A (Interface Documentation)
### Request Example
N/A (Interface Documentation)
### Response
N/A (Interface Documentation)
### Related Interfaces
- IVideoEffect
```
--------------------------------
### Create Exo Video Filters (C#)
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base
This C# method generates filter strings for Exo output. It takes an integer and an ExoOutputDescription object as input, likely to configure video output settings.
```csharp
public string CreateExoVideoFilters(int index, ExoOutputDescription description)
```
--------------------------------
### IAudioEffect Interface
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/is-aviutl-supported
Interface for audio effects in the YukkuriMovieMaker plugin.
```APIDOC
## IAudioEffect Interface
### Description
Interface for audio effects in the YukkuriMovieMaker plugin.
### Namespace
YukkuriMovieMaker.Plugin.Effects
### Assembly
YukkuriMovieMaker.Plugin.dll
```
--------------------------------
### Get or Set Effect Remark (C#)
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base/property/remark
This C# code snippet demonstrates how to get or set the remark for an effect using the `Remark` property. This property is of type string and is used to store textual notes or descriptions about the effect. It is part of the YukkuriMovieMaker.Plugin.Effects namespace.
```csharp
public string Remark { get; set; }
```
--------------------------------
### Create Video Effect Processor (C#)
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base
This C# method is responsible for creating an instance of the video effect processor. It requires an IGraphicsDevicesAndContext object to initialize the processor.
```csharp
public object CreateVideoEffect(IGraphicsDevicesAndContext graphicsDevicesAndContext)
```
--------------------------------
### Replace File for IFileItem (C#)
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base
This C# method implements the IFileItem interface's ReplaceFile method. It does nothing, signifying that file replacement is not supported or handled by this class.
```csharp
public void ReplaceFile(string oldFile, string newFile)
```
--------------------------------
### Label Property
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base/property/is-enabled
Gets or sets the label for an effect.
```APIDOC
## Label Property
### Description
Gets or sets the display label for an effect.
### Method
GET, SET
### Endpoint
(Applies to effect objects)
### Parameters
N/A (Property of an object)
### Request Example
N/A (Property of an object)
### Response
#### Success Response (200)
- **Label** (String) - The display label of the effect.
#### Response Example
```json
{
"Label": "My Custom Effect"
}
```
```
--------------------------------
### IAudioEffect Interface
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/name
Interface defining the contract for audio effects in YukkuriMovieMaker.
```APIDOC
## IAudioEffect Interface
### Description
Interface for audio effect functionality.
### Method
N/A
### Endpoint
N/A
### Parameters
N/A
### Request Example
N/A
### Response
N/A
```
--------------------------------
### Remark Property
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base/property/is-enabled
Gets or sets a remark or comment for an effect.
```APIDOC
## Remark Property
### Description
Gets or sets a remark or comment associated with an effect.
### Method
GET, SET
### Endpoint
(Applies to effect objects)
### Parameters
N/A (Property of an object)
### Request Example
N/A (Property of an object)
### Response
#### Success Response (200)
- **Remark** (String) - The remark or comment for the effect.
#### Response Example
```json
{
"Remark": "This effect is experimental."
}
```
```
--------------------------------
### Initialize VideoEffectBase Class Instance (C#)
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base/constructor
Initializes a new instance of the VideoEffectBase class. This is a fundamental operation for utilizing video effects within the YukkuriMovieMaker plugin system. No specific dependencies or complex inputs are required for this constructor.
```csharp
public VideoEffectBase()
```
--------------------------------
### IsEnabled Property
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base/property/is-enabled
Gets or sets the enabled state of an effect.
```APIDOC
## IsEnabled Property
### Description
Gets or sets whether an effect is enabled or disabled.
### Method
GET, SET
### Endpoint
(Applies to effect objects)
### Parameters
N/A (Property of an object)
### Request Example
N/A (Property of an object)
### Response
#### Success Response (200)
- **IsEnabled** (Boolean) - True if the effect is enabled, false otherwise.
#### Response Example
```json
{
"IsEnabled": true
}
```
```
--------------------------------
### IAudioEffect Interface
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/categories
Interface for defining audio effects that can be integrated into YukkuriMovieMaker.
```APIDOC
## IAudioEffect Interface
### Description
Interface contract for custom audio effects.
### Namespace
YukkuriMovieMaker.Plugin.Effects
### Assembly
YukkuriMovieMaker.Plugin.dll
```
--------------------------------
### AudioEffectBase Class Documentation
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/audio-effect-base
Documentation for the AudioEffectBase class, which serves as a base class for audio effects in the YukkuriMovieMaker plugin.
```APIDOC
## AudioEffectBase Class
### Description
Provides the base functionality for audio effects within the YukkuriMovieMaker plugin system.
### Method
N/A (Class Documentation)
### Endpoint
N/A (Class Documentation)
### Parameters
N/A (Class Documentation)
### Request Example
N/A (Class Documentation)
### Response
N/A (Class Documentation)
### Related Classes
- AudioEffectAttribute
- AudioEffectCategories
```
--------------------------------
### Get Camera Category Key - C#
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-categories/field/camera
This C# code snippet defines a constant string 'Camera' which holds the key name for the camera effect category. This is used within the YukkuriMovieMaker plugin system to identify and reference camera-related effects.
```csharp
public const string Camera = "YMM4Key_EffectCategoryCameraName";
```
--------------------------------
### VideoEffectBase Constructor
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base/constructor
Initializes a new instance of the VideoEffectBase class. This constructor is part of the YukkuriMovieMaker.Plugin.Effects namespace.
```APIDOC
## VideoEffectBase()
### Description
Initializes a new instance of the VideoEffectBase class.
### Method
Constructor
### Endpoint
N/A (Class Constructor)
### Parameters
None
### Request Example
N/A
### Response
#### Success Response
Initializes the VideoEffectBase object.
#### Response Example
N/A
```
--------------------------------
### Get or Set Effect Enabled State (C#)
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base/property/is-enabled
The IsEnabled property in the YukkuriMovieMaker.Plugin.Effects namespace allows you to retrieve or modify the active state of an effect. It returns a boolean value, where true indicates the effect is enabled and false indicates it is disabled. This property is part of the YukkuriMovieMaker.Plugin.dll assembly.
```csharp
public bool IsEnabled { get; set; }
```
--------------------------------
### VideoEffectBase Class Documentation
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base
Documentation for the VideoEffectBase class, including its definition, constructors, properties, methods, and explicit interface implementations.
```APIDOC
## VideoEffectBase Class
### Description
This class is inherited by video effects to handle their names, parameters, change notifications, and processor provision.
### Namespace
YukkuriMovieMaker.Plugin.Effects
### Assembly
YukkuriMovieMaker.Plugin.dll
### Definition
```csharp
public abstract class VideoEffectBase : YukkuriMovieMaker.Commons.Animatable, YukkuriMovieMaker.Plugin.Effects.IVideoEffect, System.ComponentModel.INotifyPropertyChanged, System.ComponentModel.INotifyDataErrorInfo, YukkuriMovieMaker.UndoRedo.IUndoRedoable, YukkuriMovieMaker.ItemEditor.IEditable, YukkuriMovieMaker.Commons.IAnimatable, YukkuriMovieMaker.Project.IFileItem, YukkuriMovieMaker.Project.IResourceItem
```
### Inheritance
Object → Bindable → ValidatableBindable → UndoRedoable → Animatable → VideoEffectBase
### Interfaces
IVideoEffect, INotifyPropertyChanged, INotifyDataErrorInfo, IUndoRedoable, IEditable, Animatable, IFileItem, IResourceItem
### Constructors
#### VideoEffectBase()
- **Description**: Initializes a new instance of the `VideoEffectBase` class.
### Properties
#### Label
- **Description**: Gets or sets the name of the effect. Read-only.
- **Type**: string
#### IsEnabled
- **Description**: Gets or sets whether the effect is enabled or disabled.
- **Type**: bool
#### Remark
- **Description**: Gets or sets a remark for the effect.
- **Type**: string
### Methods
#### Set(ref T, T, string, params string[])
- **Description**: Sets a value to a reference-passed storage and notifies of changes.
- **Parameters**:
- `storage` (ref T): The storage to set the value to.
- `value` (T): The value to set.
- `propertyName` (string): The name of the property being changed.
- `additionalArgs` (params string[]): Additional arguments.
#### Set(Expression>, T, string, params string[])
- **Description**: Sets a value to a property using a property selector and notifies of changes.
- **Parameters**:
- `propertySelector` (Expression>): A selector expression for the property.
- `value` (T): The value to set.
- `propertyName` (string): The name of the property being changed.
- `additionalArgs` (params string[]): Additional arguments.
#### CreateExoVideoFilters(int, ExoOutputDescription)
- **Description**: Generates a string used when outputting as Exo.
- **Parameters**:
- `width` (int): The width of the output.
- `description` (ExoOutputDescription): Description of the Exo output.
- **Returns**: A string representing the Exo video filters.
#### CreateVideoEffect(IGraphicsDevicesAndContext)
- **Description**: Creates an instance of the processor.
- **Parameters**:
- `graphicsDevicesAndContext` (IGraphicsDevicesAndContext): The graphics devices and context.
- **Returns**: An object representing the video effect processor.
### Explicit Interface Implementations
#### IFileItem.GetFiles()
- **Description**: Returns an empty string array.
- **Returns**: `string[]`
#### IFileItem.ReplaceFile(string, string)
- **Description**: Performs no operation.
#### IResourceItem.GetResources()
- **Description**: Generates and returns a sequence of `TimelineResource` objects.
- **Returns**: `IEnumerable`
```
--------------------------------
### C# VideoEffectBaseの継承と実装
Source: https://ymmapi.pages.dev/example/sample/video-effect
Direct2Dエフェクトプラグインの基本構造を実装します。VideoEffectBaseを継承し、エフェクト名、設定項目、EXO出力、および映像エフェクトの作成ロジックを定義します。このコードは、エフェクトのプロパティ設定と、YMM4での表示・動作を制御します。
```csharp
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YukkuriMovieMaker.Commons;
using YukkuriMovieMaker.Controls;
using YukkuriMovieMaker.Exo;
using YukkuriMovieMaker.Player.Video;
using YukkuriMovieMaker.Plugin.Effects;
namespace YMM4SamplePlugin.VideoEffect.SampleD2DVideoEffect
{
///
/// 映像エフェクト
/// 映像エフェクトには必ず[VideoEffect]属性を設定してください。
///
[VideoEffect("サンプルD2Dエフェクト", ["サンプル"], [])]
internal class SampleD2DVideoEffect : VideoEffectBase
{
///
/// エフェクトの名前
///
public override string Label => "サンプルD2Dエフェクト";
///
/// アイテム編集エリアに表示するエフェクトの設定項目。
/// [Display]と[AnimationSlider]等のアイテム編集コントロール属性の2つを設定する必要があります。
/// [AnimationSlider]以外のアイテム編集コントロール属性の一覧はSamplePropertyEditorsプロジェクトを参照してください。
///
[Display(Name = "ぼかし", Description = "ぼかしの強さ")]
[AnimationSlider("F0", "", 0, 100)]
public Animation Blur { get; } = new Animation(10, 0, 100);
///
/// ExoFilterを作成する
///
/// キーフレーム番号
/// exo出力に必要な各種パラメーター
///
public override IEnumerable CreateExoVideoFilters(int keyFrameIndex, ExoOutputDescription exoOutputDescription)
{
var fps = exoOutputDescription.VideoInfo.FPS;
return
[
$"_name=ぼかし\r\n" +
$"_disable={(IsEnabled ?1:0)}\r\n" +
$"範囲={Blur.ToExoString(keyFrameIndex, "F0", fps)}\r\n" +
$"縦横比=0.0\r\n" +
$"光の強さ=0\r\n" +
$"サイズ固定=0\r\n",
];
}
///
/// 映像エフェクトを作成する
///
/// デバイス
/// 映像エフェクト
public override IVideoEffectProcessor CreateVideoEffect(IGraphicsDevicesAndContext devices)
{
return new SampleD2DVideoEffectProcessor(devices, this);
}
///
/// クラス内のIAnimatableの一覧を取得する
///
///
protected override IEnumerable GetAnimatables() => [Blur];
}
}
```
--------------------------------
### IVideoEffect Interface
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/is-aviutl-supported
Interface for video effects in the YukkuriMovieMaker plugin.
```APIDOC
## IVideoEffect Interface
### Description
Interface for video effects in the YukkuriMovieMaker plugin.
### Namespace
YukkuriMovieMaker.Plugin.Effects
### Assembly
YukkuriMovieMaker.Plugin.dll
```
--------------------------------
### C# VideoEffectBase 継承による映像エフェクト実装
Source: https://ymmapi.pages.dev/example/sample/video-effect
Direct2Dエフェクトを使用した映像エフェクトプラグインの基本構造を実装します。VideoEffectBaseクラスを継承し、エフェクトのプロパティ、EXO出力、および映像エフェクトの作成ロジックを定義します。このコードは、エフェクトの表示名、設定項目、およびアニメーション可能なプロパティを定義するために不可欠です。
```csharp
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YukkuriMovieMaker.Commons;
using YukkuriMovieMaker.Controls;
using YukkuriMovieMaker.Exo;
using YukkuriMovieMaker.Player.Video;
using YukkuriMovieMaker.Plugin.Effects;
namespace YMM4SamplePlugin.VideoEffect.SampleD2DVideoEffect
{
///
/// 映像エフェクト
/// 映像エフェクトには必ず[VideoEffect]属性を設定してください。
///
[VideoEffect("サンプルD2Dエフェクト", ["サンプル"], [])]
internal class SampleD2DVideoEffect : VideoEffectBase
{
///
/// エフェクトの名前
///
public override string Label => "サンプルD2Dエフェクト";
///
/// アイテム編集エリアに表示するエフェクトの設定項目。
/// [Display]と[AnimationSlider]等のアイテム編集コントロール属性の2つを設定する必要があります。
/// [AnimationSlider]以外のアイテム編集コントロール属性の一覧はSamplePropertyEditorsプロジェクトを参照してください。
///
[Display(Name = "ぼかし", Description = "ぼかしの強さ")]
[AnimationSlider("F0", "", 0, 100)]
public Animation Blur { get; } = new Animation(10, 0, 100);
///
/// ExoFilterを作成する
///
/// キーフレーム番号
/// exo出力に必要な各種パラメーター
///
public override IEnumerable CreateExoVideoFilters(int keyFrameIndex, ExoOutputDescription exoOutputDescription)
{
var fps = exoOutputDescription.VideoInfo.FPS;
return
[
"_name=ぼかし\r\n" +
"_disable="+(IsEnabled ?1:0)+"\r\n" +
$"範囲={Blur.ToExoString(keyFrameIndex, \"F0\", fps)}\r\n" +
"縦横比=0.0\r\n" +
"光の強さ=0\r\n" +
"サイズ固定=0\r\n",
];
}
///
/// 映像エフェクトを作成する
///
/// デバイス
/// 映像エフェクト
public override IVideoEffectProcessor CreateVideoEffect(IGraphicsDevicesAndContext devices)
{
return new SampleD2DVideoEffectProcessor(devices, this);
}
///
/// クラス内のIAnimatableの一覧を取得する
///
///
protected override IEnumerable GetAnimatables() => [Blur];
}
}
```
--------------------------------
### Keywords Property
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/keywords
Documentation for the Keywords property within the YukkuriMovieMaker.Plugin.Effects namespace.
```APIDOC
## Keywords Property
### Description
Provides information about the keywords associated with an effect.
### Method
GET
### Endpoint
`/websites/ymmapi_pages_dev/keywords`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
#### Success Response (200)
- **keywords** (string[]) - An array of strings representing the keywords.
#### Response Example
{
"keywords": ["effect", "keyword1", "keyword2"]
}
```
--------------------------------
### IsAviUtlSupported Property
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/name
Indicates whether the effect is supported by AviUtl.
```APIDOC
## IsAviUtlSupported Property
### Description
Indicates whether the effect is supported by AviUtl.
### Method
N/A
### Endpoint
N/A
### Parameters
N/A
### Request Example
N/A
### Response
N/A
```
--------------------------------
### IVideoEffect Interface
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/name
Interface defining the contract for video effects in YukkuriMovieMaker.
```APIDOC
## IVideoEffect Interface
### Description
Interface for video effect functionality.
### Method
N/A
### Endpoint
N/A
### Parameters
N/A
### Request Example
N/A
### Response
N/A
```
--------------------------------
### IVideoEffect Interface
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/categories
Interface for defining video effects that can be integrated into YukkuriMovieMaker.
```APIDOC
## IVideoEffect Interface
### Description
Interface contract for custom video effects.
### Namespace
YukkuriMovieMaker.Plugin.Effects
### Assembly
YukkuriMovieMaker.Plugin.dll
```
--------------------------------
### Set Value with Notification (C#)
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base
This C# method demonstrates how to set a value for a property passed by reference and notify about the change. It is useful for updating effect parameters and triggering UI updates.
```csharp
public void Set(ref T storage, T value, string propertyName, params string[] args)
```
--------------------------------
### Initialize VideoEffectAttribute (C#)
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/constructor
Initializes the VideoEffectAttribute, used to define video effects. It takes parameters for the effect's name, categories, keywords, and support for effect items and AviUtl. This attribute helps in organizing and searching for effects within YukkuriMovieMaker.
```csharp
VideoEffectAttribute(string name, string[] categories, string[] keywords, bool isEffectItemSupported = true, bool isAviUtlSupported = true)
```
--------------------------------
### IsAviUtlSupported Property
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/is-effect-item-supported
Indicates whether an effect item is supported by AviUtl.
```APIDOC
## IsAviUtlSupported Property
### Description
This property returns a boolean value indicating whether the effect item is compatible with or supported by AviUtl.
### Property
- **IsAviUtlSupported** (boolean) - True if the effect item is supported by AviUtl, false otherwise.
### Namespace
YukkuriMovieMaker.Plugin.Effects
### Assembly
YukkuriMovieMaker.Plugin.dll
```
--------------------------------
### Create Exo Video Filters for AviUtl
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base/method/create-exo-video-filters
Generates ExoFilters required for outputting as .exo files usable in AviUtl. It takes a keyframe index and ExoOutputDescription as input and returns a collection of ExoFilter strings. This is crucial for integrating custom video effects into AviUtl.
```csharp
public abstract IEnumerable CreateExoVideoFilters(int keyFrameIndex, ExoOutputDescription exoOutputDescription);
```
```csharp
// https://github.com/manju-summoner/YMM4PluginSamples/blob/master/YMM4SamplePlugin/VideoEffect/SampleD2DVideoEffect/SampleD2DVideoEffect.cs より一部変更して引用
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YukkuriMovieMaker.Commons;
using YukkuriMovieMaker.Controls;
using YukkuriMovieMaker.Exo;
using YukkuriMovieMaker.Player.Video;
using YukkuriMovieMaker.Plugin.Effects;
namespace BlurEffect
{
[VideoEffect("ぼかし", ["加工"], [])]
internal class BlurEffect : VideoEffectBase
{
// エフェクトの名前
public override string Label => "ぼかし";
// アイテム編集エリアに表示するエフェクトの設定項目
[Display(Name = "ぼかし", Description = "ぼかしの強さ")]
[AnimationSlider("F0", "", 0, 100)]
public Animation Blur { get; } = new Animation(10, 0, 100);
// ExoFilterを作成する
public override IEnumerable CreateExoVideoFilters(int keyFrameIndex, ExoOutputDescription exoOutputDescription)
{
var fps = exoOutputDescription.VideoInfo.FPS;
return
[
$"_name=ぼかし\r\n" +
$"_disable={(IsEnabled ?1:0)}\r\n" +
$"範囲={Blur.ToExoString(keyFrameIndex, "F0", fps)}\r\n" +
$"縦横比=0.0\r\n" +
$"光の強さ=0\r\n" +
$"サイズ固定=0\r\n",
];
}
// 映像エフェクトを作成する
public override IVideoEffectProcessor CreateVideoEffect(IGraphicsDevicesAndContext devices)
{
return new SampleD2DVideoEffectProcessor(devices, this);
}
//クラス内のIAnimatableの一覧を取得する
protected override IEnumerable GetAnimatables() => [Blur];
}
}
```
--------------------------------
### VideoEffectBase Class
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/is-aviutl-supported
Base class for video effects in the YukkuriMovieMaker plugin.
```APIDOC
## VideoEffectBase Class
### Description
Base class for video effects in the YukkuriMovieMaker plugin.
### Namespace
YukkuriMovieMaker.Plugin.Effects
### Assembly
YukkuriMovieMaker.Plugin.dll
```
--------------------------------
### IsAviUtlSupported Property
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/categories
Indicates whether the effect is supported by AviUtl. This property is available on classes like AudioEffectAttribute and VideoEffectAttribute.
```APIDOC
## IsAviUtlSupported Property
### Description
Gets a value indicating whether this effect is supported by AviUtl.
### Property Type
`bool`
### Applicable Classes
- AudioEffectAttribute
- VideoEffectAttribute
```
--------------------------------
### AudioEffectBase Class
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/name
The base class for all audio effect implementations in YukkuriMovieMaker plugins.
```APIDOC
## AudioEffectBase Class
### Description
Base class for audio effect implementations.
### Method
N/A
### Endpoint
N/A
### Parameters
N/A
### Request Example
N/A
### Response
N/A
```
--------------------------------
### Implement Custom Video Effect with IVideoEffectProcessor (C#)
Source: https://ymmapi.pages.dev/example/sample/video-effect
This C# code demonstrates how to implement a custom video effect processor by inheriting from the IVideoEffectProcessor interface for YukkuriMovieMaker (YMM4). It includes initializing a Direct2D custom effect, handling input images, updating effect parameters based on item values, and managing resource disposal. It requires Vortice.Direct2D1 and YukkuriMovieMaker.Commons namespaces.
```csharp
using Vortice.Direct2D1;
using YukkuriMovieMaker.Commons;
using YukkuriMovieMaker.Player.Video;
namespace YMM4SamplePlugin.VideoEffect.SampleHLSLShaderVideoEffect
{
internal class SampleHLSLShaderVideoEffectProcessor : IVideoEffectProcessor
{
readonly SampleHLSLShaderVideoEffect item;
bool isFirst = true;
double value;
readonly SampleHLSLShaderCustomEffect? effect;
readonly ID2D1Image? output;
ID2D1Image? input;
///
/// エフェクトの出力画像
///
public ID2D1Image Output => output ?? input ?? throw new NullReferenceException();
public SampleHLSLShaderVideoEffectProcessor(IGraphicsDevicesAndContext devices, SampleHLSLShaderVideoEffect item)
{
this.item = item;
effect = new SampleHLSLShaderCustomEffect(devices);
if (!effect.IsEnabled)
{
//GPU性能によってエフェクトの読み込みに失敗することがある
effect.Dispose();
effect = null;
}
else
{
output = effect.Output;//EffectからgetしたOutputは必ずDisposeする必要がある。Effect内部では開放されない。
}
}
///
/// エフェクトの入力画像を変更する
///
///
public void SetInput(ID2D1Image? input)
{
this.input = input;
effect?.SetInput(0, input, true);
}
///
/// エフェクトの入力画像をクリアする
///
public void ClearInput()
{
effect?.SetInput(0, null, true);
}
///
/// エフェクトを更新する
///
/// エフェクトの描画に必要な各種情報
/// 描画位置等
public DrawDescription Update(EffectDescription effectDescription)
{
if (effect is null)
return effectDescription.DrawDescription;
var frame = effectDescription.ItemPosition.Frame;
var length = effectDescription.ItemDuration.Frame;
var fps = effectDescription.FPS;
var value = item.Value.GetValue(frame, length, fps) / 100;
if (isFirst || this.value != value)
effect.Value = (float)value;
isFirst = false;
this.value = value;
return effectDescription.DrawDescription;
}
///
/// エフェクトの各種リソースを開放する
///
public void Dispose()
{
output?.Dispose();//EffectからgetしたOutputは必ずDisposeする必要がある。Effect内部では開放されない。
effect?.SetInput(0, null, true);//Inputは必ずnullに戻す。
effect?.Dispose();
}
}
}
```
--------------------------------
### AudioEffectCategories Class
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/is-aviutl-supported
Manages categories for audio effects in the YukkuriMovieMaker plugin.
```APIDOC
## AudioEffectCategories Class
### Description
Manages categories for audio effects in the YukkuriMovieMaker plugin.
### Namespace
YukkuriMovieMaker.Plugin.Effects
### Assembly
YukkuriMovieMaker.Plugin.dll
```
--------------------------------
### Set Value Using Property Selector (C#)
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base
This C# method allows setting a property value using a property selector expression. It provides a more type-safe way to update effect parameters and ensures changes are notified.
```csharp
public void Set(Expression> propertySelector, T value, string propertyName, params string[] args)
```
--------------------------------
### VideoEffectCategories Class
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/is-aviutl-supported
Manages categories for video effects in the YukkuriMovieMaker plugin.
```APIDOC
## VideoEffectCategories Class
### Description
Manages categories for video effects in the YukkuriMovieMaker plugin.
### Namespace
YukkuriMovieMaker.Plugin.Effects
### Assembly
YukkuriMovieMaker.Plugin.dll
```
--------------------------------
### IsEffectItemSupported Property
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/keywords
Documentation for the IsEffectItemSupported property, indicating if an effect item is supported.
```APIDOC
## IsEffectItemSupported Property
### Description
Indicates whether the effect item is supported by the current environment or configuration.
### Method
GET
### Endpoint
`/websites/ymmapi_pages_dev/is-effect-item-supported`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
#### Success Response (200)
- **isSupported** (boolean) - True if the effect item is supported, false otherwise.
#### Response Example
{
"isSupported": true
}
```
--------------------------------
### AudioEffectAttribute Class Documentation
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/audio-effect-base
Documentation for the AudioEffectAttribute class, used to define attributes for audio effects.
```APIDOC
## AudioEffectAttribute Class
### Description
Defines attributes associated with audio effects, likely used for metadata or configuration.
### Method
N/A (Class Documentation)
### Endpoint
N/A (Class Documentation)
### Parameters
N/A (Class Documentation)
### Request Example
N/A (Class Documentation)
### Response
N/A (Class Documentation)
### Related Classes
- AudioEffectBase
```
--------------------------------
### VideoEffectBase Class
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/categories
Base class for video effects in YukkuriMovieMaker. Provides a foundation for implementing custom video effect logic.
```APIDOC
## VideoEffectBase Class
### Description
Base class for all video effects in YukkuriMovieMaker.
### Namespace
YukkuriMovieMaker.Plugin.Effects
### Assembly
YukkuriMovieMaker.Plugin.dll
```
--------------------------------
### VideoEffectBase Class
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/name
The base class for all video effect implementations in YukkuriMovieMaker plugins.
```APIDOC
## VideoEffectBase Class
### Description
Base class for video effect implementations.
### Method
N/A
### Endpoint
N/A
### Parameters
N/A
### Request Example
N/A
### Response
N/A
```
--------------------------------
### IsEffectItemSupported Property
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-attribute/property/is-effect-item-supported
Provides information about whether an effect item is supported.
```APIDOC
## IsEffectItemSupported Property
### Description
This property indicates whether a specific effect item is supported by the system or plugin.
### Property
- **IsEffectItemSupported** (boolean) - True if the effect item is supported, false otherwise.
### Namespace
YukkuriMovieMaker.Plugin.Effects
### Assembly
YukkuriMovieMaker.Plugin.dll
```
--------------------------------
### Define VideoEffectBase Class (C#)
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base
This snippet shows the abstract class definition for VideoEffectBase in C#. It inherits from multiple interfaces and classes, indicating its role in handling video effects, animations, undo/redo operations, and data validation.
```csharp
public abstract class VideoEffectBase : YukkuriMovieMaker.Commons.Animatable, YukkuriMovieMaker.Plugin.Effects.IVideoEffect, System.ComponentModel.INotifyPropertyChanged, System.ComponentModel.INotifyDataErrorInfo, YukkuriMovieMaker.UndoRedo.IUndoRedoable, YukkuriMovieMaker.ItemEditor.IEditable, YukkuriMovieMaker.Commons.IAnimatable, YukkuriMovieMaker.Project.IFileItem, YukkuriMovieMaker.Project.IResourceItem
```
--------------------------------
### Create Video Effect using C#
Source: https://ymmapi.pages.dev/reference/yukkuri-movie-maker/plugin/effects/video-effect-base/method/create-video-effect
The `CreateVideoEffect` method is an abstract method used to generate a video effect processor. It takes an `IGraphicsDevicesAndContext` object as input, which provides the necessary device context for rendering. The method returns an `IVideoEffectProcessor` instance that handles the application of visual effects to input video frames.
```csharp
public abstract IVideoEffectProcessor CreateVideoEffect(IGraphicsDevicesAndContext devices);
```