Skip to content

Commit

Permalink
Merge pull request #106 from istnv/feat/q5_colors
Browse files Browse the repository at this point in the history
Add new QLab5 colors and Custom OSC action
  • Loading branch information
istnv authored Oct 26, 2023
2 parents 9a8fab1 + 21a4e4c commit 236276d
Show file tree
Hide file tree
Showing 9 changed files with 376 additions and 189 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ node_modules/
/pkg.tgz
DEBUG-INSPECT
DEBUG-PACKAGE
DEBUG-PACKAGED
DEBUG-PACKAGED
actions_old.js
84 changes: 83 additions & 1 deletion actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ export function compileActionDefinitions(self) {
} else if (cmd !== undefined) {
self.log('debug', `sending ${cmd} ${JSON.stringify(args)} to ${self.config.host}`)
// everything except 'auditionWindow' and 'overrideWindow' works on a specific workspace
self.sendOSC(cmd, args, ['/auditionWindow', '/alwaysAudition', '/overrideWindow'].includes(cmd))
self.sendOSC(
cmd,
args,
['/auditionWindow', '/alwaysAudition', '/overrideWindow'].includes(cmd),
)
}
// QLab does not send window updates so ask for status
if (self.useTCP && ['/auditionWindow', '/alwaysAudition', '/overrideWindow'].includes(cmd)) {
Expand Down Expand Up @@ -771,6 +775,84 @@ export function compileActionDefinitions(self) {
})
},
},
manual: {
name: 'Send custom OSC command',
description: 'Please consider filing a feature request',
options: [
{
type: 'textinput',
label: 'OSC Address',
id: 'node',
default: '',
useVariables: true,
},
{
type: 'dropdown',
label: 'Argument Type',
id: 'argType',
default: 'n',
choices: [
{ id: 'n', label: 'None' },
{ id: 's', label: 'String' },
{ id: 'i', label: 'Integer' },
{ id: 'f', label: 'Float' },
],
},
{
type: 'textinput',
label: 'String',
id: 'argS',
default: '',
useVariables: true,
isVisible: (option, data) => {
return option.argType === 's'
},
},
{
type: 'textinput',
label: 'Integer',
id: 'argI',
default: 0,
useVariables: true,
isVisible: (option, data) => {
return option.argType === 'i'
},
},
{
type: 'textinput',
label: 'Float',
id: 'argF',
default: 0.0,
useVariables: true,
isVisible: (option, data) => {
return option.argType === 'f'
},
},
],
callback: async (action, context) => {
let arg
const argT = action.options.argType === 'n' ? '' : action.options.argType
switch (argT) {
case 's':
arg = { type: argT, value: await context.parseVariablesInString(action.options.argS) }
break
case 'i':
arg = {
type: argT,
value: parseInt(await context.parseVariablesInString(action.options.argI)),
}
break
case 'f':
arg = {
type: argT,
value: parseFloat(await context.parseVariablesInString(action.options.argF)),
}
break
}
const cmd = await context.parseVariablesInString(action.options.node)
await sendCommand(action, cmd, arg)
},
},
copyCueID: {
name: 'Copy Unique Cue ID',
options: [],
Expand Down
46 changes: 37 additions & 9 deletions colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,31 @@ import { combineRgb } from '@companion-module/base'

export const colorRGB = {
none: combineRgb(16, 16, 16),
// thanks to Baldrian Sector for the extended list of color names
// base colors
red: combineRgb(160, 0, 0),
orange: combineRgb(255, 100, 0),
yellow: combineRgb(160, 160, 0),
green: combineRgb(0, 160, 0),
cyan: combineRgb(0, 160, 160),
blue: combineRgb(0, 0, 160),
purple: combineRgb(80, 0, 80),
yellow: combineRgb(200, 200, 0),
magenta: combineRgb(160, 0, 160),
// other 'official' colors
berry: combineRgb(94, 30, 77),
crimson: combineRgb(140, 0, 40),
forest: combineRgb(50, 85, 35),
gray: combineRgb(140, 140, 140),
'Hot Pink': combineRgb(220, 0, 120),
hotpink: combineRgb(220, 0, 120),
indigo: combineRgb(75, 0, 130),
lavender: combineRgb(200, 140, 224),
midnight: combineRgb(32, 36, 125),
olive: combineRgb(128, 128, 0),
peach: combineRgb(228, 128, 89),
plum: combineRgb(52, 0, 62),
skyblue: combineRgb(135, 206, 235),
'Sky Blue': combineRgb(135, 206, 235),
// 'other' available colors
avocado: combineRgb(86, 130, 4),
bastardamber: combineRgb(255, 200, 180),
bisque: combineRgb(255, 229, 196),
Expand All @@ -22,18 +40,15 @@ export const colorRGB = {
fulvous: combineRgb(228, 134, 0),
glaucous: combineRgb(136, 206, 234),
grey: combineRgb(140, 140, 140),
indigo: combineRgb(75, 0, 130),
lilac: combineRgb(204, 135, 153),
maize: combineRgb(247, 232, 92),
mauve: combineRgb(153, 51, 102),
ochre: combineRgb(205, 118, 34),
olive: combineRgb(128, 128, 0),
puce: combineRgb(223, 176, 255),
rufous: combineRgb(169, 27, 7),
sage: combineRgb(189, 184, 138),
scarlet: combineRgb(253, 37, 0),
seafoamgreen: combineRgb(195, 226, 190),
skyblue: combineRgb(135, 206, 235),
taupe: combineRgb(178, 138, 108),
verdigris: combineRgb(65, 129, 108),
vermilion: combineRgb(228, 66, 52),
Expand All @@ -46,10 +61,26 @@ export const colorName = [
{ label: 'None', id: 'none' },
{ label: 'Red', id: 'red' },
{ label: 'Orange', id: 'orange' },
{ label: 'Yellow', id: 'yellow' },
{ label: 'Green', id: 'green' },
{ label: 'Cyan', id: 'cyan' },
{ label: 'Blue', id: 'blue' },
{ label: 'Purple', id: 'purple' },
{ label: 'Yellow', id: 'yellow' },
{ label: 'Magenta', id: 'magenta' },
//
{ label: 'Berry', id: 'berry' },
{ label: 'Crimson', id: 'crimson' },
{ label: 'Forest', id: 'forest' },
{ label: 'Gray', id: 'gray' },
{ label: 'Hot Pink', id: 'Hot Pink' },
{ label: 'Indigo', id: 'indigo' },
{ label: 'Lavender', id: 'Lavender' },
{ label: 'Midnight', id: 'midnight' },
{ label: 'Olive', id: 'olive' },
{ label: 'Peach', id: 'peach' },
{ label: 'Plum', id: 'plum' },
{ label: 'Sky Blue', id: 'Sky Blue' },
//
{ label: 'Avocado', id: 'avocado' },
{ label: 'Bastard Amber', id: 'bastardamber' },
{ label: 'Bisque', id: 'bisque' },
Expand All @@ -63,18 +94,15 @@ export const colorName = [
{ label: 'Fulvous', id: 'fulvous' },
{ label: 'Glaucous', id: 'glaucous' },
{ label: 'Grey', id: 'grey' },
{ label: 'Indigo', id: 'indigo' },
{ label: 'Lilac', id: 'lilac' },
{ label: 'Maize', id: 'maize' },
{ label: 'Mauve', id: 'mauve' },
{ label: 'Ochre', id: 'ochre' },
{ label: 'Olive', id: 'olive' },
{ label: 'Puce', id: 'puce' },
{ label: 'Rufous', id: 'rufous' },
{ label: 'Sage', id: 'sage' },
{ label: 'Scarlet', id: 'scarlet' },
{ label: 'Seafoam Green', id: 'seafoamgreen' },
{ label: 'Skyblue', id: 'skyblue' },
{ label: 'Taupe', id: 'taupe' },
{ label: 'Verdigris', id: 'verdigris' },
{ label: 'Vermilion', id: 'vermilion' },
Expand Down
20 changes: 11 additions & 9 deletions companion/HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ https://github.com/sponsors/istnv

## Configuration

| Setting | Description |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Target IP** | Enter the address of the QLab computer. You can enter 127.0.0.1 if Companion is running on the same computer. |
| **Target Port** | Enter the port number where QLab is listening for OSC messages. This defaults to 53000. Has no effect on QLab4 (or QLab3) |
| **Use TCP?** | Check to enable TCP mode. This is required for variables and feedback. |
| **Use Tenths** | If checked, the variable _r_left_ will display 0.1 seconds when less than 5 seconds. If unchecked, the time left will be adjusted by 1 second for a more accurate count-down. |
| **OSC Passcode** | Enter a passcode if needed for the QLab workspace. QLab 5 requires a passcode to work reliably from Companion. |
| **Workspace** | Dropdown selection to select a specific Workspace. You can enter 'default' or leave blank to control front-most workspace (if more than one is open) in QLab4. QLab5 commands go to all open workspaces. You can change the IP Control Port too allow multiple workspaces open at once. |
| **Specific Cue List** | Dropdown selection to limit control to a specific cuelist. |
| Setting | Description |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Target IP** | Enter the address of the QLab computer. You can enter 127.0.0.1 if Companion is running on the same computer. |
| **Target Port** | Enter the port number where QLab is listening for OSC messages. This defaults to 53000. Has no effect on QLab4 (or QLab3) |
| **Use TCP?** | Check to enable TCP mode. This is required for variables and feedback. |
| **Use Tenths?** | If checked, the variable _r_left_ will display 0.1 seconds when less than 5 seconds. If unchecked, the time left will be adjusted by 1 second for a more accurate count-down. |
| **Expose Cue Name Variables?** | The cue name variables for all cue numbers and IDs are not normally visible in the list of variables window. Enabling this will show them which could clutter the list with hundreds of variables. |
| **OSC Passcode** | Enter a passcode if needed for the QLab workspace. QLab 5 requires a passcode to work reliably from Companion. |
| **Workspace** | Dropdown selection to select a specific Workspace. You can enter 'default' or leave blank to control front-most workspace (if more than one is open) in QLab4. QLab5 commands go to all open workspaces. You can change the IP Control Port too allow multiple workspaces open at once. |
| **Specific Cue List** | Dropdown selection to limit control to a specific cuelist. |

## Actions

Expand Down Expand Up @@ -79,6 +80,7 @@ https://github.com/sponsors/istnv
| **Set/Unset Autoload** | Set / Unset the Autoload property of the selected cue. |
| **Set Continue Mode** | Sets the continue mode of the selected cue. |
| **Set Cue Color** | Sets the color of the selected cue. |
| **Custom OSC Command** | Send a custom OSC command to QLab. Useful for commands not yet implemented.<br/>If you use this, consider submitting a feature request to have the command added as a built-in action |
| **Copy Unique Cue ID** | Copies the Unique ID of the cue at the Playhead to actions and feedbacks. |

The next action or feedback inserted will have the Unique ID already filled in.
Expand Down
33 changes: 26 additions & 7 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,44 @@ export function GetConfigFields(self) {
type: 'checkbox',
label: 'Use TCP?',
id: 'useTCP',
width: 20,
tooltip: 'Use TCP instead of UDP\nRequired for feedbacks',
default: false,
width: 6,
tooltip: 'Use TCP instead of UDP\nRequired for feedbacks and variables',
default: true,
},
{
type: 'checkbox',
label: 'Use Tenths',
label: 'Use Tenths?',
id: 'useTenths',
width: 20,
width: 6,
isVisible: (options, data) => {
return !!options.useTCP
},
tooltip:
'Show .1 second resolution for cue remaining timer?\nOtherwise offset countdown by +1 second\nRequires TCP',
default: false,
},
{
type: 'checkbox',
label: 'Expose cue name variables?',
id: 'exposeVariables',
width: 6,
isVisible: (options, data) => {
return !!options.useTCP
},
tooltip:
'Variables for the name of each cue number and cue ID are normally hidden\n' +
'in the Variable List. Enabling this will allow them to be searched in the\n' +
'list but may also cause excessive clutter',
default: false,
},
{
type: 'textinput',
id: 'passcode',
label: 'OSC Passcode',
width: 12,
tooltip: 'The passcode to controll QLab.\nLeave blank if not needed.',
width: 6,
tooltip:
'The passcode to controll QLab.\nLeave blank if not needed\n'
+'This is almost always required for QLab5',
},
]

Expand Down
5 changes: 4 additions & 1 deletion cues.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ class Cue {
uniqueID = ''
qName = '[none]'
qNumber = ''
qType = null
qMode = null
isLoaded = false
isBroken = false
isRunning = false
Expand Down Expand Up @@ -38,6 +40,7 @@ function JSONtoCue(newCue, j, self) {
newCue.qNumber = j.number
newCue.qColorName = j.colorName
newCue.qType = j.type.toLowerCase()
newCue.qMode = j.mode,
newCue.isRunning = j.isRunning
newCue.isAuditioning = j.isAuditioning
newCue.isLoaded = j.isLoaded
Expand All @@ -55,7 +58,7 @@ function JSONtoCue(newCue, j, self) {
if (j.notes) {
newCue.Notes = j.notes.slice(0, 20)
}
newCue.qColor = Colors.colorRGB[j.colorName]
newCue.qColor = Colors.colorRGB[j.colorName.toLowerCase().replaceAll(' ','')]

const isExistingQ = newCue.uniqueID in self.wsCues

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "figure53-qlab-advance",
"version": "2.4.1",
"version": "2.4.2",
"main": "qlabfb.js",
"type": "module",
"scripts": {
Expand Down
Loading

0 comments on commit 236276d

Please sign in to comment.