Skip to content

Commit

Permalink
Improve information (documentation and logs) on action execution
Browse files Browse the repository at this point in the history
  • Loading branch information
vwout committed Jan 13, 2024
1 parent e836c40 commit 26f7dca
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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<br/>**On preview exclusive**: No | Send start command | Send start command | Send stop command | Send stop command |
| **Action Active**: Always<br/>**On preview exclusive**: Yes<sup>1</sup> | - | Send start command | Send stop command | - |
| **Action Active**: Preview<br/>**On preview exclusive**: No | Send start command | - | - | Send stop command |
| **Action Active**: Preview<br/>**On preview exclusive**: Yes<sup>1</sup> | - | - | - | - |
| **Action Active**: Program<br/>**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 preview<sup>2</sup> |
|--------------------------------------------------------------------------|-----------------------|-----------------------|----------------------------|-------------------------------------|
| **Action Active**: Always<br/>**On preview exclusive**: No | Send start command | Send start command | Send stop command | Send stop command |
| **Action Active**: Always<br/>**On preview exclusive**: Yes<sup>1</sup> | - | Send start command | Send stop command | - |
| **Action Active**: Preview<br/>**On preview exclusive**: No | Send start command | - | - | Send stop command |
| **Action Active**: Preview<br/>**On preview exclusive**: Yes<sup>1</sup> | - | - | - | - |
| **Action Active**: Program<br/>**On preview exclusive**: N/A | - | Send start command | Send stop command | - |

<sup>1</sup>The checkbox 'Run action on preview only...' is active *and* for the same camera a Visca action is active (visible) on program.
Notes:
- <sup>1 </sup>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.
- <sup>2 </sup>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.
Expand Down
26 changes: 14 additions & 12 deletions obs-visca-control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 26f7dca

Please sign in to comment.