-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path70_ColorPresets.lua
More file actions
executable file
·46 lines (33 loc) · 1.39 KB
/
Copy path70_ColorPresets.lua
File metadata and controls
executable file
·46 lines (33 loc) · 1.39 KB
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
require("00_library")
local appearanceOffset = 100
local selectedAppearanceOffset = 120
function main()
local gels = Gel:getAllFromBook(12)
local tag = Tag:byNameOrCreate("ColorPicker")
local groups = tag:getGroups()
Cmd('ClearAll')
Cmd('Blind On')
Printf("Generating %d Presets for %d groups", #gels, #groups)
Builder:new():delete("Appearance 1 Thru"):ifTag(tag:getName()):exec()
for n, gel in pairs(gels) do
for _, group in pairs(groups) do
local cmd = Builder:new()
cmd :obj(group):at(gel):noUndo():next():
store(string.format("Preset 4.%d", n)):merge():noUndo():noConfirm():debug():exec()
Cmd('ClearAll')
end
local preset = Color:byId(n)
tag:assign(preset)
preset:setName(gel:getName())
preset:setNote(gel:address())
local appearance = Appearance:getOrCreate(appearanceOffset + n, string.format("%s Unselected", gel:getName()))
appearance:setBgColor(gel:getRGB())
appearance:setFgColor(gel:getRGB())
tag:assign(appearance)
local selectedAppearance = Appearance:getOrCreate(selectedAppearanceOffset + n, string.format("%s Selected", gel:getName()))
selectedAppearance:setFgColor(0, 0, 0)
selectedAppearance:setBgColor(gel:getRGB())
tag:assign(selectedAppearance)
end
end
return main