Skip to content

Commit

Permalink
Fix an issue where the caspar plugin didn't parse enum data properly
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Boberg <[email protected]>
  • Loading branch information
axelboberg committed Feb 29, 2024
1 parent 0bbbd05 commit 503d4ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion plugins/caspar/lib/AMCP.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//
// SPDX-License-Identifier: MIT

const types = require('./types')

/**
* @typedef {{
* channel: Number | undefined,
Expand Down Expand Up @@ -33,7 +35,7 @@ function layerString (opts = {}) {
* @returns { String }
*/
function transitionString (opts = {}) {
return `${opts.transitionName || ''} ${opts.transitionDuration || '0'} ${(opts.transitionEasing || 'LINEAR')} ${(opts.transitionDirection || 'LEFT')}`.toUpperCase()
return `${types.TRANSITION_NAME_ENUM[opts.transitionName] || ''} ${opts.transitionDuration || '0'} ${(opts.transitionEasing || 'LINEAR')} ${(types.TRANSITION_DIRECTION_ENUM[opts.transitionDirection] || 'LEFT')}`.toUpperCase()
}

/**
Expand Down
13 changes: 10 additions & 3 deletions plugins/caspar/lib/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

const bridge = require('bridge')

const TRANSITION_NAME_ENUM = ['Cut', 'Mix', 'Push', 'Slide', 'Wipe']
exports.TRANSITION_NAME_ENUM = TRANSITION_NAME_ENUM

const TRANSITION_DIRECTION_ENUM = ['Left', 'Right']
exports.TRANSITION_DIRECTION_ENUM = TRANSITION_DIRECTION_ENUM

function init (htmlPath) {
bridge.types.registerType({
id: 'bridge.caspar.amcp',
Expand Down Expand Up @@ -100,14 +106,15 @@ function init (htmlPath) {
'caspar.transitionName': {
name: 'Transition',
type: 'enum',
enum: ['Cut', 'Mix', 'Push', 'Slide', 'Wipe'],
enum: TRANSITION_NAME_ENUM,
default: '0',
'ui.group': 'Transition'
},
'caspar.transitionDirection': {
name: 'Direction',
type: 'enum',
enum: ['Left', 'Right'],
default: 'Left',
enum: TRANSITION_DIRECTION_ENUM,
default: '0',
'ui.group': 'Transition'
},
'caspar.transitionDuration': {
Expand Down

0 comments on commit 503d4ab

Please sign in to comment.