コミットを比較
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
0204d480e2
|
||
|
|
7e1f2c1d7c
|
||
|
|
bab81d27e5
|
||
|
|
a3efd55ce6
|
検索条件に一致するファイルはありません
+31
-39
@@ -1,58 +1,50 @@
|
|||||||
# v1.4.0 - Lua スクリプト for YMM4
|
# v1.5.0 - Lua スクリプト for YMM4
|
||||||
|
|
||||||
AviUtl のアニメーション効果スクリプト(`.anm` 系)に対する**部分互換層**を追加した
|
AviUtl のアニメーション効果スクリプト互換層に**図形描画(`obj.load("figure")`)**を
|
||||||
リリースです。座標・拡縮・回転・不透明度の変形と乱数を用いる範囲について、追加の
|
追加したリリースです。スクリプトから円・四角形・三角形などの図形を生成し、
|
||||||
記述変更なしで AviUtl 向けスクリプトを実行できるようになりました。
|
オブジェクトの画像として描画できるようになりました。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 新機能
|
## 新機能
|
||||||
|
|
||||||
### 1. AviUtl スクリプトの部分互換
|
### 1. obj.load("figure") による図形描画
|
||||||
|
|
||||||
AviUtl のアニメーション効果スクリプトのうち、本プラグインの変形・ピクセルモデルへ
|
`obj.load("figure", 名前, 色, サイズ [, ライン [, アスペクト]])` を実装しました。
|
||||||
無理なく写像できる範囲を実行できる互換層を追加しました。スクリプトに AviUtl 固有の
|
指定した図形を生成してオブジェクトのバッファを置き換え、図形そのものを描画します。
|
||||||
記法が含まれない場合、この互換層は一切介入しないため、従来のスクリプトの挙動は
|
|
||||||
変わりません。
|
|
||||||
|
|
||||||
- **スクリプトヘッダの解釈**: コメント形式のパラメータ宣言を解釈し、スクリプト本体が
|
- 対応図形: 円・四角形・三角形・五角形・六角形・星形(英語名 circle / rect /
|
||||||
参照する変数を実行前に定義します。これまでは単なるコメントとして無視され、参照変数が
|
triangle / pentagon / hexagon / star も使用可)
|
||||||
`nil` になり実行できなかったスクリプトが動作するようになります。
|
- 塗りつぶしとライン(中抜き)に対応します。`ライン` を省略するか 0 を指定すると
|
||||||
- `--dialog:項目名,local 変数=既定値;…` … 各項目の宣言部を本体の先頭へ展開します。
|
塗りつぶし、サイズ以上の値を指定した場合も塗りつぶしになります。
|
||||||
- `--color:0xRRGGBB` … 変数 `color` を指定色で定義します。
|
- `アスペクト`(-1.0〜1.0)で幅・高さを歪曲できます。正で横幅、負で縦幅が縮みます。
|
||||||
- `--check0:項目名,既定値` … `obj.check0`(`0`〜`3`)を既定値で定義します。
|
- 図形は SDF ベースのアンチエイリアスで描画されます。出力は図形サイズに合わせて
|
||||||
- `--param:任意のLua文` … 記述した Lua 文をそのまま本体の先頭へ展開します。
|
生成され、オブジェクトの中心に配置されます。
|
||||||
- `--track0:`〜`--track3:` … 値は従来どおり `obj.track0`〜`obj.track3` から参照します
|
|
||||||
(ラベル・範囲・既定値の UI 反映は行いません)。
|
|
||||||
- **`@` による複数セクション**: 1 つのスクリプトに `@名前` で複数の効果が定義されて
|
|
||||||
いる場合、先頭のセクションのみを実行します。
|
|
||||||
|
|
||||||
### 2. obj.rand の追加
|
描画系 API(`obj.load` / `obj.draw` / `obj.effect` / `obj.setoption` /
|
||||||
|
`obj.copybuffer`)を含むスクリプトは、図形バッファモデルを持つ従来エンジン
|
||||||
AviUtl 互換の決定論的な整数乱数 `obj.rand(st, ed [, seed [, frame]])` を追加しました。
|
(MoonSharp)へ自動的に振り分けられます。
|
||||||
指定範囲 `st`〜`ed` の整数を返し、`seed` と `frame` が同じであれば常に同じ値を返します。
|
|
||||||
`frame` を省略すると現在のフレームを用います。従来エンジン(MoonSharp)と高速ランタイム
|
|
||||||
(LuaJIT)で同じ値を返すため、エンジンの自動振り分けによらず結果が一致します。
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 注意事項
|
## 注意事項
|
||||||
|
|
||||||
- 描画・フィルタ・ファイルアクセス系の関数(`obj.load` / `obj.draw` / `obj.drawpoly` /
|
- 本リリースで実装されているのは `obj.load("figure", ...)` のみです。画像ファイルや
|
||||||
`obj.effect` / `obj.copybuffer` / `obj.setoption` / `obj.setfont`、`require`、`io` 等)は
|
"text"・"tempbuffer"・"movie" などの読み込み、`obj.draw` / `obj.drawpoly` による
|
||||||
本体の描画パイプラインへの統合を要するため、この互換層では対象外です。これらを呼び出す
|
合成、`obj.effect` / `obj.setoption` / `obj.copybuffer` / `obj.setfont` には
|
||||||
スクリプトは意図どおりには動作しません。
|
対応していません。これらを呼び出すスクリプトは意図どおりには動作しません。
|
||||||
- `--track0:`〜`--track3:` のラベル・範囲・既定値はエフェクトパネルの UI へ反映されません。
|
- 図形のサイズに `obj.track0` 等を用いる場合、Track0〜Track3 のスライダー範囲は
|
||||||
トラックバーの値は従来どおり Track0〜Track3 のスライダー値が使用されます。
|
-100〜100 で、AviUtl ヘッダの範囲・既定値は UI へ反映されません。より大きな図形が
|
||||||
- エンジンに依存しない小数の乱数が必要な場合は、従来どおり `anim.rand` を使用してください。
|
必要な場合は数値欄へ直接入力するか、サイズを直接記述してください。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 内部実装
|
## 内部実装
|
||||||
|
|
||||||
- スクリプトを実行可能な Lua へ変換する前処理を追加し、MoonSharp・LuaJIT の両実行系へ
|
- SDF(符号付き距離場)による1パス・アンチエイリアスの図形ラスタライザを追加し、
|
||||||
一貫して適用しました。変換結果はソース単位でキャッシュし、毎フレームの再解析を避けています。
|
プリマルチプライド BGRA バッファを生成します。
|
||||||
- `obj.rand` の数値コアを C# と LuaJIT で同一アルゴリズムとして実装し、両者がビット単位で
|
- スクリプト実行コンテキストにバッファ置換 API を追加し、`obj.load` が入力画像を
|
||||||
一致することを等価性テストで検証しています。
|
図形バッファへ差し替えられるようにしました。出力経路は置換後のサイズで生成し、
|
||||||
- AviUtl 固有の記法を含まないスクリプトでは前処理がソースをそのまま返すため、既存スクリプト
|
図形を原点中心に配置します。
|
||||||
および既存の実行・キャッシュ経路に対する影響はありません。
|
- 図形ごとの被覆・色・サイズのユニットテスト、および描画系スクリプトのエンジン
|
||||||
|
振り分けテストを追加しました。
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
========================================
|
========================================
|
||||||
Luaスクリプト for YMM4 v1.4.0
|
Luaスクリプト for YMM4 v1.5.0
|
||||||
========================================
|
========================================
|
||||||
YukkuriMovieMaker4(YMM4)上で動作する、Luaスクリプトで映像エフェクトのパラメータや
|
YukkuriMovieMaker4(YMM4)上で動作する、Luaスクリプトで映像エフェクトのパラメータや
|
||||||
ピクセルを直接制御できるプラグインです。
|
ピクセルを直接制御できるプラグインです。
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
using LuaScript.Compat;
|
||||||
|
|
||||||
|
namespace LuaScript.Tests
|
||||||
|
{
|
||||||
|
public class FigureRendererTests
|
||||||
|
{
|
||||||
|
private static (int B, int G, int R, int A) Pixel(byte[] buffer, int width, int x, int y)
|
||||||
|
{
|
||||||
|
int i = (y * width + x) * 4;
|
||||||
|
return (buffer[i], buffer[i + 1], buffer[i + 2], buffer[i + 3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Render_ProducesBufferOfRequestedSize()
|
||||||
|
{
|
||||||
|
var buffer = FigureRenderer.Render("円", 64, 48, 0xFFFFFF, 0d);
|
||||||
|
Assert.Equal(64 * 48 * 4, buffer.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void FilledCircle_CenterIsOpaqueAndColored()
|
||||||
|
{
|
||||||
|
int w = 100, h = 100;
|
||||||
|
var buffer = FigureRenderer.Render("円", w, h, 0xFF0000, 0d);
|
||||||
|
var (b, g, r, a) = Pixel(buffer, w, w / 2, h / 2);
|
||||||
|
Assert.Equal(255, a);
|
||||||
|
Assert.Equal(255, r);
|
||||||
|
Assert.Equal(0, g);
|
||||||
|
Assert.Equal(0, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void FilledCircle_CornerIsTransparent()
|
||||||
|
{
|
||||||
|
int w = 100, h = 100;
|
||||||
|
var buffer = FigureRenderer.Render("円", w, h, 0xFF0000, 0d);
|
||||||
|
var (_, _, _, a) = Pixel(buffer, w, 0, 0);
|
||||||
|
Assert.Equal(0, a);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Color_IsStoredPremultipliedAtHalfCoverageBoundary()
|
||||||
|
{
|
||||||
|
int w = 100, h = 100;
|
||||||
|
var buffer = FigureRenderer.Render("四角形", w, h, 0x102030, 0d);
|
||||||
|
var (b, g, r, a) = Pixel(buffer, w, w / 2, h / 2);
|
||||||
|
Assert.Equal(255, a);
|
||||||
|
Assert.Equal(0x10, r);
|
||||||
|
Assert.Equal(0x20, g);
|
||||||
|
Assert.Equal(0x30, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void FilledRectangle_CornerIsOpaque()
|
||||||
|
{
|
||||||
|
int w = 80, h = 80;
|
||||||
|
var buffer = FigureRenderer.Render("四角形", w, h, 0xFFFFFF, 0d);
|
||||||
|
var (_, _, _, a) = Pixel(buffer, w, 1, 1);
|
||||||
|
Assert.Equal(255, a);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void OutlinedCircle_IsHollowAtCenterButSolidNearEdge()
|
||||||
|
{
|
||||||
|
int w = 100, h = 100;
|
||||||
|
var buffer = FigureRenderer.Render("円", w, h, 0xFFFFFF, 8d);
|
||||||
|
var (_, _, _, center) = Pixel(buffer, w, w / 2, h / 2);
|
||||||
|
var (_, _, _, nearEdge) = Pixel(buffer, w, w / 2 + 46, h / 2);
|
||||||
|
Assert.Equal(0, center);
|
||||||
|
Assert.Equal(255, nearEdge);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Triangle_CornersEmptyCentroidFilled()
|
||||||
|
{
|
||||||
|
int w = 100, h = 100;
|
||||||
|
var buffer = FigureRenderer.Render("三角形", w, h, 0xFFFFFF, 0d);
|
||||||
|
var (_, _, _, topLeft) = Pixel(buffer, w, 2, 2);
|
||||||
|
var (_, _, _, topRight) = Pixel(buffer, w, w - 3, 2);
|
||||||
|
var (_, _, _, centroid) = Pixel(buffer, w, w / 2, h / 2);
|
||||||
|
Assert.Equal(0, topLeft);
|
||||||
|
Assert.Equal(0, topRight);
|
||||||
|
Assert.Equal(255, centroid);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void UnknownName_FallsBackToRectangle()
|
||||||
|
{
|
||||||
|
int w = 40, h = 40;
|
||||||
|
var buffer = FigureRenderer.Render("unknown", w, h, 0xFFFFFF, 0d);
|
||||||
|
var (_, _, _, corner) = Pixel(buffer, w, 1, 1);
|
||||||
|
Assert.Equal(255, corner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
<Compile Include="..\LuaScript\AnimTableRegistrar.cs" Link="Linked\AnimTableRegistrar.cs" />
|
<Compile Include="..\LuaScript\AnimTableRegistrar.cs" Link="Linked\AnimTableRegistrar.cs" />
|
||||||
<Compile Include="..\LuaScript\Compat\AviUtlScript.cs" Link="Linked\AviUtlScript.cs" />
|
<Compile Include="..\LuaScript\Compat\AviUtlScript.cs" Link="Linked\AviUtlScript.cs" />
|
||||||
<Compile Include="..\LuaScript\Compat\AviUtlRandom.cs" Link="Linked\AviUtlRandom.cs" />
|
<Compile Include="..\LuaScript\Compat\AviUtlRandom.cs" Link="Linked\AviUtlRandom.cs" />
|
||||||
|
<Compile Include="..\LuaScript\Compat\FigureRenderer.cs" Link="Linked\FigureRenderer.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -37,6 +37,9 @@ namespace LuaScript.Tests
|
|||||||
[InlineData("local pd = obj.getpixeldata()", "Native")]
|
[InlineData("local pd = obj.getpixeldata()", "Native")]
|
||||||
[InlineData("--!moonsharp\nobj.setpixel(0,0,1,1,1)", "MoonSharp")]
|
[InlineData("--!moonsharp\nobj.setpixel(0,0,1,1,1)", "MoonSharp")]
|
||||||
[InlineData("--!native\nobj.rz = 1", "Native")]
|
[InlineData("--!native\nobj.rz = 1", "Native")]
|
||||||
|
[InlineData("obj.load(\"figure\", \"円\", 0xff0000, 100)", "MoonSharp")]
|
||||||
|
[InlineData("obj.load(\"figure\", \"円\", 0xff0000, 100)\nlocal r = obj.getpixel(0,0)", "MoonSharp")]
|
||||||
|
[InlineData("--!native\nobj.load(\"figure\", \"円\", 0xff0000, 100)", "Native")]
|
||||||
public void ResolveAuto_RoutesPixelScriptsToNative(string script, string expected)
|
public void ResolveAuto_RoutesPixelScriptsToNative(string script, string expected)
|
||||||
{
|
{
|
||||||
Assert.Equal(expected, ScriptDirective.ResolveAuto(script).ToString());
|
Assert.Equal(expected, ScriptDirective.ResolveAuto(script).ToString());
|
||||||
|
|||||||
@@ -63,8 +63,10 @@ namespace LuaScript
|
|||||||
private byte[]? _pixelBuffer;
|
private byte[]? _pixelBuffer;
|
||||||
private bool _pixelBufferLoaded;
|
private bool _pixelBufferLoaded;
|
||||||
private bool _isPixelsDirty;
|
private bool _isPixelsDirty;
|
||||||
|
private bool _bufferReplaced;
|
||||||
|
|
||||||
public bool IsPixelsDirty => _isPixelsDirty;
|
public bool IsPixelsDirty => _isPixelsDirty;
|
||||||
|
public bool BufferReplaced => _bufferReplaced;
|
||||||
|
|
||||||
internal int TotalChannels => ImageWidth * ImageHeight * 4;
|
internal int TotalChannels => ImageWidth * ImageHeight * 4;
|
||||||
|
|
||||||
@@ -76,6 +78,17 @@ namespace LuaScript
|
|||||||
_pixelBuffer = null;
|
_pixelBuffer = null;
|
||||||
_pixelBufferLoaded = false;
|
_pixelBufferLoaded = false;
|
||||||
_isPixelsDirty = false;
|
_isPixelsDirty = false;
|
||||||
|
_bufferReplaced = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void ReplaceBuffer(byte[] buffer, int width, int height)
|
||||||
|
{
|
||||||
|
_pixelBuffer = buffer;
|
||||||
|
_pixelBufferLoaded = true;
|
||||||
|
_isPixelsDirty = true;
|
||||||
|
_bufferReplaced = true;
|
||||||
|
ImageWidth = width;
|
||||||
|
ImageHeight = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void EnsurePixelBuffer()
|
internal void EnsurePixelBuffer()
|
||||||
|
|||||||
@@ -0,0 +1,193 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace LuaScript.Compat
|
||||||
|
{
|
||||||
|
internal static class FigureRenderer
|
||||||
|
{
|
||||||
|
private enum Shape
|
||||||
|
{
|
||||||
|
Ellipse,
|
||||||
|
Rectangle,
|
||||||
|
Triangle,
|
||||||
|
Pentagon,
|
||||||
|
Hexagon,
|
||||||
|
Star,
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] Render(string name, int width, int height, int colorRgb, double lineWidth)
|
||||||
|
{
|
||||||
|
width = Math.Max(1, width);
|
||||||
|
height = Math.Max(1, height);
|
||||||
|
var buffer = new byte[width * height * 4];
|
||||||
|
|
||||||
|
Shape shape = Resolve(name);
|
||||||
|
double hx = width / 2d;
|
||||||
|
double hy = height / 2d;
|
||||||
|
|
||||||
|
double r = (colorRgb >> 16) & 0xFF;
|
||||||
|
double g = (colorRgb >> 8) & 0xFF;
|
||||||
|
double b = colorRgb & 0xFF;
|
||||||
|
|
||||||
|
(double X, double Y)[]? polygon = shape switch
|
||||||
|
{
|
||||||
|
Shape.Triangle => RegularPolygon(3, hx, hy),
|
||||||
|
Shape.Pentagon => RegularPolygon(5, hx, hy),
|
||||||
|
Shape.Hexagon => RegularPolygon(6, hx, hy),
|
||||||
|
Shape.Star => StarPolygon(hx, hy),
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
|
||||||
|
bool filled = lineWidth <= 0d;
|
||||||
|
|
||||||
|
for (int y = 0; y < height; y++)
|
||||||
|
{
|
||||||
|
double py = y + 0.5 - hy;
|
||||||
|
int row = y * width * 4;
|
||||||
|
for (int x = 0; x < width; x++)
|
||||||
|
{
|
||||||
|
double px = x + 0.5 - hx;
|
||||||
|
double d = shape switch
|
||||||
|
{
|
||||||
|
Shape.Ellipse => EllipseSdf(px, py, hx, hy),
|
||||||
|
Shape.Rectangle => BoxSdf(px, py, hx, hy),
|
||||||
|
_ => PolygonSdf(px, py, polygon!),
|
||||||
|
};
|
||||||
|
if (!filled)
|
||||||
|
d = Math.Max(d, -d - lineWidth);
|
||||||
|
|
||||||
|
double coverage = 0.5 - d;
|
||||||
|
if (coverage <= 0d)
|
||||||
|
continue;
|
||||||
|
if (coverage > 1d)
|
||||||
|
coverage = 1d;
|
||||||
|
|
||||||
|
int i = row + x * 4;
|
||||||
|
buffer[i] = ToByte(b * coverage);
|
||||||
|
buffer[i + 1] = ToByte(g * coverage);
|
||||||
|
buffer[i + 2] = ToByte(r * coverage);
|
||||||
|
buffer[i + 3] = ToByte(255d * coverage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Shape Resolve(string name)
|
||||||
|
{
|
||||||
|
switch (name.Trim())
|
||||||
|
{
|
||||||
|
case "円":
|
||||||
|
case "楕円":
|
||||||
|
case "circle":
|
||||||
|
case "ellipse":
|
||||||
|
return Shape.Ellipse;
|
||||||
|
case "三角形":
|
||||||
|
case "triangle":
|
||||||
|
return Shape.Triangle;
|
||||||
|
case "五角形":
|
||||||
|
case "pentagon":
|
||||||
|
return Shape.Pentagon;
|
||||||
|
case "六角形":
|
||||||
|
case "hexagon":
|
||||||
|
return Shape.Hexagon;
|
||||||
|
case "星形":
|
||||||
|
case "star":
|
||||||
|
return Shape.Star;
|
||||||
|
default:
|
||||||
|
return Shape.Rectangle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static (double X, double Y)[] RegularPolygon(int sides, double hx, double hy)
|
||||||
|
{
|
||||||
|
var vertices = new (double X, double Y)[sides];
|
||||||
|
for (int k = 0; k < sides; k++)
|
||||||
|
{
|
||||||
|
double angle = -Math.PI / 2d + 2d * Math.PI * k / sides;
|
||||||
|
vertices[k] = (Math.Cos(angle) * hx, Math.Sin(angle) * hy);
|
||||||
|
}
|
||||||
|
return vertices;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static (double X, double Y)[] StarPolygon(double hx, double hy)
|
||||||
|
{
|
||||||
|
const double innerRatio = 0.38196601125010515d;
|
||||||
|
var vertices = new (double X, double Y)[10];
|
||||||
|
for (int k = 0; k < 10; k++)
|
||||||
|
{
|
||||||
|
double angle = -Math.PI / 2d + Math.PI * k / 5d;
|
||||||
|
double radius = (k & 1) == 0 ? 1d : innerRatio;
|
||||||
|
vertices[k] = (Math.Cos(angle) * hx * radius, Math.Sin(angle) * hy * radius);
|
||||||
|
}
|
||||||
|
return vertices;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double EllipseSdf(double px, double py, double ax, double ay)
|
||||||
|
{
|
||||||
|
if (ax <= 0d || ay <= 0d)
|
||||||
|
return double.MaxValue;
|
||||||
|
double kx = px / ax;
|
||||||
|
double ky = py / ay;
|
||||||
|
double k1 = Math.Sqrt(kx * kx + ky * ky);
|
||||||
|
if (k1 == 0d)
|
||||||
|
return -Math.Min(ax, ay);
|
||||||
|
double nx = kx / ax;
|
||||||
|
double ny = ky / ay;
|
||||||
|
double k2 = Math.Sqrt(nx * nx + ny * ny);
|
||||||
|
return k1 * (k1 - 1d) / k2;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double BoxSdf(double px, double py, double hx, double hy)
|
||||||
|
{
|
||||||
|
double qx = Math.Abs(px) - hx;
|
||||||
|
double qy = Math.Abs(py) - hy;
|
||||||
|
double ox = Math.Max(qx, 0d);
|
||||||
|
double oy = Math.Max(qy, 0d);
|
||||||
|
return Math.Sqrt(ox * ox + oy * oy) + Math.Min(Math.Max(qx, qy), 0d);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double PolygonSdf(double px, double py, (double X, double Y)[] v)
|
||||||
|
{
|
||||||
|
int n = v.Length;
|
||||||
|
double dx = px - v[0].X;
|
||||||
|
double dy = py - v[0].Y;
|
||||||
|
double d = dx * dx + dy * dy;
|
||||||
|
double s = 1d;
|
||||||
|
|
||||||
|
for (int i = 0, j = n - 1; i < n; j = i, i++)
|
||||||
|
{
|
||||||
|
double ex = v[j].X - v[i].X;
|
||||||
|
double ey = v[j].Y - v[i].Y;
|
||||||
|
double wx = px - v[i].X;
|
||||||
|
double wy = py - v[i].Y;
|
||||||
|
double t = Clamp((wx * ex + wy * ey) / (ex * ex + ey * ey), 0d, 1d);
|
||||||
|
double bx = wx - ex * t;
|
||||||
|
double by = wy - ey * t;
|
||||||
|
d = Math.Min(d, bx * bx + by * by);
|
||||||
|
|
||||||
|
bool c1 = py >= v[i].Y;
|
||||||
|
bool c2 = py < v[j].Y;
|
||||||
|
bool c3 = ex * wy > ey * wx;
|
||||||
|
if ((c1 && c2 && c3) || (!c1 && !c2 && !c3))
|
||||||
|
s = -s;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s * Math.Sqrt(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double Clamp(double v, double lo, double hi)
|
||||||
|
{
|
||||||
|
if (v < lo) return lo;
|
||||||
|
if (v > hi) return hi;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static byte ToByte(double v)
|
||||||
|
{
|
||||||
|
int i = (int)(v + 0.5d);
|
||||||
|
if (i < 0) return 0;
|
||||||
|
if (i > 255) return 255;
|
||||||
|
return (byte)i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,12 +19,22 @@ namespace LuaScript.Engine
|
|||||||
{
|
{
|
||||||
if (TryGetDirective(script, out var kind))
|
if (TryGetDirective(script, out var kind))
|
||||||
return kind;
|
return kind;
|
||||||
|
if (UsesDrawingApi(script))
|
||||||
|
return ScriptEngineKind.MoonSharp;
|
||||||
return UsesPixelApi(script) ? ScriptEngineKind.Native : ScriptEngineKind.MoonSharp;
|
return UsesPixelApi(script) ? ScriptEngineKind.Native : ScriptEngineKind.MoonSharp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool UsesPixelApi(string? script) =>
|
public static bool UsesPixelApi(string? script) =>
|
||||||
script is not null && (script.Contains("getpixel", StringComparison.Ordinal) || script.Contains("setpixel", StringComparison.Ordinal));
|
script is not null && (script.Contains("getpixel", StringComparison.Ordinal) || script.Contains("setpixel", StringComparison.Ordinal));
|
||||||
|
|
||||||
|
public static bool UsesDrawingApi(string? script) =>
|
||||||
|
script is not null && (
|
||||||
|
script.Contains("obj.load", StringComparison.Ordinal) ||
|
||||||
|
script.Contains("obj.draw", StringComparison.Ordinal) ||
|
||||||
|
script.Contains("obj.effect", StringComparison.Ordinal) ||
|
||||||
|
script.Contains("obj.setoption", StringComparison.Ordinal) ||
|
||||||
|
script.Contains("obj.copybuffer", StringComparison.Ordinal));
|
||||||
|
|
||||||
private static bool TryGetDirective(string? script, out ScriptEngineKind kind)
|
private static bool TryGetDirective(string? script, out ScriptEngineKind kind)
|
||||||
{
|
{
|
||||||
kind = ScriptEngineKind.MoonSharp;
|
kind = ScriptEngineKind.MoonSharp;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace LuaScript
|
|||||||
"obj.time", "obj.totaltime", "obj.t", "obj.frame", "obj.totalframe",
|
"obj.time", "obj.totaltime", "obj.t", "obj.frame", "obj.totalframe",
|
||||||
"obj.framerate", "obj.layer", "obj.index", "obj.num",
|
"obj.framerate", "obj.layer", "obj.index", "obj.num",
|
||||||
"obj.getpixel", "obj.setpixel",
|
"obj.getpixel", "obj.setpixel",
|
||||||
"obj.getpixeldata", "obj.rand"
|
"obj.getpixeldata", "obj.rand", "obj.load"
|
||||||
]),
|
]),
|
||||||
("math", [
|
("math", [
|
||||||
"math.abs", "math.ceil", "math.cos", "math.exp", "math.floor",
|
"math.abs", "math.ceil", "math.cos", "math.exp", "math.floor",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net10.0-windows10.0.19041.0</TargetFramework>
|
<TargetFramework>net10.0-windows10.0.19041.0</TargetFramework>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Version>1.4.0</Version>
|
<Version>1.5.0</Version>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
|||||||
@@ -210,9 +210,14 @@ namespace LuaScript
|
|||||||
|
|
||||||
if (ctx.IsPixelsDirty)
|
if (ctx.IsPixelsDirty)
|
||||||
{
|
{
|
||||||
EnsureBitmaps(imgW, imgH);
|
int bufW = ctx.ImageWidth;
|
||||||
WritePixelsToOutput(ctx.GetPixelBuffer()!, imgW);
|
int bufH = ctx.ImageHeight;
|
||||||
UpdateTransformEffect(bounds);
|
EnsureBitmaps(bufW, bufH);
|
||||||
|
WritePixelsToOutput(ctx.GetPixelBuffer()!, bufW);
|
||||||
|
if (ctx.BufferReplaced)
|
||||||
|
UpdateTransformEffect(-bufW / 2f, -bufH / 2f);
|
||||||
|
else
|
||||||
|
UpdateTransformEffect(bounds.Left, bounds.Top);
|
||||||
effectOutput = _transformEffect!.Output;
|
effectOutput = _transformEffect!.Output;
|
||||||
pixelsModified = true;
|
pixelsModified = true;
|
||||||
}
|
}
|
||||||
@@ -398,7 +403,7 @@ namespace LuaScript
|
|||||||
{
|
{
|
||||||
EnsureBitmaps(imgW, imgH);
|
EnsureBitmaps(imgW, imgH);
|
||||||
WritePixelsToOutput(buffer, imgW);
|
WritePixelsToOutput(buffer, imgW);
|
||||||
UpdateTransformEffect(bounds);
|
UpdateTransformEffect(bounds.Left, bounds.Top);
|
||||||
effectOutput = _transformEffect!.Output;
|
effectOutput = _transformEffect!.Output;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -462,7 +467,7 @@ namespace LuaScript
|
|||||||
_outputBitmap!.CopyFromMemory(new nint(ptr), width * 4);
|
_outputBitmap!.CopyFromMemory(new nint(ptr), width * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateTransformEffect(RawRectF bounds)
|
private void UpdateTransformEffect(float left, float top)
|
||||||
{
|
{
|
||||||
if (_transformEffect is null)
|
if (_transformEffect is null)
|
||||||
{
|
{
|
||||||
@@ -471,10 +476,10 @@ namespace LuaScript
|
|||||||
_cachedBounds = default;
|
_cachedBounds = default;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_cachedBounds.Left != bounds.Left || _cachedBounds.Top != bounds.Top)
|
if (_cachedBounds.Left != left || _cachedBounds.Top != top)
|
||||||
{
|
{
|
||||||
_transformEffect.TransformMatrix = Matrix3x2.CreateTranslation(bounds.Left, bounds.Top);
|
_transformEffect.TransformMatrix = Matrix3x2.CreateTranslation(left, top);
|
||||||
_cachedBounds = bounds;
|
_cachedBounds = new RawRectF(left, top, left, top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -463,6 +463,46 @@ namespace LuaScript
|
|||||||
double frame = args.Count > 3 ? args[3].CastToNumber() ?? frameDefault : frameDefault;
|
double frame = args.Count > 3 ? args[3].CastToNumber() ?? frameDefault : frameDefault;
|
||||||
return DynValue.NewNumber(AviUtlRandom.Next(a, b, seed, frame));
|
return DynValue.NewNumber(AviUtlRandom.Next(a, b, seed, frame));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
obj["load"] = DynValue.NewCallback((_, args) =>
|
||||||
|
{
|
||||||
|
_activeCancellation.ThrowIfCancellationRequested();
|
||||||
|
if (_activeContext is null || args.Count < 4)
|
||||||
|
return DynValue.Void;
|
||||||
|
if (args[0].Type != DataType.String || args[0].String != "figure")
|
||||||
|
return DynValue.Void;
|
||||||
|
|
||||||
|
string name = args[1].Type == DataType.String ? args[1].String : string.Empty;
|
||||||
|
int color = (int)(args[2].CastToNumber() ?? 0d);
|
||||||
|
double size = args[3].CastToNumber() ?? 0d;
|
||||||
|
double line = args.Count > 4 ? args[4].CastToNumber() ?? 0d : 0d;
|
||||||
|
double aspect = args.Count > 5 ? Math.Clamp(args[5].CastToNumber() ?? 0d, -1d, 1d) : 0d;
|
||||||
|
|
||||||
|
LoadFigure(name, color, size, line, aspect);
|
||||||
|
return DynValue.Void;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadFigure(string name, int color, double size, double line, double aspect)
|
||||||
|
{
|
||||||
|
int boundingSize = Math.Max(1, (int)Math.Round(size));
|
||||||
|
double width = aspect >= 0d ? boundingSize * (1d - aspect) : boundingSize;
|
||||||
|
double height = aspect <= 0d ? boundingSize * (1d + aspect) : boundingSize;
|
||||||
|
int w = Math.Max(1, (int)Math.Round(width));
|
||||||
|
int h = Math.Max(1, (int)Math.Round(height));
|
||||||
|
|
||||||
|
var buffer = FigureRenderer.Render(name, w, h, color, line);
|
||||||
|
_activeContext!.ReplaceBuffer(buffer, w, h);
|
||||||
|
|
||||||
|
var obj = _objTable!;
|
||||||
|
obj["w"] = w;
|
||||||
|
obj["h"] = h;
|
||||||
|
obj["hw"] = w / 2d;
|
||||||
|
obj["hh"] = h / 2d;
|
||||||
|
obj["cx"] = w / 2d;
|
||||||
|
obj["cy"] = h / 2d;
|
||||||
|
obj["cz"] = 0d;
|
||||||
|
obj["diagonal"] = Math.Sqrt((double)w * w + (double)h * h);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static DynValue BuildObjectTable(Script script, SceneObjectInfo info)
|
private static DynValue BuildObjectTable(Script script, SceneObjectInfo info)
|
||||||
|
|||||||
@@ -314,6 +314,25 @@
|
|||||||
النتيجة : عدد صحيح ضمن st ~ ed
|
النتيجة : عدد صحيح ضمن st ~ ed
|
||||||
مثال: obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
مثال: obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
||||||
|
|
||||||
|
○ obj.load(الهدف، ...)
|
||||||
|
يستبدل مخزن الكائن بمحتوى مُولَّد. في هذا الإصدار يُدعم الهدف "figure" فقط.
|
||||||
|
obj.load("figure", name, color, size [, line [, aspect]])
|
||||||
|
يُولّد شكلاً ويستبدل مخزن الكائن به
|
||||||
|
(يُعاد تحجيم الخرج ليطابق الشكل ويُتوسَّط).
|
||||||
|
name : اسم الشكل. أحد 円 / 四角形 / 三角形 / 五角形 /
|
||||||
|
六角形 / 星形 (وتُقبل الأسماء الإنجليزية circle, rect,
|
||||||
|
triangle, pentagon, hexagon, star).
|
||||||
|
color : لون التعبئة 0xRRGGBB.
|
||||||
|
size : الحجم الأساسي بالبكسل.
|
||||||
|
line : عرض الحد (اختياري). الحذف أو 0 يملأ الشكل،
|
||||||
|
والقيمة المساوية للحجم أو الأكبر منه تملؤه أيضاً.
|
||||||
|
aspect : التشويه -1.0 ~ 1.0 (اختياري). الموجب يقلّص العرض،
|
||||||
|
والسالب يقلّص الارتفاع.
|
||||||
|
مثال: obj.load("figure", "円", 0xff3366, 200)
|
||||||
|
※ المُنفَّذ هو obj.load("figure", ...) فقط. الأهداف الأخرى
|
||||||
|
(ملفات الصور و"text" و"tempbuffer" و"movie" وغيرها) لا تفعل شيئاً.
|
||||||
|
※ تُنفَّذ نصوص الرسم على محرك MoonSharp.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- ymm4 Table -
|
- ymm4 Table -
|
||||||
@@ -484,10 +503,14 @@
|
|||||||
دالة أرقام عشوائية صحيحة حتمية متوافقة مع AviUtl. انظر "جدول obj - الدوال"
|
دالة أرقام عشوائية صحيحة حتمية متوافقة مع AviUtl. انظر "جدول obj - الدوال"
|
||||||
للتفاصيل.
|
للتفاصيل.
|
||||||
|
|
||||||
|
○ رسم الأشكال
|
||||||
|
obj.load("figure", ...) يُولّد دائرة أو مربعاً أو مثلثاً أو خماسياً أو
|
||||||
|
سداسياً أو نجمة، ويستبدل مخزن الكائن به. انظر "جدول obj - الدوال" للتفاصيل.
|
||||||
|
|
||||||
تتطلب الميزات التالية التكامل مع خط أنابيب الرسم، لذا فهي خارج نطاق هذه الطبقة.
|
تتطلب الميزات التالية التكامل مع خط أنابيب الرسم، لذا فهي خارج نطاق هذه الطبقة.
|
||||||
النصوص التي تستدعيها لن تعمل كما هو متوقع.
|
النصوص التي تستدعيها لن تعمل كما هو متوقع.
|
||||||
× تحميل ورسم الصور والأشكال والنصوص والفيديو
|
× الرسم والتركيب (obj.draw / obj.drawpoly)، وأهداف obj.load غير "figure"
|
||||||
(obj.load / obj.draw / obj.drawpoly / obj.setfont وما شابه)
|
(ملفات الصور و"text" و"movie" وغيرها)، وكذلك obj.setfont
|
||||||
× تأثيرات المرشّحات وعمليات المخزن المؤقت
|
× تأثيرات المرشّحات وعمليات المخزن المؤقت
|
||||||
(obj.effect / obj.copybuffer / obj.setoption وما شابه)
|
(obj.effect / obj.copybuffer / obj.setoption وما شابه)
|
||||||
× تحميل الوحدات عبر require، والوصول إلى الملفات مثل io
|
× تحميل الوحدات عبر require، والوصول إلى الملفات مثل io
|
||||||
@@ -495,7 +518,7 @@
|
|||||||
|
|
||||||
- الميزات غير المدعومة / القيود -
|
- الميزات غير المدعومة / القيود -
|
||||||
|
|
||||||
× obj.effect()، obj.draw()، obj.drawpoly()، obj.load() وما شابه من AviUtl2 غير مدعومة.
|
× obj.effect()، obj.draw()، obj.drawpoly() وما شابه من AviUtl2 غير مدعومة (يُدعم obj.load("figure", ...) فقط؛ انظر "التوافق الجزئي مع نصوص AviUtl").
|
||||||
× obj.rand1()، obj.setfont()، obj.mes() وما شابه من AviUtl2 غير مدعومة.
|
× obj.rand1()، obj.setfont()، obj.mes() وما شابه من AviUtl2 غير مدعومة.
|
||||||
× obj.setoption()، obj.getoption()، obj.getvalue()، obj.setanchor() وما شابه من AviUtl2 غير مدعومة.
|
× obj.setoption()، obj.getoption()، obj.getvalue()، obj.setanchor() وما شابه من AviUtl2 غير مدعومة.
|
||||||
× الدوال مثل scene.set() و scene.get() في جدول scene الخاص بـ AviUtl2 غير مدعومة.
|
× الدوال مثل scene.set() و scene.get() في جدول scene الخاص بـ AviUtl2 غير مدعومة.
|
||||||
|
|||||||
@@ -321,6 +321,26 @@
|
|||||||
Returns : An integer within st ~ ed
|
Returns : An integer within st ~ ed
|
||||||
Example: obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
Example: obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
||||||
|
|
||||||
|
o obj.load(target, ...)
|
||||||
|
Replaces the object buffer with generated content.
|
||||||
|
Only the "figure" target is supported in this version.
|
||||||
|
obj.load("figure", name, color, size [, line [, aspect]])
|
||||||
|
Generates a shape and replaces the object buffer with it
|
||||||
|
(the output is resized to the shape and centered).
|
||||||
|
name : Shape name. One of 円 / 四角形 / 三角形 / 五角形 /
|
||||||
|
六角形 / 星形 (English aliases circle, rect,
|
||||||
|
triangle, pentagon, hexagon, star are also accepted).
|
||||||
|
color : Fill color 0xRRGGBB.
|
||||||
|
size : Bounding size in pixels.
|
||||||
|
line : Outline width (optional). Omitted or 0 fills the
|
||||||
|
shape; a value at or above the size also fills it.
|
||||||
|
aspect : Distortion -1.0 ~ 1.0 (optional). Positive shrinks
|
||||||
|
the width, negative shrinks the height.
|
||||||
|
Example: obj.load("figure", "円", 0xff3366, 200)
|
||||||
|
* Only obj.load("figure", ...) is implemented. Other targets
|
||||||
|
(image files, "text", "tempbuffer", "movie", etc.) do nothing.
|
||||||
|
* Drawing scripts run on the MoonSharp engine.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- ymm4 Table -
|
- ymm4 Table -
|
||||||
@@ -495,10 +515,15 @@
|
|||||||
A deterministic integer random function compatible with AviUtl.
|
A deterministic integer random function compatible with AviUtl.
|
||||||
See "obj Table - Functions" for details.
|
See "obj Table - Functions" for details.
|
||||||
|
|
||||||
|
o Figure drawing
|
||||||
|
obj.load("figure", ...) generates a basic shape (circle, rectangle,
|
||||||
|
triangle, pentagon, hexagon, star) and replaces the object buffer
|
||||||
|
with it. See "obj Table - Functions" for details.
|
||||||
|
|
||||||
The following require integration with the rendering pipeline and are out of
|
The following require integration with the rendering pipeline and are out of
|
||||||
scope for this layer. Scripts that call them will not behave as intended.
|
scope for this layer. Scripts that call them will not behave as intended.
|
||||||
x Loading and drawing of images, figures, text and video
|
x Drawing and compositing (obj.draw / obj.drawpoly), obj.load targets
|
||||||
(obj.load / obj.draw / obj.drawpoly / obj.setfont, etc.)
|
other than "figure" (image files, "text", "movie", etc.) and obj.setfont
|
||||||
x Filter effects and buffer operations
|
x Filter effects and buffer operations
|
||||||
(obj.effect / obj.copybuffer / obj.setoption, etc.)
|
(obj.effect / obj.copybuffer / obj.setoption, etc.)
|
||||||
x Module loading via require, and file access such as io
|
x Module loading via require, and file access such as io
|
||||||
@@ -506,7 +531,7 @@
|
|||||||
|
|
||||||
- Unsupported Features / Limitations -
|
- Unsupported Features / Limitations -
|
||||||
|
|
||||||
x obj.effect(), obj.draw(), obj.drawpoly(), obj.load(), etc. from AviUtl2 are not supported.
|
x obj.effect(), obj.draw(), obj.drawpoly(), etc. from AviUtl2 are not supported (only obj.load("figure", ...) is supported; see "AviUtl Script Compatibility (Partial)").
|
||||||
x obj.rand1(), obj.setfont(), obj.mes(), etc. from AviUtl2 are not supported.
|
x obj.rand1(), obj.setfont(), obj.mes(), etc. from AviUtl2 are not supported.
|
||||||
x obj.setoption(), obj.getoption(), obj.getvalue(), obj.setanchor(), etc. from AviUtl2 are not supported.
|
x obj.setoption(), obj.getoption(), obj.getvalue(), obj.setanchor(), etc. from AviUtl2 are not supported.
|
||||||
x Functions such as scene.set() and scene.get() in the AviUtl2 scene table are not supported.
|
x Functions such as scene.set() and scene.get() in the AviUtl2 scene table are not supported.
|
||||||
|
|||||||
@@ -319,6 +319,26 @@
|
|||||||
Devuelve: Un entero dentro de st ~ ed
|
Devuelve: Un entero dentro de st ~ ed
|
||||||
Ejemplo: obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
Ejemplo: obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
||||||
|
|
||||||
|
o obj.load(target, ...)
|
||||||
|
Reemplaza el búfer del objeto con contenido generado.
|
||||||
|
En esta versión solo se admite el target "figure".
|
||||||
|
obj.load("figure", name, color, size [, line [, aspect]])
|
||||||
|
Genera una forma y reemplaza el búfer del objeto con ella
|
||||||
|
(la salida se redimensiona a la forma y se centra).
|
||||||
|
name : Nombre de la forma. Uno de 円 / 四角形 / 三角形 /
|
||||||
|
五角形 / 六角形 / 星形 (también se aceptan los alias
|
||||||
|
en inglés circle, rect, triangle, pentagon, hexagon, star).
|
||||||
|
color : Color de relleno 0xRRGGBB.
|
||||||
|
size : Tamaño base en píxeles.
|
||||||
|
line : Grosor del contorno (opcional). Omitido o 0 rellena la
|
||||||
|
forma; un valor igual o mayor que el tamaño también la rellena.
|
||||||
|
aspect : Distorsión -1.0 ~ 1.0 (opcional). Positivo reduce el
|
||||||
|
ancho, negativo reduce el alto.
|
||||||
|
Ejemplo: obj.load("figure", "円", 0xff3366, 200)
|
||||||
|
* Solo se implementa obj.load("figure", ...). Otros targets
|
||||||
|
(archivos de imagen, "text", "tempbuffer", "movie", etc.) no hacen nada.
|
||||||
|
* Los scripts de dibujo se ejecutan en el motor MoonSharp.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- ymm4 Table -
|
- ymm4 Table -
|
||||||
@@ -495,11 +515,16 @@
|
|||||||
Función de número aleatorio entero determinista compatible con AviUtl.
|
Función de número aleatorio entero determinista compatible con AviUtl.
|
||||||
Consulte "Tabla obj - Funciones" para más detalles.
|
Consulte "Tabla obj - Funciones" para más detalles.
|
||||||
|
|
||||||
|
o Dibujo de figuras
|
||||||
|
obj.load("figure", ...) genera una forma básica (círculo, rectángulo,
|
||||||
|
triángulo, pentágono, hexágono, estrella) y reemplaza el búfer del
|
||||||
|
objeto con ella. Consulte "Tabla obj - Funciones" para más detalles.
|
||||||
|
|
||||||
Lo siguiente requiere integración con la canalización de renderizado y, por
|
Lo siguiente requiere integración con la canalización de renderizado y, por
|
||||||
tanto, queda fuera del alcance de esta capa. Los scripts que lo llamen no se
|
tanto, queda fuera del alcance de esta capa. Los scripts que lo llamen no se
|
||||||
comportarán como se espera.
|
comportarán como se espera.
|
||||||
x Carga y dibujo de imágenes, figuras, texto y vídeo
|
x Dibujo y composición (obj.draw / obj.drawpoly), targets de obj.load
|
||||||
(obj.load / obj.draw / obj.drawpoly / obj.setfont, etc.)
|
distintos de "figure" (archivos de imagen, "text", "movie", etc.) y obj.setfont
|
||||||
x Efectos de filtro y operaciones de búfer
|
x Efectos de filtro y operaciones de búfer
|
||||||
(obj.effect / obj.copybuffer / obj.setoption, etc.)
|
(obj.effect / obj.copybuffer / obj.setoption, etc.)
|
||||||
x Carga de módulos mediante require y acceso a archivos como io
|
x Carga de módulos mediante require y acceso a archivos como io
|
||||||
@@ -507,7 +532,7 @@
|
|||||||
|
|
||||||
- Funciones no admitidas / Limitaciones -
|
- Funciones no admitidas / Limitaciones -
|
||||||
|
|
||||||
x obj.effect(), obj.draw(), obj.drawpoly(), obj.load(), etc. de AviUtl2 no son compatibles.
|
x obj.effect(), obj.draw(), obj.drawpoly(), etc. de AviUtl2 no son compatibles (solo se admite obj.load("figure", ...); consulte "Compatibilidad parcial con scripts de AviUtl").
|
||||||
x obj.rand1(), obj.setfont(), obj.mes(), etc. de AviUtl2 no son compatibles.
|
x obj.rand1(), obj.setfont(), obj.mes(), etc. de AviUtl2 no son compatibles.
|
||||||
x obj.setoption(), obj.getoption(), obj.getvalue(), obj.setanchor(), etc. de AviUtl2 no son compatibles.
|
x obj.setoption(), obj.getoption(), obj.getvalue(), obj.setanchor(), etc. de AviUtl2 no son compatibles.
|
||||||
x Las funciones como scene.set() y scene.get() de la tabla scene de AviUtl2 no son compatibles.
|
x Las funciones como scene.set() y scene.get() de la tabla scene de AviUtl2 no son compatibles.
|
||||||
|
|||||||
@@ -317,6 +317,26 @@
|
|||||||
Hasil : Bilangan bulat dalam st ~ ed
|
Hasil : Bilangan bulat dalam st ~ ed
|
||||||
Contoh: obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
Contoh: obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
||||||
|
|
||||||
|
o obj.load(target, ...)
|
||||||
|
Mengganti buffer objek dengan konten yang dihasilkan.
|
||||||
|
Pada versi ini hanya target "figure" yang didukung.
|
||||||
|
obj.load("figure", name, color, size [, line [, aspect]])
|
||||||
|
Menghasilkan sebuah bentuk dan mengganti buffer objek dengannya
|
||||||
|
(output diubah ukurannya sesuai bentuk dan dipusatkan).
|
||||||
|
name : Nama bentuk. Salah satu dari 円 / 四角形 / 三角形 /
|
||||||
|
五角形 / 六角形 / 星形 (alias Inggris circle, rect,
|
||||||
|
triangle, pentagon, hexagon, star juga diterima).
|
||||||
|
color : Warna isi 0xRRGGBB.
|
||||||
|
size : Ukuran dasar dalam piksel.
|
||||||
|
line : Lebar garis tepi (opsional). Dihilangkan atau 0 mengisi
|
||||||
|
bentuk; nilai sama atau lebih besar dari ukuran juga mengisinya.
|
||||||
|
aspect : Distorsi -1.0 ~ 1.0 (opsional). Positif mengecilkan
|
||||||
|
lebar, negatif mengecilkan tinggi.
|
||||||
|
Contoh: obj.load("figure", "円", 0xff3366, 200)
|
||||||
|
* Hanya obj.load("figure", ...) yang diimplementasikan. Target lain
|
||||||
|
(berkas gambar, "text", "tempbuffer", "movie", dll.) tidak melakukan apa pun.
|
||||||
|
* Skrip penggambaran dijalankan pada mesin MoonSharp.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- ymm4 Table -
|
- ymm4 Table -
|
||||||
@@ -492,11 +512,16 @@
|
|||||||
Fungsi bilangan acak bulat deterministik yang kompatibel dengan AviUtl.
|
Fungsi bilangan acak bulat deterministik yang kompatibel dengan AviUtl.
|
||||||
Lihat "Tabel obj - Fungsi" untuk detailnya.
|
Lihat "Tabel obj - Fungsi" untuk detailnya.
|
||||||
|
|
||||||
|
o Penggambaran figur
|
||||||
|
obj.load("figure", ...) menghasilkan bentuk dasar (lingkaran, persegi,
|
||||||
|
segitiga, segilima, segienam, bintang) dan mengganti buffer objek
|
||||||
|
dengannya. Lihat "Tabel obj - Fungsi" untuk detailnya.
|
||||||
|
|
||||||
Berikut ini memerlukan integrasi dengan pipeline render sehingga berada di
|
Berikut ini memerlukan integrasi dengan pipeline render sehingga berada di
|
||||||
luar cakupan lapisan ini. Skrip yang memanggilnya tidak akan berperilaku
|
luar cakupan lapisan ini. Skrip yang memanggilnya tidak akan berperilaku
|
||||||
seperti yang diharapkan.
|
seperti yang diharapkan.
|
||||||
x Pemuatan dan penggambaran gambar, figur, teks, dan video
|
x Penggambaran dan komposisi (obj.draw / obj.drawpoly), target obj.load
|
||||||
(obj.load / obj.draw / obj.drawpoly / obj.setfont, dll.)
|
selain "figure" (berkas gambar, "text", "movie", dll.) dan obj.setfont
|
||||||
x Efek filter dan operasi buffer
|
x Efek filter dan operasi buffer
|
||||||
(obj.effect / obj.copybuffer / obj.setoption, dll.)
|
(obj.effect / obj.copybuffer / obj.setoption, dll.)
|
||||||
x Pemuatan modul melalui require, dan akses file seperti io
|
x Pemuatan modul melalui require, dan akses file seperti io
|
||||||
@@ -504,7 +529,7 @@
|
|||||||
|
|
||||||
- Fitur yang Tidak Didukung / Batasan -
|
- Fitur yang Tidak Didukung / Batasan -
|
||||||
|
|
||||||
x obj.effect(), obj.draw(), obj.drawpoly(), obj.load(), dll. dari AviUtl2 tidak didukung.
|
x obj.effect(), obj.draw(), obj.drawpoly(), dll. dari AviUtl2 tidak didukung (hanya obj.load("figure", ...) yang didukung; lihat "Kompatibilitas Parsial Skrip AviUtl").
|
||||||
x obj.rand1(), obj.setfont(), obj.mes(), dll. dari AviUtl2 tidak didukung.
|
x obj.rand1(), obj.setfont(), obj.mes(), dll. dari AviUtl2 tidak didukung.
|
||||||
x obj.setoption(), obj.getoption(), obj.getvalue(), obj.setanchor(), dll. dari AviUtl2 tidak didukung.
|
x obj.setoption(), obj.getoption(), obj.getvalue(), obj.setanchor(), dll. dari AviUtl2 tidak didukung.
|
||||||
x Fungsi seperti scene.set() dan scene.get() dalam tabel scene AviUtl2 tidak didukung.
|
x Fungsi seperti scene.set() dan scene.get() dalam tabel scene AviUtl2 tidak didukung.
|
||||||
|
|||||||
@@ -316,6 +316,25 @@
|
|||||||
戻り値 : st ~ ed の整数
|
戻り値 : st ~ ed の整数
|
||||||
例:obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
例:obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
||||||
|
|
||||||
|
○obj.load(対象, ...)
|
||||||
|
オブジェクトのバッファを生成した内容に置き換えます。
|
||||||
|
本バージョンでは "figure"(図形)のみ対応します。
|
||||||
|
obj.load("figure", 名前, 色, サイズ [, ライン [, アスペクト]])
|
||||||
|
図形を生成してオブジェクトのバッファを置き換えます
|
||||||
|
(出力は図形サイズに合わせて生成され、中心に配置されます)。
|
||||||
|
名前 : 図形名。円 / 四角形 / 三角形 / 五角形 / 六角形 /
|
||||||
|
星形 のいずれか(英語名 circle, rect, triangle,
|
||||||
|
pentagon, hexagon, star も使用可)。
|
||||||
|
色 : 塗り色 0xRRGGBB。
|
||||||
|
サイズ : 図形の基準サイズ(ピクセル)。
|
||||||
|
ライン : 輪郭の太さ(省略可)。省略または 0 で塗りつぶし。
|
||||||
|
サイズ以上の値を指定した場合も塗りつぶしになります。
|
||||||
|
アスペクト: 歪曲 -1.0 ~ 1.0(省略可)。正で横幅、負で縦幅が縮みます。
|
||||||
|
例:obj.load("figure", "円", 0xff3366, 200)
|
||||||
|
※ 実装されているのは obj.load("figure", ...) のみです。画像ファイルや
|
||||||
|
"text"・"tempbuffer"・"movie" 等の対象は何も行いません。
|
||||||
|
※ 描画系スクリプトは従来エンジン(MoonSharp)で実行されます。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- ymm4 テーブル -
|
- ymm4 テーブル -
|
||||||
@@ -488,10 +507,15 @@
|
|||||||
AviUtl 互換の決定論的な整数乱数です。詳細は「obj テーブル - 関数」を
|
AviUtl 互換の決定論的な整数乱数です。詳細は「obj テーブル - 関数」を
|
||||||
参照してください。
|
参照してください。
|
||||||
|
|
||||||
|
○図形描画
|
||||||
|
obj.load("figure", ...) で円・四角形・三角形・五角形・六角形・星形を
|
||||||
|
生成し、オブジェクトのバッファを置き換えます。詳細は「obj テーブル -
|
||||||
|
関数」を参照してください。
|
||||||
|
|
||||||
次の機能は本体の描画パイプラインへの統合を要するため、この互換層では対象外です。
|
次の機能は本体の描画パイプラインへの統合を要するため、この互換層では対象外です。
|
||||||
これらを呼び出すスクリプトは意図どおりには動作しません。
|
これらを呼び出すスクリプトは意図どおりには動作しません。
|
||||||
×画像・図形・テキスト・動画の読み込みと描画
|
×描画・合成(obj.draw / obj.drawpoly)、obj.load の "figure" 以外の対象
|
||||||
(obj.load / obj.draw / obj.drawpoly / obj.setfont など)
|
(画像ファイル・"text"・"movie" 等)、および obj.setfont
|
||||||
×フィルタ効果やバッファ操作
|
×フィルタ効果やバッファ操作
|
||||||
(obj.effect / obj.copybuffer / obj.setoption など)
|
(obj.effect / obj.copybuffer / obj.setoption など)
|
||||||
×require によるモジュール読み込み、io などのファイルアクセス
|
×require によるモジュール読み込み、io などのファイルアクセス
|
||||||
@@ -499,7 +523,7 @@
|
|||||||
|
|
||||||
- 非対応・制限事項 -
|
- 非対応・制限事項 -
|
||||||
|
|
||||||
×AviUtl2 の obj.effect(), obj.draw(), obj.drawpoly(), obj.load() 等には対応していません。
|
×AviUtl2 の obj.effect(), obj.draw(), obj.drawpoly() 等には対応していません(obj.load は "figure" のみ対応。「AviUtl スクリプトの部分互換」を参照)。
|
||||||
×AviUtl2 の obj.rand1(), obj.setfont(), obj.mes() 等には対応していません。
|
×AviUtl2 の obj.rand1(), obj.setfont(), obj.mes() 等には対応していません。
|
||||||
×AviUtl2 の obj.setoption(), obj.getoption(), obj.getvalue(), obj.setanchor() 等には対応していません。
|
×AviUtl2 の obj.setoption(), obj.getoption(), obj.getvalue(), obj.setanchor() 等には対応していません。
|
||||||
×AviUtl2 の scene テーブルの scene.set(), scene.get() 等の関数には対応していません。
|
×AviUtl2 の scene テーブルの scene.set(), scene.get() 等の関数には対応していません。
|
||||||
|
|||||||
@@ -312,6 +312,25 @@
|
|||||||
반환값 : st ~ ed의 정수
|
반환값 : st ~ ed의 정수
|
||||||
예: obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
예: obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
||||||
|
|
||||||
|
○ obj.load(대상, ...)
|
||||||
|
오브젝트 버퍼를 생성한 내용으로 교체합니다.
|
||||||
|
이 버전에서는 "figure"(도형)만 지원합니다.
|
||||||
|
obj.load("figure", 이름, 색, 크기 [, 라인 [, 종횡비]])
|
||||||
|
도형을 생성하여 오브젝트 버퍼를 교체합니다
|
||||||
|
(출력은 도형 크기에 맞춰 생성되고 중심에 배치됩니다).
|
||||||
|
이름 : 도형 이름. 円 / 四角形 / 三角形 / 五角形 / 六角形 /
|
||||||
|
星形 중 하나(영어 circle, rect, triangle,
|
||||||
|
pentagon, hexagon, star 도 사용 가능).
|
||||||
|
색 : 채움 색 0xRRGGBB.
|
||||||
|
크기 : 도형의 기준 크기(픽셀).
|
||||||
|
라인 : 외곽선 두께(생략 가능). 생략 또는 0이면 채움.
|
||||||
|
크기 이상의 값을 지정한 경우에도 채움이 됩니다.
|
||||||
|
종횡비 : 왜곡 -1.0 ~ 1.0(생략 가능). 양수는 너비, 음수는 높이를 줄입니다.
|
||||||
|
예: obj.load("figure", "円", 0xff3366, 200)
|
||||||
|
※ 구현된 것은 obj.load("figure", ...) 뿐입니다. 이미지 파일,
|
||||||
|
"text"・"tempbuffer"・"movie" 등의 대상은 아무것도 하지 않습니다.
|
||||||
|
※ 그리기 계열 스크립트는 MoonSharp 엔진에서 실행됩니다.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- ymm4 테이블 -
|
- ymm4 테이블 -
|
||||||
@@ -484,10 +503,15 @@
|
|||||||
AviUtl 호환의 결정론적 정수 난수입니다. 자세한 내용은
|
AviUtl 호환의 결정론적 정수 난수입니다. 자세한 내용은
|
||||||
"obj 테이블 - 함수"를 참조하세요.
|
"obj 테이블 - 함수"를 참조하세요.
|
||||||
|
|
||||||
|
○ 도형 그리기
|
||||||
|
obj.load("figure", ...) 로 원·사각형·삼각형·오각형·육각형·별형을
|
||||||
|
생성하여 오브젝트 버퍼를 교체합니다. 자세한 내용은
|
||||||
|
"obj 테이블 - 함수"를 참조하세요.
|
||||||
|
|
||||||
다음 기능은 본체의 렌더링 파이프라인과의 통합이 필요하므로 이 호환
|
다음 기능은 본체의 렌더링 파이프라인과의 통합이 필요하므로 이 호환
|
||||||
계층의 범위 밖입니다. 이를 호출하는 스크립트는 의도대로 동작하지 않습니다.
|
계층의 범위 밖입니다. 이를 호출하는 스크립트는 의도대로 동작하지 않습니다.
|
||||||
× 이미지·도형·텍스트·동영상의 로드 및 그리기
|
× 그리기·합성(obj.draw / obj.drawpoly), obj.load의 "figure" 이외 대상
|
||||||
(obj.load / obj.draw / obj.drawpoly / obj.setfont 등)
|
(이미지 파일·"text"・"movie" 등), 그리고 obj.setfont
|
||||||
× 필터 효과 및 버퍼 조작
|
× 필터 효과 및 버퍼 조작
|
||||||
(obj.effect / obj.copybuffer / obj.setoption 등)
|
(obj.effect / obj.copybuffer / obj.setoption 등)
|
||||||
× require에 의한 모듈 로드 및 io 등의 파일 접근
|
× require에 의한 모듈 로드 및 io 등의 파일 접근
|
||||||
@@ -495,7 +519,7 @@
|
|||||||
|
|
||||||
- 미지원·제한 사항 -
|
- 미지원·제한 사항 -
|
||||||
|
|
||||||
× AviUtl2의 obj.effect(), obj.draw(), obj.drawpoly(), obj.load() 등은 지원하지 않습니다.
|
× AviUtl2의 obj.effect(), obj.draw(), obj.drawpoly() 등은 지원하지 않습니다(obj.load은 "figure"만 지원. "AviUtl 스크립트 부분 호환" 참조).
|
||||||
× AviUtl2의 obj.rand1(), obj.setfont(), obj.mes() 등은 지원하지 않습니다.
|
× AviUtl2의 obj.rand1(), obj.setfont(), obj.mes() 등은 지원하지 않습니다.
|
||||||
× AviUtl2의 obj.setoption(), obj.getoption(), obj.getvalue(), obj.setanchor() 등은 지원하지 않습니다.
|
× AviUtl2의 obj.setoption(), obj.getoption(), obj.getvalue(), obj.setanchor() 등은 지원하지 않습니다.
|
||||||
× AviUtl2의 scene 테이블의 scene.set(), scene.get() 등의 함수는 지원하지 않습니다.
|
× AviUtl2의 scene 테이블의 scene.set(), scene.get() 등의 함수는 지원하지 않습니다.
|
||||||
|
|||||||
@@ -310,6 +310,24 @@
|
|||||||
返回值 : st ~ ed 的整数
|
返回值 : st ~ ed 的整数
|
||||||
示例:obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
示例:obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
||||||
|
|
||||||
|
○ obj.load(目标, ...)
|
||||||
|
将对象缓冲区替换为生成的内容。本版本仅支持 "figure"(图形)。
|
||||||
|
obj.load("figure", 名称, 颜色, 大小 [, 线宽 [, 纵横比]])
|
||||||
|
生成图形并替换对象缓冲区
|
||||||
|
(输出按图形大小生成并居中)。
|
||||||
|
名称 : 图形名。円 / 四角形 / 三角形 / 五角形 / 六角形 /
|
||||||
|
星形 之一(也可用英文 circle, rect, triangle,
|
||||||
|
pentagon, hexagon, star)。
|
||||||
|
颜色 : 填充色 0xRRGGBB。
|
||||||
|
大小 : 图形基准大小(像素)。
|
||||||
|
线宽 : 轮廓宽度(可省略)。省略或 0 为填充;
|
||||||
|
指定大于等于大小的值时也为填充。
|
||||||
|
纵横比 : 变形 -1.0 ~ 1.0(可省略)。正值缩小宽度,负值缩小高度。
|
||||||
|
示例:obj.load("figure", "円", 0xff3366, 200)
|
||||||
|
* 仅实现了 obj.load("figure", ...)。图像文件、"text"、"tempbuffer"、
|
||||||
|
"movie" 等目标不执行任何操作。
|
||||||
|
* 绘制类脚本在 MoonSharp 引擎上运行。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- ymm4 表 -
|
- ymm4 表 -
|
||||||
@@ -477,10 +495,14 @@
|
|||||||
○ obj.rand(st, ed [, seed [, frame]])
|
○ obj.rand(st, ed [, seed [, frame]])
|
||||||
与 AviUtl 兼容的确定性整数随机数。详情请参阅“obj 表 - 函数”。
|
与 AviUtl 兼容的确定性整数随机数。详情请参阅“obj 表 - 函数”。
|
||||||
|
|
||||||
|
○ 图形绘制
|
||||||
|
obj.load("figure", ...) 生成圆、四角形、三角形、五角形、六角形、星形,
|
||||||
|
并替换对象缓冲区。详情请参阅“obj 表 - 函数”。
|
||||||
|
|
||||||
以下功能需要与本体的绘制管线集成,因此不在此兼容层的范围内。
|
以下功能需要与本体的绘制管线集成,因此不在此兼容层的范围内。
|
||||||
调用它们的脚本不会按预期运行。
|
调用它们的脚本不会按预期运行。
|
||||||
× 图像、图形、文本、视频的加载与绘制
|
× 绘制与合成(obj.draw / obj.drawpoly)、obj.load 的 "figure" 以外目标
|
||||||
(obj.load / obj.draw / obj.drawpoly / obj.setfont 等)
|
(图像文件、"text"、"movie" 等),以及 obj.setfont
|
||||||
× 滤镜效果与缓冲区操作
|
× 滤镜效果与缓冲区操作
|
||||||
(obj.effect / obj.copybuffer / obj.setoption 等)
|
(obj.effect / obj.copybuffer / obj.setoption 等)
|
||||||
× 通过 require 加载模块,以及 io 等文件访问
|
× 通过 require 加载模块,以及 io 等文件访问
|
||||||
@@ -488,7 +510,7 @@
|
|||||||
|
|
||||||
- 不支持项目·限制事项 -
|
- 不支持项目·限制事项 -
|
||||||
|
|
||||||
× 不支持 AviUtl2 的 obj.effect()、obj.draw()、obj.drawpoly()、obj.load() 等。
|
× 不支持 AviUtl2 的 obj.effect()、obj.draw()、obj.drawpoly() 等(obj.load 仅支持 "figure",参阅“AviUtl 脚本的部分兼容”)。
|
||||||
× 不支持 AviUtl2 的 obj.rand1()、obj.setfont()、obj.mes() 等。
|
× 不支持 AviUtl2 的 obj.rand1()、obj.setfont()、obj.mes() 等。
|
||||||
× 不支持 AviUtl2 的 obj.setoption()、obj.getoption()、obj.getvalue()、obj.setanchor() 等。
|
× 不支持 AviUtl2 的 obj.setoption()、obj.getoption()、obj.getvalue()、obj.setanchor() 等。
|
||||||
× 不支持 AviUtl2 scene 表中的 scene.set()、scene.get() 等函数。
|
× 不支持 AviUtl2 scene 表中的 scene.set()、scene.get() 等函数。
|
||||||
|
|||||||
@@ -310,6 +310,24 @@
|
|||||||
回傳值 : st ~ ed 的整數
|
回傳值 : st ~ ed 的整數
|
||||||
範例:obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
範例:obj.ox = obj.ox + obj.rand(-10, 10, 1, obj.frame)
|
||||||
|
|
||||||
|
○ obj.load(目標, ...)
|
||||||
|
將物件緩衝區替換為產生的內容。本版本僅支援 "figure"(圖形)。
|
||||||
|
obj.load("figure", 名稱, 顏色, 大小 [, 線寬 [, 長寬比]])
|
||||||
|
產生圖形並替換物件緩衝區
|
||||||
|
(輸出依圖形大小產生並置中)。
|
||||||
|
名稱 : 圖形名。円 / 四角形 / 三角形 / 五角形 / 六角形 /
|
||||||
|
星形 之一(亦可用英文 circle, rect, triangle,
|
||||||
|
pentagon, hexagon, star)。
|
||||||
|
顏色 : 填滿色 0xRRGGBB。
|
||||||
|
大小 : 圖形基準大小(像素)。
|
||||||
|
線寬 : 輪廓寬度(可省略)。省略或 0 為填滿;
|
||||||
|
指定大於等於大小的值時亦為填滿。
|
||||||
|
長寬比 : 變形 -1.0 ~ 1.0(可省略)。正值縮小寬度,負值縮小高度。
|
||||||
|
範例:obj.load("figure", "円", 0xff3366, 200)
|
||||||
|
* 僅實作了 obj.load("figure", ...)。影像檔、"text"、"tempbuffer"、
|
||||||
|
"movie" 等目標不執行任何動作。
|
||||||
|
* 繪製類腳本在 MoonSharp 引擎上執行。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- ymm4 表 -
|
- ymm4 表 -
|
||||||
@@ -477,10 +495,14 @@
|
|||||||
○ obj.rand(st, ed [, seed [, frame]])
|
○ obj.rand(st, ed [, seed [, frame]])
|
||||||
與 AviUtl 相容的確定性整數亂數。詳情請參閱「obj 表 - 函式」。
|
與 AviUtl 相容的確定性整數亂數。詳情請參閱「obj 表 - 函式」。
|
||||||
|
|
||||||
|
○ 圖形繪製
|
||||||
|
obj.load("figure", ...) 產生圓、四角形、三角形、五角形、六角形、星形,
|
||||||
|
並替換物件緩衝區。詳情請參閱「obj 表 - 函式」。
|
||||||
|
|
||||||
以下功能需要與本體的繪製管線整合,因此不在此相容層的範圍內。
|
以下功能需要與本體的繪製管線整合,因此不在此相容層的範圍內。
|
||||||
呼叫它們的腳本不會如預期運作。
|
呼叫它們的腳本不會如預期運作。
|
||||||
× 影像、圖形、文字、影片的載入與繪製
|
× 繪製與合成(obj.draw / obj.drawpoly)、obj.load 的 "figure" 以外目標
|
||||||
(obj.load / obj.draw / obj.drawpoly / obj.setfont 等)
|
(影像檔、"text"、"movie" 等),以及 obj.setfont
|
||||||
× 濾鏡效果與緩衝區操作
|
× 濾鏡效果與緩衝區操作
|
||||||
(obj.effect / obj.copybuffer / obj.setoption 等)
|
(obj.effect / obj.copybuffer / obj.setoption 等)
|
||||||
× 透過 require 載入模組,以及 io 等檔案存取
|
× 透過 require 載入模組,以及 io 等檔案存取
|
||||||
@@ -488,7 +510,7 @@
|
|||||||
|
|
||||||
- 不支援項目·限制事項 -
|
- 不支援項目·限制事項 -
|
||||||
|
|
||||||
× 不支援 AviUtl2 的 obj.effect()、obj.draw()、obj.drawpoly()、obj.load() 等。
|
× 不支援 AviUtl2 的 obj.effect()、obj.draw()、obj.drawpoly() 等(obj.load 僅支援 "figure",參閱「AviUtl 腳本的部分相容」)。
|
||||||
× 不支援 AviUtl2 的 obj.rand1()、obj.setfont()、obj.mes() 等。
|
× 不支援 AviUtl2 的 obj.rand1()、obj.setfont()、obj.mes() 等。
|
||||||
× 不支援 AviUtl2 的 obj.setoption()、obj.getoption()、obj.getvalue()、obj.setanchor() 等。
|
× 不支援 AviUtl2 的 obj.setoption()、obj.getoption()、obj.getvalue()、obj.setanchor() 等。
|
||||||
× 不支援 AviUtl2 scene 表中的 scene.set()、scene.get() 等函式。
|
× 不支援 AviUtl2 scene 表中的 scene.set()、scene.get() 等函式。
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ YukkuriMovieMaker4(YMM4)上で動作する、**Luaスクリプトでオブ
|
|||||||
|
|
||||||
### 9. AviUtl スクリプトの部分互換
|
### 9. AviUtl スクリプトの部分互換
|
||||||
|
|
||||||
AviUtl のアニメーション効果スクリプト(`.anm` 系)のうち、座標・拡縮・回転・不透明度の変形と乱数を用いる範囲について、追加の記述変更なしに実行できる互換層を備えています。スクリプトに AviUtl 固有の記法が含まれない場合、この互換層は一切介入しません(従来のスクリプトの挙動は変わりません)。
|
AviUtl のアニメーション効果スクリプト(`.anm` 系)のうち、座標・拡縮・回転・不透明度の変形、乱数、および図形描画について、追加の記述変更なしに実行できる互換層を備えています。スクリプトに AviUtl 固有の記法が含まれない場合、この互換層は一切介入しません(従来のスクリプトの挙動は変わりません)。
|
||||||
|
|
||||||
対応している内容は次のとおりです。
|
対応している内容は次のとおりです。
|
||||||
|
|
||||||
@@ -203,10 +203,11 @@ AviUtl のアニメーション効果スクリプト(`.anm` 系)のうち、
|
|||||||
- `--track0:`〜`--track3:` … トラックバーの値は従来どおり `obj.track0`〜`obj.track3` から参照します(ラベル・範囲・既定値の UI 反映は行いません)。
|
- `--track0:`〜`--track3:` … トラックバーの値は従来どおり `obj.track0`〜`obj.track3` から参照します(ラベル・範囲・既定値の UI 反映は行いません)。
|
||||||
- **`@` による複数セクション**: 1 つのスクリプトに `@名前` で複数の効果が定義されている場合、先頭のセクションのみを実行します。
|
- **`@` による複数セクション**: 1 つのスクリプトに `@名前` で複数の効果が定義されている場合、先頭のセクションのみを実行します。
|
||||||
- **`obj.rand(st, ed [, seed [, frame]])`**: 指定範囲(`st`〜`ed`)の整数を返す決定論的な乱数です。`seed` と `frame` が同じであれば常に同じ値を返し、`frame` を省略すると現在のフレームを用います。従来エンジン(MoonSharp)と高速ランタイム(LuaJIT)で同じ値を返します。
|
- **`obj.rand(st, ed [, seed [, frame]])`**: 指定範囲(`st`〜`ed`)の整数を返す決定論的な乱数です。`seed` と `frame` が同じであれば常に同じ値を返し、`frame` を省略すると現在のフレームを用います。従来エンジン(MoonSharp)と高速ランタイム(LuaJIT)で同じ値を返します。
|
||||||
|
- **`obj.load("figure", 名前, 色, サイズ [, ライン [, アスペクト]])`**: 円・四角形・三角形・五角形・六角形・星形を生成し、オブジェクトのバッファを置き換えて描画します(出力は図形サイズに合わせて生成され、中心に配置されます)。`ライン` を省略するか `0` で塗りつぶし、サイズ以上の値でも塗りつぶしになります。`アスペクト`(-1.0〜1.0)で幅・高さを歪曲できます。`figure` 以外の対象は本バージョンでは対象外です。描画系 API を含むスクリプトは従来エンジン(MoonSharp)で実行されます。
|
||||||
|
|
||||||
次のような機能は、本体の描画パイプラインへの統合を要するため、この互換層では対象外です(呼び出しを含むスクリプトは意図どおりには動作しません)。
|
次のような機能は、本体の描画パイプラインへの統合を要するため、この互換層では対象外です(呼び出しを含むスクリプトは意図どおりには動作しません)。
|
||||||
|
|
||||||
- 画像・図形・テキスト・動画の読み込みと描画(`obj.load` / `obj.draw` / `obj.drawpoly` / `obj.setfont` など)
|
- 描画・合成(`obj.draw` / `obj.drawpoly`)、`obj.load` の `"figure"` 以外の対象(画像ファイル・`"text"`・`"movie"` など)、および `obj.setfont`
|
||||||
- フィルタ効果やバッファ操作(`obj.effect` / `obj.copybuffer` / `obj.setoption` など)
|
- フィルタ効果やバッファ操作(`obj.effect` / `obj.copybuffer` / `obj.setoption` など)
|
||||||
- `require` によるモジュール読み込み、`io` などのファイルアクセス
|
- `require` によるモジュール読み込み、`io` などのファイルアクセス
|
||||||
|
|
||||||
|
|||||||
新しいイシューから参照
ユーザーをブロックする