mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
EventHandler: Add more scene item events
This commit is contained in:
parent
fb699b0414
commit
ebbb1391fe
@ -60,7 +60,20 @@ void EventHandler::HandleSceneItemEnableStateChanged(void *param, calldata_t *da
|
|||||||
{
|
{
|
||||||
auto eventHandler = reinterpret_cast<EventHandler*>(param);
|
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;
|
||||||
|
|
||||||
|
bool sceneItemEnabled = calldata_bool(data, "visible");
|
||||||
|
|
||||||
json eventData;
|
json eventData;
|
||||||
|
eventData["sceneName"] = obs_source_get_name(obs_scene_get_source(scene));
|
||||||
|
eventData["sceneItemId"] = obs_sceneitem_get_id(sceneItem);
|
||||||
|
eventData["sceneItemEnabled"] = sceneItemEnabled;
|
||||||
eventHandler->_webSocketServer->BroadcastEvent(EventSubscription::SceneItems, "SceneItemEnableStateChanged", eventData);
|
eventHandler->_webSocketServer->BroadcastEvent(EventSubscription::SceneItems, "SceneItemEnableStateChanged", eventData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +81,20 @@ void EventHandler::HandleSceneItemLockStateChanged(void *param, calldata_t *data
|
|||||||
{
|
{
|
||||||
auto eventHandler = reinterpret_cast<EventHandler*>(param);
|
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;
|
||||||
|
|
||||||
|
bool sceneItemLocked = calldata_bool(data, "locked");
|
||||||
|
|
||||||
json eventData;
|
json eventData;
|
||||||
|
eventData["sceneName"] = obs_source_get_name(obs_scene_get_source(scene));
|
||||||
|
eventData["sceneItemId"] = obs_sceneitem_get_id(sceneItem);
|
||||||
|
eventData["sceneItemLocked"] = sceneItemLocked;
|
||||||
eventHandler->_webSocketServer->BroadcastEvent(EventSubscription::SceneItems, "SceneItemLockStateChanged", eventData);
|
eventHandler->_webSocketServer->BroadcastEvent(EventSubscription::SceneItems, "SceneItemLockStateChanged", eventData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user