diff --git a/src/eventhandler/EventHandler.cpp b/src/eventhandler/EventHandler.cpp index ee79c18a..1ac8f9f3 100644 --- a/src/eventhandler/EventHandler.cpp +++ b/src/eventhandler/EventHandler.cpp @@ -300,10 +300,12 @@ void EventHandler::OnFrontendEvent(enum obs_frontend_event event, void *private_ // Transitions case OBS_FRONTEND_EVENT_TRANSITION_CHANGED: + eventHandler->HandleCurrentSceneTransitionChanged(); break; case OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED: break; case OBS_FRONTEND_EVENT_TRANSITION_DURATION_CHANGED: + eventHandler->HandleCurrentSceneTransitionDurationChanged(); break; // Outputs diff --git a/src/eventhandler/EventHandler.h b/src/eventhandler/EventHandler.h index 6200dc95..7049864e 100644 --- a/src/eventhandler/EventHandler.h +++ b/src/eventhandler/EventHandler.h @@ -112,6 +112,10 @@ class EventHandler static void HandleInputAudioTracksChanged(void *param, calldata_t *data); // Direct callback static void HandleInputAudioMonitorTypeChanged(void *param, calldata_t *data); // Direct callback + // Transitions + void HandleCurrentSceneTransitionChanged(); + void HandleCurrentSceneTransitionDurationChanged(); + // Outputs void HandleStreamStateChanged(ObsOutputState state); void HandleRecordStateChanged(ObsOutputState state); diff --git a/src/eventhandler/EventHandler_Transitions.cpp b/src/eventhandler/EventHandler_Transitions.cpp index 6e0f4c11..860d5cc6 100644 --- a/src/eventhandler/EventHandler_Transitions.cpp +++ b/src/eventhandler/EventHandler_Transitions.cpp @@ -18,3 +18,45 @@ with this program. If not, see */ #include "EventHandler.h" + +/** + * The current scene transition has changed. + * + * @dataField transitionName | String | Name of the new transition + * + * @eventType CurrentSceneTransitionChanged + * @eventSubscription Transitions + * @complexity 3 + * @rpcVersion -1 + * @initialVersion 5.0.0 + * @api events + * @category transitions + */ +void EventHandler::HandleCurrentSceneTransitionChanged() +{ + OBSSourceAutoRelease transition = obs_frontend_get_current_transition(); + + json eventData; + eventData["transitionName"] = obs_source_get_name(transition); + BroadcastEvent(EventSubscription::Transitions, "CurrentSceneTransitionChanged", eventData); +} + +/** + * The current scene transition duration has changed. + * + * @dataField transitionDuration | Number | Transition duration in milliseconds + * + * @eventType CurrentSceneTransitionDurationChanged + * @eventSubscription Transitions + * @complexity 2 + * @rpcVersion -1 + * @initialVersion 5.0.0 + * @api events + * @category transitions + */ +void EventHandler::HandleCurrentSceneTransitionDurationChanged() +{ + json eventData; + eventData["transitionDuration"] = obs_frontend_get_transition_duration(); + BroadcastEvent(EventSubscription::Transitions, "CurrentSceneTransitionDurationChanged", eventData); +}