-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathColorPicker_v0
148 lines (130 loc) · 6.82 KB
/
ColorPicker_v0
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
--[[
The code below is an automation of sequence and macro production. The sequences
are produced with color information in them such that they can be used in a colorpicker.
Macros are then produced to run the sequences AND refer to color images. This gives the opporitunity
to use images to refer to what color one is about to switch to.
Some prerequisites are needed.
The code is written with the intend of having 13 colors autocreated (global merge) with 1 unit of
saturation between them. This also the code does not work with gobo colors, getting that to work will
need some manual editing of sequences.
Revision: 0
Code by Tobias Halling
]]--
function print (msg)
gma.feedback(msg)
gma.echo(msg)
end
function getNonEmptyUserInput (msg, placeholder)
placeholder = placeholder or ''
local userInput = ''
repeat
userInput = gma.textinput(msg, placeholder)
until userInput ~= placeholder
return userInput
end
function seq()
local colors = {
'White', 'Red', 'Orange', 'Yellow', 'Lime', 'Green',
'Coral', 'Turquoise', 'LightBlue', 'Blue', 'Purple',
'Pink', 'Magenta',}
--giving color info
seqNum = 0
for j = 1, 3, 1 do -- need better way to denote number of groups
local groupNum = j
for i = 1, 13, 1 do
local colorNum = i
seqNum = seqNum + 1
print(seqNum)
gma.cmd('Group '..groupNum)
gma.cmd('At Preset 4.'..colorNum)
-- if loop sørger for at der bliver talt rigtigt
if seqNum < 10 then
gma.cmd('Store Sequence 1.80'..seqNum)
else
gma.cmd('Store Sequence 1.8'..seqNum)
end
-- renaming of sequence
-- if loop sørger for at der tælles rigtigt
if seqNum < 10 then
gma.cmd('Label Sequence 1.80'..seqNum..' \"'..colors[i]..'\"')
else
gma.cmd('Label Sequence 1.8'..seqNum..' \"'..colors[i]..'\"')
end
print('Inner loop '..i..' done')
end
end
end
function mac()
-- Setting variables for later use
gma.cmd('setvar $EmptyColors = "Image 17 thru 29"')
gma.cmd('setvar $Fix1Colors = "Image 209 thru 221"')
gma.cmd('setvar $Fix2Colors = "Image 225 thru 237"')
gma.cmd('setvar $Fix3Colors = "Image 241 thru 253"')
-- Color names for use in renaming
local colors = {
'White', 'Red', 'Orange', 'Yellow', 'Lime', 'Green',
'Coral', 'Turquoise', 'LightBlue', 'Blue', 'Purple',
'Pink', 'Magenta',}
gma.cmd('blind') -- turns blind mode on such that no dmx is output
macroNum = 0
for j = 1, 2 do
for i = 1, 13 do
local colorNum = i
macroNum = macroNum + 1
print('macroNum = '..macroNum)
-- Create macro
if macroNum < 10 then
gma.cmd('Store Macro 1.80'..macroNum)
gma.cmd('Label Macro 1.80'..macroNum..' \"'..colors[i]..'\"')
else
gma.cmd('Store Macro 1.8'..macroNum)
gma.cmd('Label Macro 1.8'..macroNum..' \"'..colors[i]..'\"')
end
-- nested table with lines of code to be written into the macross
local macroLines = {
{"off sequence 801 thru 813", "Copy $EmptyColors At $Fix1Colors /m", "Copy Image 33 At Image 209 /o"},
{"go sequence 802", "Copy $EmptyColors At $Fix1Colors /m", "Copy Image 34 At Image 210 /o"},
{"go sequence 803", "Copy $EmptyColors At $Fix1Colors /m", "Copy Image 35 At Image 211 /o"},
{"go sequence 804", "Copy $EmptyColors At $Fix1Colors /m", "Copy Image 36 At Image 212 /o"},
{"go sequence 805", "Copy $EmptyColors At $Fix1Colors /m", "Copy Image 37 At Image 213 /o"},
{"go sequence 806", "Copy $EmptyColors At $Fix1Colors /m", "Copy Image 38 At Image 214 /o"},
{"go sequence 807", "Copy $EmptyColors At $Fix1Colors /m", "Copy Image 39 At Image 215 /o"},
{"go sequence 808", "Copy $EmptyColors At $Fix1Colors /m", "Copy Image 40 At Image 216 /o"},
{"go sequence 809", "Copy $EmptyColors At $Fix1Colors /m", "Copy Image 41 At Image 217 /o"},
{"go sequence 810", "Copy $EmptyColors At $Fix1Colors /m", "Copy Image 42 At Image 218 /o"},
{"go sequence 811", "Copy $EmptyColors At $Fix1Colors /m", "Copy Image 43 At Image 219 /o"},
{"go sequence 812", "Copy $EmptyColors At $Fix1Colors /m", "Copy Image 44 At Image 220 /o"},
{"go sequence 813", "Copy $EmptyColors At $Fix1Colors /m", "Copy Image 45 At Image 221 /o"},
{"off sequence 814 thru 826", "Copy $EmptyColors At $Fix2Colors /m", "Copy Image 33 At Image 225 /o"},
{"go sequence 815", "Copy $EmptyColors At $Fix2Colors /m", "Copy Image 34 At Image 226 /o"},
{"go sequence 816", "Copy $EmptyColors At $Fix2Colors /m", "Copy Image 35 At Image 227 /o"},
{"go sequence 817", "Copy $EmptyColors At $Fix2Colors /m", "Copy Image 36 At Image 228 /o"},
{"go sequence 818", "Copy $EmptyColors At $Fix2Colors /m", "Copy Image 37 At Image 229 /o"},
{"go sequence 819", "Copy $EmptyColors At $Fix2Colors /m", "Copy Image 38 At Image 230 /o"},
{"go sequence 820", "Copy $EmptyColors At $Fix2Colors /m", "Copy Image 39 At Image 231 /o"},
{"go sequence 821", "Copy $EmptyColors At $Fix2Colors /m", "Copy Image 40 At Image 232 /o"},
{"go sequence 822", "Copy $EmptyColors At $Fix2Colors /m", "Copy Image 41 At Image 233 /o"},
{"go sequence 823", "Copy $EmptyColors At $Fix2Colors /m", "Copy Image 42 At Image 234 /o"},
{"go sequence 824", "Copy $EmptyColors At $Fix2Colors /m", "Copy Image 43 At Image 235 /o"},
{"go sequence 825", "Copy $EmptyColors At $Fix2Colors /m", "Copy Image 44 At Image 236 /o"},
{"go sequence 826", "Copy $EmptyColors At $Fix2Colors /m", "Copy Image 45 At Image 237 /o"},
}
for k = 1, 3 do
if macroNum < 10 then
gma.cmd('Store Macro 1.80' .. macroNum .. '.' .. k)
gma.cmd('Assign Macro 1.80'..macroNum..".".. k .."/cmd=\"" .. macroLines[macroNum][k] .. "\"")
else
gma.cmd('Store Macro 1.8' .. macroNum .. '.' .. k)
gma.cmd('Assign Macro 1.8'..macroNum..".".. k .."/cmd=\"" .. macroLines[macroNum][k] .. "\"")
end
end
end
end
gma.cmd('blind') -- turns blind mode off, such that dmx can be sent again
print('End of plugin')
end
function main()
seq()
mac()
end
return main