Skip to content

Commit 0289e8a

Browse files
authored
Merge pull request #1 from korarei/feature/aviutl2-support
Feature: AviUtl2 support
2 parents 28356aa + 7d53906 commit 0289e8a

File tree

4 files changed

+174
-12
lines changed

4 files changed

+174
-12
lines changed

.github/workflows/releaser.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,24 @@ jobs:
1818
with:
1919
fetch-depth: 0
2020

21-
- name: Create zip file
21+
- name: Create zip file (aviutl)
2222
run: |
23-
git ls-files | grep -vE ".gitattributes|.github" | zip -q -@ GrungeConverter_${{ github.ref_name }}.zip
23+
cp *.md script_aviutl
24+
cp LICENSE script_aviutl
25+
zip -r -q -@ GrungeConverter_${{ github.ref_name }}_AviUtl.zip ./script_aviutl
26+
27+
- name: Create zip file (aviutl2)
28+
run: |
29+
cp *.md script_aviutl2
30+
cp LICENSE script_aviutl2
31+
zip -r -q -@ GrungeConverter_${{ github.ref_name }}_AviUtl2.zip ./script_aviutl2
2432
2533
- name: Create release note
2634
run: |
2735
count=0
2836
IFS=$'\n'
2937
while read line; do
30-
if [ ${count} = 0 ] && [[ ${line} =~ "更新履歴" ]]; then
38+
if [ ${count} = 0 ] && [[ ${line} =~ "Change Log" ]]; then
3139
count=1
3240
elif [ ${count} = 1 ] && [[ ${line} =~ "*v" ]]; then
3341
count=2
@@ -42,5 +50,7 @@ jobs:
4250
uses: softprops/action-gh-release@v2
4351
with:
4452
name: GrungeConverter_${{ github.ref_name }}
45-
files: '*.zip'
53+
files: |
54+
*_AviUtl.zip
55+
*_AviUtl2.zip
4656
body_path: ReleaseNote.txt

README.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,30 @@
22
画像をグランジ素材に変換することができるAviUtlトラックバースクリプト
33

