mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-04-26 01:21:58 -04:00
UI: Add SelectScene hotkey
UI supplied per scene hotkey to allow switching between scenes; this has to be done in the UI since it's up to the application to define what exactly "changing/selecting a scene" means (changing the output of channel 0 may not be enough for other applications)
This commit is contained in:
@@ -918,6 +918,18 @@ void OBSBasic::AddScene(OBSSource source)
|
||||
item->setData(Qt::UserRole, QVariant::fromValue(OBSScene(scene)));
|
||||
ui->scenes->addItem(item);
|
||||
|
||||
obs_hotkey_register_source(source, "OBSBasic.SelectScene",
|
||||
Str("Basic.Hotkeys.SelectScene"),
|
||||
[](void *data,
|
||||
obs_hotkey_id, obs_hotkey_t*, bool pressed)
|
||||
{
|
||||
auto potential_source = static_cast<obs_source_t*>(data);
|
||||
auto source = obs_source_get_ref(potential_source);
|
||||
if (source && pressed)
|
||||
obs_set_output_source(0, source);
|
||||
obs_source_release(source);
|
||||
}, static_cast<obs_source_t*>(source));
|
||||
|
||||
signal_handler_t *handler = obs_source_get_signal_handler(source);
|
||||
signal_handler_connect(handler, "item_add",
|
||||
OBSBasic::SceneItemAdded, this);
|
||||
|
||||
Reference in New Issue
Block a user