Skip to content

Commit 8fa72a9

Browse files
committed
PI.chroma now accepts string.
1 parent 40d8cfb commit 8fa72a9

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

RadRotDirBlur_S.anm2

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ SOFTWARE.
2222

2323
https://mit-license.org/
2424
]]
25-
--information:RadRotDirBlur_S v1.04-beta1 (for beta22a) by σ軸
25+
--information:RadRotDirBlur_S v1.04-beta2 (for beta22a) by σ軸
2626
--label:ぼかし
2727
--track0:移動X,-4000,4000,0,0.01
2828
--track1:移動Y,-4000,4000,0,0.01
@@ -146,16 +146,16 @@ obj.setanchor("track",0,"star");
146146
local dir_x, dir_y, cx, cy = obj.track0, obj.track1, tonumber(center[1]) or 0, tonumber(center[2]) or 0;
147147
--[==[
148148
PI = {
149-
dir: table? { x, y },
150-
rad: number?,
151-
rot: number?,
152-
center: table? { x, y },
153-
amount: number?,
154-
rel_pos: number?,
155-
chroma: 0|1|2|3|4|5|nil,
149+
dir: table? { x, y },
150+
rad: number?,
151+
rot: number?,
152+
center: table? { x, y },
153+
amount: number?,
154+
rel_pos: number?,
155+
chroma: string?,
156156
chrm_abrr: number?,
157157
keep_size: boolean|number?,
158-
quality: number?,
158+
quality: number?,
159159
}
160160
--]==]
161161
if type(PI.dir) == "table" then
@@ -170,7 +170,14 @@ if type(PI.center) == "table" then
170170
end
171171
amount = tonumber(PI.amount) or amount;
172172
rel_pos = tonumber(PI.rel_pos) or rel_pos;
173-
chroma = tonumber(PI.chroma) or chroma;
173+
if PI.chroma then
174+
local name2num = {
175+
[0] = 0, 1, 2, 3, 4, 5; -- legacy compatibility.
176+
["赤青A"] = 0, ["赤緑A"] = 1, ["緑青A"] = 2,
177+
["赤青B"] = 3, ["赤緑B"] = 4, ["緑青B"] = 5,
178+
};
179+
chroma = name2num[PI.chroma] or chroma;
180+
end
174181
chrm_abrr = tonumber(PI.chrm_abrr) or chrm_abrr;
175182
if type(PI.keep_size) == "boolean" then keep_size = PI.keep_size;
176183
elseif type(PI.keep_size) == "number" then keep_size = PI.keep_size ~= 0 end
@@ -181,7 +188,7 @@ rad = math.max(rad / 100, 0.01);
181188
rot = rot * math.pi / 180;
182189
amount = amount / 100;
183190
rel_pos = math.min(math.max(rel_pos / 100, -1), 1);
184-
chroma = math.floor(0.5 + chroma);
191+
chroma = math.min(math.max(math.floor(0.5 + chroma), 0), 5);
185192
chrm_abrr = math.min(math.max(chrm_abrr / 100, -1), 1);
186193
quality = math.min(math.max(math.floor(0.5 + quality), 2), 4096);
187194

0 commit comments

Comments
 (0)