diff --git a/README.md b/README.md index 69664c9..cd610f1 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ This module now supports Companions HTTP API, providing endpoints that can be us - Added Actions: - `Audio - Fade Bus Volume` - `Audio - Set Input Channel Volume` (for separate mono inputs) + - `Title - Adjust title text Color` + - `Title - Adjust title text visibility` - `VideoCall - Connect / Reconnect`, `Zoom - Join Meeting` - Added Feedbacks: - `vMix - Output Status` diff --git a/docs/PATCH_NOTES.md b/docs/PATCH_NOTES.md index 689cd4e..7246809 100644 --- a/docs/PATCH_NOTES.md +++ b/docs/PATCH_NOTES.md @@ -5,6 +5,8 @@ - Added Actions: - `Audio - Fade Bus Volume` - `Audio - Set Input Channel Volume` (for separate mono inputs) + - `Title - Adjust title text Color` + - `Title - Adjust title text visibility` - `VideoCall - Connect / Reconnect`, `Zoom - Join Meeting` - Added Feedbacks: - `vMix - Output Status` diff --git a/src/actions.ts b/src/actions.ts index ac2b1f6..23a92f0 100644 --- a/src/actions.ts +++ b/src/actions.ts @@ -99,6 +99,8 @@ export interface VMixActions { changeCountdown: VMixAction adjustCountdown: VMixAction setText: VMixAction + setTextColor: VMixAction + setTextVisible: VMixAction setColor: VMixAction selectTitlePreset: VMixAction titlePreset: VMixAction @@ -784,6 +786,24 @@ interface SetTextCallback { }> } +interface SetTextColorCallback { + actionId: 'setTextColor' + options: Readonly<{ + input: string + selectedIndex: string + value: string + }> +} + +interface SetTextVisibileCallback { + actionId: 'setTextVisible' + options: Readonly<{ + input: string + selectedIndex: string + adjustment: 'Toggle' | 'On' | 'Off' + }> +} + interface SetColorCallback { actionId: 'setColor' options: Readonly<{ @@ -1475,6 +1495,8 @@ export type ActionCallbacks = | ChangeCountdownCallback | AdjustCountdownCallback | SetTextCallback + | SetTextColorCallback + | SetTextVisibileCallback | SetColorCallback | SelectTitlePresetCallback | TitlePresetCallback @@ -3891,6 +3913,82 @@ export function getActions(instance: VMixInstance): VMixActions { }, }, + setTextColor: { + name: 'Title - Adjust title text Color', + description: 'Adjusts text on a title layer', + options: [ + options.input, + { + type: 'textinput', + label: 'Layer', + tooltip: '(Indexed from 0 or by name)', + id: 'selectedIndex', + default: '0', + useVariables: true, + }, + { + type: 'textinput', + label: 'Color (#RRGGBB)', + id: 'value', + default: '', + useVariables: true, + }, + ], + callback: async (action) => { + const input = (await instance.parseOption(action.options.input))[instance.buttonShift.state] + const index = (await instance.parseOption(action.options.selectedIndex))[instance.buttonShift.state] + const value = (await instance.parseOption(action.options.value))[instance.buttonShift.state] + + if (isNaN(parseInt(index, 10))) { + if (instance.tcp) instance.tcp.sendCommand(`FUNCTION SetTextColour Input=${input}&Value=${value}&SelectedName=${index}`) + } else { + if (instance.tcp) instance.tcp.sendCommand(`FUNCTION SetTextColour Input=${input}&Value=${value}&SelectedIndex=${index}`) + } + } + }, + + setTextVisible: { + name: 'Title - Adjust title text visibility', + description: 'Sets the visibility of title text Toggle, On, or Off', + options: [ + options.input, + { + type: 'textinput', + label: 'Layer', + tooltip: '(Indexed from 0 or by name)', + id: 'selectedIndex', + default: '0', + useVariables: true, + }, + { + type: 'dropdown', + label: 'Adjustment', + id: 'adjustment', + default: 'Toggle', + choices: [ + { id: 'Toggle', label: 'Toggle' }, + { id: 'On', label: 'On' }, + { id: 'Off', label: 'Off' }, + ], + }, + ], + callback: async (action) => { + const input = (await instance.parseOption(action.options.input))[instance.buttonShift.state] + const index = (await instance.parseOption(action.options.selectedIndex))[instance.buttonShift.state] + let type = 'SetTextVisible' + + if (action.options.adjustment === 'On') type = 'SetTextVisibleOn' + if (action.options.adjustment === 'Off') type = 'SetTextVisibleOff' + + + if (isNaN(parseInt(index, 10))) { + if (instance.tcp) instance.tcp.sendCommand(`FUNCTION ${type} Input=${input}&SelectedName=${index}`) + } else { + if (instance.tcp) instance.tcp.sendCommand(`FUNCTION ${type} Input=${input}&SelectedIndex=${index}`) + } + } + }, + setColor: { name: 'Title - Adjust title shape color', description: 'Requires vMix v25. only works on solid colors',