From 26f7dca7a68d3ef4269743c25756f20a7f16d773 Mon Sep 17 00:00:00 2001 From: vwout Date: Sat, 13 Jan 2024 12:44:46 +0100 Subject: [PATCH] Improve information (documentation and logs) on action execution --- README.md | 23 ++++++++++++++--------- obs-visca-control.lua | 26 ++++++++++++++------------ 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 6c02224..9e9d834 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # obs-visca-control A plugin for [OBS](https://obsproject.com/) to control Visca-over-IP based cameras. +[![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg)](https://opensource.org/licenses/) +![GitHub release (latest by date)](https://img.shields.io/github/v/release/vwout/obs-visca-control?style=flat-square) + This plugin adds a source to a scene in OBS. With this source, a camera can be controlled. Its main purpose is to automatically switch a camera to a certain preset when the scene is activated. This activation can be as soon as the scene is active in preview, in program, or both. @@ -122,17 +125,19 @@ To permanently disable execution, without removing the configuration, change the #### Custom Command action execution overview -| | Load scene on preview | Transition to program | Transition back to preview | Unload scene on preview (select other scene) | -|--------------------------------------------------------------------------|-----------------------|-----------------------|----------------------------|----------------------------------------------| -| **Action Active**: Always
**On preview exclusive**: No | Send start command | Send start command | Send stop command | Send stop command | -| **Action Active**: Always
**On preview exclusive**: Yes1 | - | Send start command | Send stop command | - | -| **Action Active**: Preview
**On preview exclusive**: No | Send start command | - | - | Send stop command | -| **Action Active**: Preview
**On preview exclusive**: Yes1 | - | - | - | - | -| **Action Active**: Program
**On preview exclusive**: N/A | - | Send start command | Send stop command | - | - +| | Load scene on preview | Transition to program | Transition back to preview | Unload scene on preview2 | +|--------------------------------------------------------------------------|-----------------------|-----------------------|----------------------------|-------------------------------------| +| **Action Active**: Always
**On preview exclusive**: No | Send start command | Send start command | Send stop command | Send stop command | +| **Action Active**: Always
**On preview exclusive**: Yes1 | - | Send start command | Send stop command | - | +| **Action Active**: Preview
**On preview exclusive**: No | Send start command | - | - | Send stop command | +| **Action Active**: Preview
**On preview exclusive**: Yes1 | - | - | - | - | +| **Action Active**: Program
**On preview exclusive**: N/A | - | Send start command | Send stop command | - | -1The checkbox 'Run action on preview only...' is active *and* for the same camera a Visca action is active (visible) on program. +Notes: +- 1 This only applies when the checkbox 'Run action on preview only...' is checked *and* for the same camera a Visca action is active (visible) on program. In case no Visca camera is active on program, or a different Visca camera is active, the table result for 'No' apply. +- 2 The scene unload is executed when another scene is selected on preview. +The camera multiview acts as multiple preview screens. When the multiview window is closed, stop actions are also executed for all scenes visible in multiview. ### Hotkeys The plugin adds a number of hotkeys to the global OBS settings. diff --git a/obs-visca-control.lua b/obs-visca-control.lua index 174b94d..8829d02 100644 --- a/obs-visca-control.lua +++ b/obs-visca-control.lua @@ -1154,9 +1154,9 @@ local function source_signal_processor(source_settings, source_name, signal) end end - -- Signals signal.show and signal.hide do not trigger an action. - -- These signals also trigger when multiview is activated, so does not reliably represent preview status. - -- In addition, the signals are no longer triggered when the scene is active on preview. + -- Signals signal.show and signal.hide should not trigger an action. + -- These signals also trigger when multiview is activated, so do not reliably represent preview status. + -- In addition, the signals are not re-triggered when the scene is already active on preview (or multiview) -- TODO: Remove handling of signal.hide when signal.hide_fe_event is send by fe_callback if signal.show_fe_event or signal.hide_fe_event or signal.hide then if (active == camera_action_active.Preview) or (active == camera_action_active.Always) then @@ -1175,17 +1175,19 @@ local function source_signal_processor(source_settings, source_name, signal) camera_id, do_action and "process" or "no action") - if signal.show or signal.show_fe_event then - local current_preview_scene = obs.obs_frontend_get_current_preview_scene() - local current_preview_scene_name = obs.obs_source_get_name(current_preview_scene) + if do_action then + if signal.show or signal.show_fe_event then + local current_preview_scene = obs.obs_frontend_get_current_preview_scene() + local current_preview_scene_name = obs.obs_source_get_name(current_preview_scene) - if plugin_data.program_scene[current_preview_scene_name] ~= nil then - do_action = false - log("Not running start action on preview for source '%s', " .. - "because it transitioned from program in scene %s", source_name or "?", current_preview_scene_name) - end + if plugin_data.program_scene[current_preview_scene_name] ~= nil then + do_action = false + log("Not running start action on preview for source '%s', " .. + "because it transitioned from program in scene %s", source_name or "?", current_preview_scene_name) + end - obs.obs_source_release(current_preview_scene) + obs.obs_source_release(current_preview_scene) + end end if signal.activate then