mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
EventHandler: More scene item events
This commit is contained in:
parent
10afbdfca0
commit
129ee12542
@ -132,6 +132,8 @@ void EventHandler::OnFrontendEvent(enum obs_frontend_event event, void *private_
|
||||
{
|
||||
auto eventHandler = reinterpret_cast<EventHandler*>(private_data);
|
||||
|
||||
blog(LOG_INFO, "Frontend event");
|
||||
|
||||
if (!eventHandler->_obsLoaded.load()) {
|
||||
if (event == OBS_FRONTEND_EVENT_FINISHED_LOADING) {
|
||||
blog(LOG_INFO, "[EventHandler::OnFrontendEvent] OBS has finished loading. Connecting final handlers and enabling events...");
|
||||
@ -215,6 +217,7 @@ void EventHandler::OnFrontendEvent(enum obs_frontend_event event, void *private_
|
||||
eventHandler->HandleCurrentPreviewSceneChanged();
|
||||
break;
|
||||
case OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED:
|
||||
blog(LOG_INFO, "scene list changed");
|
||||
eventHandler->HandleSceneListReindexed();
|
||||
break;
|
||||
|
||||
|
@ -25,7 +25,18 @@ void EventHandler::HandleSceneItemRemoved(void *param, calldata_t *data)
|
||||
{
|
||||
auto eventHandler = reinterpret_cast<EventHandler*>(param);
|
||||
|
||||
obs_scene_t *scene = GetCalldataPointer<obs_scene_t>(data, "scene");
|
||||
if (!scene)
|
||||
return;
|
||||
|
||||
obs_sceneitem_t *sceneItem = GetCalldataPointer<obs_sceneitem_t>(data, "item");
|
||||
if (!sceneItem)
|
||||
return;
|
||||
|
||||
json eventData;
|
||||
eventData["sceneName"] = obs_source_get_name(obs_scene_get_source(scene));
|
||||
eventData["inputName"] = obs_source_get_name(obs_sceneitem_get_source(sceneItem));
|
||||
eventData["sceneItemId"] = obs_sceneitem_get_id(sceneItem);
|
||||
eventHandler->_webSocketServer->BroadcastEvent(EventSubscription::SceneItems, "SceneItemRemoved", eventData);
|
||||
}
|
||||
|
||||
@ -33,7 +44,13 @@ void EventHandler::HandleSceneItemListReindexed(void *param, calldata_t *data)
|
||||
{
|
||||
auto eventHandler = reinterpret_cast<EventHandler*>(param);
|
||||
|
||||
obs_scene_t *scene = GetCalldataPointer<obs_scene_t>(data, "scene");
|
||||
if (!scene)
|
||||
return;
|
||||
|
||||
json eventData;
|
||||
eventData["sceneName"] = obs_source_get_name(obs_scene_get_source(scene));
|
||||
eventData["sceneItems"] = Utils::Obs::ListHelper::GetSceneItemList(scene, false);
|
||||
eventHandler->_webSocketServer->BroadcastEvent(EventSubscription::SceneItems, "SceneItemReindexed", eventData);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user