-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.lua
More file actions
189 lines (162 loc) · 6.66 KB
/
plugin.lua
File metadata and controls
189 lines (162 loc) · 6.66 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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
-- =============================================================
-- plugin.lua -- Remote PC Control
-- Author: Michael King
--
-- This is the ENTRY POINT for the Q-SYS plugin compiler (PLUGCC).
-- PLUGCC reads this file and expands all the #include directives
-- into a single .qplug output file that Q-SYS Designer loads.
--
-- The functions in this file define how the plugin appears and
-- behaves at DESIGN TIME (in Q-SYS Designer). Runtime behavior
-- lives in runtime.lua and only executes on a running Core.
--
-- File structure:
-- info.lua -- Plugin name, version, GUID, author
-- properties.lua -- User-configurable properties (IP, port, token, etc.)
-- controls.lua -- Control definitions (buttons, LEDs, faders)
-- layout.lua -- Visual layout of controls on the plugin panel pages
-- pages.lua -- Defines the tab pages shown in Designer
-- model.lua -- Hardware model entry shown in Designer
-- pins.lua -- External signal pins (audio, video -- unused here)
-- components.lua -- Internal Q-SYS components (mixer, etc. -- unused here)
-- wiring.lua -- Internal component wiring (unused here)
-- rectify_properties.lua -- Post-processing of property visibility
-- runtime.lua -- All live runtime logic executed on the Core
-- =============================================================
--[[ #include "info.lua" ]]
-- -------------------------------------------------------------
-- GetColor(props)
-- Returns the RGB color of the colored bar on the plugin block
-- in the Q-SYS Designer schematic view.
-- Using Clair Global "Patch of Blue" brand color: #15a3d5
-- Change to a different RGB triple if branding changes.
-- -------------------------------------------------------------
function GetColor(props)
return { 0, 210, 255 }
end
-- -------------------------------------------------------------
-- GetPrettyName(props)
-- Returns the label shown on the plugin block face in Designer.
-- We show the Computer Name property so the operator can tell
-- at a glance which PC this block controls.
-- If Computer Name hasn't been set yet, show "(unconfigured)"
-- as a reminder that setup is needed.
-- -------------------------------------------------------------
function GetPrettyName(props)
-- Use non-breaking spaces (U+00A0) so Q-SYS doesn't word-wrap
-- the title on the block face. In UTF-8, U+00A0 is \xC2\xA0.
local nbsp = "\xC2\xA0"
local title = "Remote" .. nbsp .. "PC" .. nbsp .. "Control"
local name = props["Computer Name"].Value
if name ~= "" then
return title .. "\n" .. name
end
return title .. "\n(unconfigured)"
end
-- -------------------------------------------------------------
-- PageNames
-- Fixed page list: Control and Setup only.
-- Referenced by layout.lua at design time, so must be declared
-- at module scope (not only inside GetPages).
-- -------------------------------------------------------------
PageNames = { "Control", "Setup" }
-- -------------------------------------------------------------
-- GetPages(props)
-- Populates the pages table from PageNames via pages.lua.
-- -------------------------------------------------------------
function GetPages(props)
local pages = {}
--[[ #include "pages.lua" ]]
return pages
end
-- -------------------------------------------------------------
-- GetModel(props)
-- Returns the hardware model list shown in the Designer
-- plugin properties panel. We use a single fixed model entry.
-- -------------------------------------------------------------
function GetModel(props)
local model = {}
--[[ #include "model.lua" ]]
return model
end
-- -------------------------------------------------------------
-- GetProperties()
-- Returns all user-configurable property definitions.
-- These appear in the plugin Properties panel in Designer.
-- -------------------------------------------------------------
function GetProperties()
local props = {}
--[[ #include "properties.lua" ]]
return props
end
-- -------------------------------------------------------------
-- GetPins(props)
-- Returns any external signal pins (audio, video, etc.).
-- This plugin has no audio/video pins -- only control pins.
-- -------------------------------------------------------------
function GetPins(props)
local pins = {}
--[[ #include "pins.lua" ]]
return pins
end
-- -------------------------------------------------------------
-- RectifyProperties(props)
-- Called by Designer after properties are loaded. Lets us
-- show/hide or modify properties dynamically based on values.
-- For example: hiding the Debug Print property when set to None.
-- -------------------------------------------------------------
function RectifyProperties(props)
--[[ #include "rectify_properties.lua" ]]
return props
end
-- -------------------------------------------------------------
-- GetComponents(props)
-- Returns any internal Q-SYS components used by the plugin
-- (e.g. mixers, delays). This plugin has none.
-- -------------------------------------------------------------
function GetComponents(props)
local components = {}
--[[ #include "components.lua" ]]
return components
end
-- -------------------------------------------------------------
-- GetWiring(props)
-- Returns wiring between internal components.
-- This plugin has no internal components, so nothing to wire.
-- -------------------------------------------------------------
function GetWiring(props)
local wiring = {}
--[[ #include "wiring.lua" ]]
return wiring
end
-- -------------------------------------------------------------
-- GetControls(props)
-- Returns all control definitions (buttons, LEDs, knobs, etc.)
-- and their pin visibility settings.
-- -------------------------------------------------------------
function GetControls(props)
local ctrls = {}
--[[ #include "controls.lua" ]]
return ctrls
end
-- -------------------------------------------------------------
-- GetControlLayout(props)
-- Returns the visual layout of controls for the plugin panel.
-- layout = table of control positions/styles/labels
-- graphics = table of background shapes, text labels, group boxes
-- -------------------------------------------------------------
function GetControlLayout(props)
local layout = {}
local graphics = {}
--[[ #include "layout.lua" ]]
return layout, graphics
end
-- -------------------------------------------------------------
-- Runtime inclusion
-- The "if Controls then" guard ensures runtime.lua only runs
-- on a live Core (where Controls are instantiated). It is skipped
-- during design-time evaluation in Q-SYS Designer.
-- -------------------------------------------------------------
if Controls then
--[[ #include "runtime.lua" ]]
end