44
## 導入・削除
5-
### 導入
5+
### AviUtl
6+
[Releases](https://github.com/korarei/AviUtl_GrungeConverter_Script/releases)のGrungeConverter_vx.x.x_AviUtl.zipをDLする。
7+
8+
#### 導入
69
1. 同梱の.anmファイルをscriptフォルダまたはその子フォルダに入れる。
7-
### 削除
10+
11+
#### 削除
812
1. 同梱の.anmファイルを導入したフォルダから出す。
913

10-
## はじめに
14+
### AviUtl2
15+
[Releases](https://github.com/korarei/AviUtl_GrungeConverter_Script/releases)のGrungeConverter_vx.x.x_AviUtl2.zipをDLする。
16+
17+
#### 導入
18+
1. 同梱の.anmファイルを`C:\ProgramData\aviutl2\Script`フォルダまたはその子フォルダに入れる。
19+
20+
#### 削除
21+
1. 同梱の.anmファイルを導入したフォルダから出す。
22+
23+
## はじめに (AviUtlユーザ向け)
1124
LuaJITとpatch.aulの導入を推奨する。
1225

13-
LuaJIT DLhttps://github.com/Per-Terra/LuaJIT-Auto-Builds
26+
- [LuaJIT DL](https://github.com/Per-Terra/LuaJIT-Auto-Builds)
1427

15-
patch.aul DLhttps://scrapbox.io/nazosauna/patch.aul
28+
- [patch.aul DL](ttps://scrapbox.io/nazosauna/patch.aul)
1629

1730
## 簡単な使い方
1831
画像を読み込ませてそれにこのアニメーション効果をかける。
@@ -24,6 +37,9 @@ patch.aul DL:https://scrapbox.io/nazosauna/patch.aul
2437
## LICENSE
2538
LICENSEファイルに記載
2639

27-
## 更新履歴
40+
## Change Log
41+
- **v1.0.1**
42+
- AviUtl2に対応
43+
2844
- **v1.0.0**
29-
- リリース
45+
- Release
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ elseif check_binarization then
126126
end
127127
end)
128128
if not chk then
129-
setfont("游ゴシック",50)
129+
obj.setfont("游ゴシック", 50)
130130
obj.load("text", "[GrungeConverter.anm]\n"..mes)
131131
obj.draw()
132132
error("[GrungeConverter.anm]"..mes)
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
--[[
2+
GrungeConverter.anm
3+
グランジ素材に変換するアニメーションスクリプト
4+
5+
使い方:https://scrapbox.io/korarei/GrungeConverter
6+
7+
by Korarei
8+
]]--
9+
10+
--label:Process
11+
--information:GrungeConverter v1.0.1
12+
13+
--track0:Width,-1,4000,-1,1
14+
--track1:Height,-1,4000,-1,1
15+
--track2:Speed,0,1000,10,1
16+
--track3:Threshold,0.0,1.0,0.5,0.001
17+
--check0:Mix BG,1
18+
--color@_1:Color,0xffffff
19+
--color@_2:BG Color,0x000000
20+
--check@_3:Invert Y,1
21+
--track@_4:Num,1,100,2,1
22+
--track@_5:DX [%],0.0,200.0,100.0,0.001
23+
--track@_6:DY [%],0.0,200.0,100.0,0.001
24+
--value@_7:DZ [px],{-900,-700}
25+
--value@_8:DR [°],{-180,180}
26+
--check@_9:Random Flip,1
27+
--track@_10:Seed,-10000,10000,-1,1
28+
--check@_11:Adjustment,1
29+
30+
--[[pixelshader@thresholding:
31+
Texture2D texture0 : register(t0);
32+
cbuffer constant0 : register(b0) {
33+
float threshold;
34+
float col1;
35+
float col2;
36+
float col2_a;
37+
};
38+
float4 decode_col(float rgb, float a) {
39+
uint col = (uint)rgb;
40+
float r = ((col >> 16) & 0xFF) / 255.0;
41+
float g = ((col >> 8) & 0xFF) / 255.0;
42+
float b = (col & 0xFF) / 255.0;
43+
return float4(r*a, g*a, b*a, a);
44+
};
45+
float4 thresholding(float4 pos : SV_Position) : SV_Target {
46+
float4 col = texture0[int2(pos.xy)];
47+
float mask = step(threshold, col.r);
48+
return lerp(decode_col(col2, col2_a), decode_col(col1, 1.0), mask);
49+
}
50+
]]
51+
52+
local chk, mes = pcall(function()
53+
local w, h = obj.getpixel()
54+
if w * h == 0 then
55+
return
56+
end
57+
--大きさが0なら以下の処理しない
58+
local floor = math.floor
59+
60+
local width = obj.track0 == -1 and obj.screen_w or obj.track0
61+
local height = obj.track1 == -1 and obj.screen_h or obj.track1
62+
local sp = obj.track2
63+
local threshold = obj.track3
64+
local check_background = obj.check0
65+
local col = _1 _1 = nil
66+
local col2 = _2 _2 = nil
67+
local check_brightness = _3 == 1 _3 = nil
68+
local n = floor(_4) _4 = nil
69+
local dx = {- width * _5 / 200, width * _5 / 200} _5 = nil
70+
local dy = {- height * _6 / 200, height * _6 / 200} _6 = nil
71+
local dz = _7 _7 = nil
72+
local dr = _8 _8 = nil
73+
local check_mirror = _9 == 1 _9 = nil
74+
local seed = _10 _10 = nil
75+
local check_thresholding = _11 == 1 _11 = nil
76+
if dz[3] then
77+
error("The table has too many elements. Please remove the 3rd and subsequent elements.")
78+
elseif dz[2] == nil then
79+
error("The table does not have a 2nd element.")
80+
end
81+
if dr[3] then
82+
error("The table has too many elements. Please remove the 3rd and subsequent elements.")
83+
elseif dr[2] == nil then
84+
error("The table does not have a 2nd element.")
85+
end
86+
87+
if n == 0 then
88+
return
89+
end
90+
91+
--透過
92+
local alpha_type = 0
93+
if check_brightness then
94+
alpha_type = 1
95+
threshold = 1.0 - threshold
96+
end
97+
obj.effect("ルミナンスキー", "基準輝度", floor(4096 * threshold), "ぼかし", 0, "type", alpha_type)
98+
obj.effect("単色化", "強さ", 100, "color", check_thresholding and 0xffffff or col, "輝度を保持する", 0)
99+
obj.copybuffer("cache:processed", "obj")
100+
--乱数生成
101+
local frame = sp == 0 and 0 or floor(obj.frame / sp)
102+
103+
local function rand(st, ed)
104+
seed = seed < 0 and seed - 1 or seed + 1
105+
return obj.rand(st, ed, seed, frame)
106+
end
107+
108+
--仮想バッファに描画
109+
obj.setoption("drawtarget", "tempbuffer", width, height)
110+
if check_background then
111+
obj.load("figure","四角形", check_thresholding and 0x000000 or col2, 1)
112+
obj.drawpoly(- width / 2 , - height / 2, 0, width / 2, - height / 2, 0, width / 2, height / 2, 0, - width / 2, height / 2, 0)
113+
end
114+
for i = 1, n do
115+
local x = rand(dx[1], dx[2])
116+
local y = rand(dy[1], dy[2])
117+
local z = rand(dz[1], dz[2])
118+
local ry = check_mirror and rand(0, 1) == 1 and 180 or 0
119+
local rz = rand(dr[1], dr[2])
120+
obj.copybuffer("obj", "cache:processed")
121+
obj.draw(x, y, z, 1, 1, 0, ry, rz)
122+
end
123+
obj.load("tempbuffer")
124+
--縁ボケを消す2値化(Zを移動させているため)
125+
126+
if check_thresholding then
127+
obj.pixelshader("thresholding", "object", {"object"}, {threshold, col, col2, check_background and 1.0 or 0.0})
128+
end
129+
130+
end)
131+
if not chk then
132+
obj.setfont("游ゴシック", 50)
133+
obj.load("text", "[GrungeConverter.anm]\n"..mes)
134+
obj.draw()
135+
error("[GrungeConverter.anm]"..mes)
136+
end

0 commit comments

Comments
 (0)