From bfa099701afe71f959879006bc45acfd00c2e6d0 Mon Sep 17 00:00:00 2001 From: Keith Rocheck <749812+krocheck@users.noreply.github.com> Date: Wed, 18 Nov 2020 15:11:38 -0500 Subject: [PATCH] bugfix for colors action --- index.js | 109 +++++++++++++++++++++++++++++++++++++++++++++++---- package.json | 2 +- setup.js | 95 +------------------------------------------- 3 files changed, 104 insertions(+), 102 deletions(-) diff --git a/index.js b/index.js index 3cf1de9..33edd85 100644 --- a/index.js +++ b/index.js @@ -15,7 +15,6 @@ var log; * Companion instance class for the Blackmagic SmartView/SmartScope Monitors. * * @extends instance_skel - * @version 1.1.0 * @since 1.0.0 * @author Per Roine * @author Keith Rocheck @@ -72,6 +71,8 @@ class instance extends instance_skel { { action: 'satDown', group: 'Saturation', label: 'SATURATION\\nDOWN\\n\\n$(smart:_saturation)', } ]; + this.setupFields(); + this.actions(); // export actions } @@ -133,7 +134,7 @@ class instance extends instance_skel { cmd = `${opt.mon}\nIdentify: true`; break; case 'border': - cmd = `${opt.mon}\nBorder: ${opt.col}`; + cmd = `${opt.mon}\nBorder: ${opt.val}`; break; case 'scopeFunc': cmd = `${opt.mon}\nScopeMode: ${opt.val}`; @@ -457,12 +458,106 @@ class instance extends instance_skel { this.CHOICES_MONITOR = [{ id: 'MONITOR A:', label: 'Monitor A', preset: '', variable: 'mon_a_' }]; } - this.AUDIOCHANNEL_FIELD.choices = this.CHOICES_AUDIOCHANNELS; - this.COLOR_FIELD.choices = this.CHOICES_COLORS; - this.INPUT_FIELD.choices = this.CHOICES_INPUTS; - this.LUT_FIELD.choices = this.CHOICES_LUTS; this.MONITOR_FIELD.choices = this.CHOICES_MONITOR; - this.SCOPETYPE_FIELD.choices = this.CHOICES_SCOPETYPE; + } + + /** + * Set up the fields used in actions and feedbacks + * + * @access protected + * @since 1.1.2 + */ + setupFields() { + + this.BG_COLOR_FIELD = function(defaultColor) { + return { + type: 'colorpicker', + label: 'Background color', + id: 'bg', + default: defaultColor + }; + }; + this.FG_COLOR_FIELD = function(defaultColor) { + return { + type: 'colorpicker', + label: 'Foreground color', + id: 'fg', + default: defaultColor + }; + }; + this.AUDIOCHANNEL_FIELD = { + type: 'dropdown', + label: 'Channels', + id: 'val', + choices: this.CHOICES_AUDIOCHANNELS, + default: '0' + }; + this.COLOR_FIELD = { + type: 'dropdown', + label: 'Color', + id: 'val', + choices: this.CHOICES_COLORS + }; + this.DECREMENT_FIELD = { + type: 'number', + label: 'Decrement Amount (1-255)', + id: 'val', + min: 1, + max: 255, + default: 5, + required: true, + range: false + }; + this.INCREMENT_FIELD = { + type: 'number', + label: 'Increment Amount (1-255)', + id: 'val', + min: 1, + max: 255, + default: 5, + required: true, + range: false + }; + this.INPUT_FIELD = { + type: 'dropdown', + label: 'Input', + id: 'val', + choices: this.CHOICES_INPUTS, + default: 'SDI A' + }; + this.LEVEL_FIELD = function(defaultLevel) { + return { + type: 'number', + label: 'Set the level 0-255', + id: 'val', + min: 0, + max: 255, + default: defaultLevel, + required: true, + range: true + }; + }; + this.LUT_FIELD = { + type: 'dropdown', + label: 'LUT', + id: 'val', + choices: this.CHOICES_LUTS, + default: 'NONE' + }; + this.MONITOR_FIELD = { + type: 'dropdown', + label: 'Select Monitor', + id: 'mon', + choices: this.CHOICES_MONITOR, + default: 'MONITOR A:' + }; + this.SCOPETYPE_FIELD = { + type: 'dropdown', + label: 'Function', + id: 'val', + choices: this.CHOICES_SCOPETYPE, + default: 'Picture' + }; } /** diff --git a/package.json b/package.json index 06ad930..f0d407a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bmd-smartview", - "version": "1.1.1", + "version": "1.1.2", "api_version": "1.0.0", "keywords": [ "Scope", diff --git a/setup.js b/setup.js index 0fcac75..5e3583c 100644 --- a/setup.js +++ b/setup.js @@ -33,10 +33,6 @@ module.exports = { { id: '1', label: 'LUT 2' }, { id: 'NONE', label: 'DISABLE' } ], - CHOICES_MONITOR: [ - { id: 'MONITOR A:', label: 'Monitor A', preset: 'MONITOR: A\\n', variable: 'mon_a_' }, - { id: 'MONITOR B:', label: 'Monitor B', preset: 'MONITOR: B\\n', variable: 'mon_b_' } - ], CHOICES_SCOPETYPE: [ { id: 'Picture', label: 'Picture' }, { id: 'WaveformLuma', label: 'Waveform' }, @@ -47,94 +43,5 @@ module.exports = { { id: 'Histogram', label: 'Histogram' }, { id: 'AudioDbfs', label: 'Audio dBFS' }, { id: 'AudioDbvu', label: 'Audio dBVU' } - ], - BG_COLOR_FIELD: function(defaultColor) { - return { - type: 'colorpicker', - label: 'Background color', - id: 'bg', - default: defaultColor - }; - }, - FG_COLOR_FIELD: function(defaultColor) { - return { - type: 'colorpicker', - label: 'Foreground color', - id: 'fg', - default: defaultColor - }; - }, - AUDIOCHANNEL_FIELD: { - type: 'dropdown', - label: 'Channels', - id: 'val', - choices: this.CHOICES_AUDIOCHANNELS, - default: '0' - }, - COLOR_FIELD: { - type: 'dropdown', - label: 'Color', - id: 'val', - choices: this.CHOICES_COLORS - }, - DECREMENT_FIELD: { - type: 'number', - label: 'Decrement Amount (1-255)', - id: 'val', - min: 1, - max: 255, - default: 5, - required: true, - range: false - }, - INCREMENT_FIELD: { - type: 'number', - label: 'Increment Amount (1-255)', - id: 'val', - min: 1, - max: 255, - default: 5, - required: true, - range: false - }, - INPUT_FIELD: { - type: 'dropdown', - label: 'Input', - id: 'val', - choices: this.CHOICES_INPUTS, - default: 'SDI A' - }, - LEVEL_FIELD: function(defaultLevel) { - return { - type: 'number', - label: 'Set the level 0-255', - id: 'val', - min: 0, - max: 255, - default: defaultLevel, - required: true, - range: true - }; - }, - LUT_FIELD: { - type: 'dropdown', - label: 'LUT', - id: 'val', - choices: this.CHOICES_LUTS, - default: 'NONE' - }, - MONITOR_FIELD: { - type: 'dropdown', - label: 'Select Monitor', - id: 'mon', - choices: this.CHOICES_MONITOR, - default: 'MONITOR A:' - }, - SCOPETYPE_FIELD: { - type: 'dropdown', - label: 'Function', - id: 'val', - choices: this.CHOICES_SCOPETYPE, - default: 'Picture' - } + ] } \ No newline at end of file