/
SHIFTCelbyNumber.lua
71 lines (51 loc) · 1.68 KB
/
SHIFTCelbyNumber.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
do
local spr = app.activeSprite
if not spr then return app.alert "There is no active sprite" end
local dlg = Dialog()
dlg:entry { id= "addcount",
label= "増分数を入力してください"
}
dlg:button{ id="ok", text="OK" }
dlg:button{ id="cancel", text="Cancel" }
dlg:show()
local addquantity = dlg.data
local dlg = Dialog()
dlg:entry { id= "frames",
label= "移動フレームを入力してください。"
}
dlg:button{ id="ok", text="OK" }
dlg:button{ id="cancel", text="Cancel" }
dlg:show()
local framequantity = dlg.data
local dlg = Dialog()
dlg:entry { id= "direction",
label= "移動方向(left/right/up/down)を入力してください。"
}
dlg:button{ id="ok", text="OK" }
dlg:button{ id="cancel", text="Cancel" }
dlg:show()
local directiondata = dlg.data
local layerCount = app.activeCel.layer.stackIndex
local firstFrameCount = app.activeCel.frame.frameNumber
for i = 1, framequantity.frames, 1 do
-- 正攻法
app.command.Copy()
spr:newCel(app.activeLayer, app.activeSprite.frames[firstFrameCount+i])
app.activeCel = app.activeLayer:cel(firstFrameCount+i)
app.command.Paste()
-- 救済処置(ただしフレームが追加される)
-- app.command.Copy()
-- app.command.NewFrame()
-- app.command.Paste()
-- 範囲コピー(共通)
spr.selection:selectAll()
-- 選択範囲移動(共通)
app.command.MoveMask{
target='content',
direction=directiondata.direction,
units='pixel',
quantity=(addquantity.addcount*i),
wrap=false
}
end
end