docs: Document transition requests

This commit is contained in:
tt2468 2021-12-28 18:11:30 -08:00
parent 4d65c2adee
commit ec79124b5f

View File

@ -19,6 +19,20 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include "RequestHandler.h"
/**
* Gets an array of all available transition kinds.
*
* Similar to `GetInputKindList`
*
* @responseField transitionKinds | Vector<String> | Array of transition kinds
*
* @requestType GetTransitionKindList
* @complexity 2
* @rpcVersion -1
* @initialVersion 5.0.0
* @api requests
* @category transitions
*/
RequestResult RequestHandler::GetTransitionKindList(const Request&)
{
json responseData;
@ -26,6 +40,20 @@ RequestResult RequestHandler::GetTransitionKindList(const Request&)
return RequestResult::Success(responseData);
}
/**
* Gets an array of all scene transitions in OBS.
*
* @responseField currentSceneTransitionName | String | Name of the current scene transition. Can be null
* @responseField currentSceneTransitionKind | String | Kind of the current scene transition. Can be null
* @responseField transitions | Vector<Object> | Array of transitions
*
* @requestType GetSceneTransitionList
* @complexity 3
* @rpcVersion -1
* @initialVersion 5.0.0
* @api requests
* @category transitions
*/
RequestResult RequestHandler::GetSceneTransitionList(const Request&)
{
json responseData;
@ -44,6 +72,23 @@ RequestResult RequestHandler::GetSceneTransitionList(const Request&)
return RequestResult::Success(responseData);
}
/**
* Gets information about the current scene transition.
*
* @responseField transitionName | String | Name of the transition
* @responseField transitionKind | String | Kind of the transition
* @responseField transitionFixed | Boolean | Whether the transition uses a fixed (unconfigurable) duration
* @responseField transitionDuration | Number | Configured transition duration in milliseconds. `null` if transition is fixed
* @responseField transitionConfigurable | Boolean | Whether the transition supports being configured
* @responseField transitionSettings | Object | Object of settings for the transition. `null` if transition is not configurable
*
* @requestType GetCurrentSceneTransition
* @complexity 2
* @rpcVersion -1
* @initialVersion 5.0.0
* @api requests
* @category transitions
*/
RequestResult RequestHandler::GetCurrentSceneTransition(const Request&)
{
OBSSourceAutoRelease transition = obs_frontend_get_current_transition();
@ -74,7 +119,20 @@ RequestResult RequestHandler::GetCurrentSceneTransition(const Request&)
return RequestResult::Success(responseData);
}
// Transition names being unique are a UI concept and are not enforced by libobs
/**
* Sets the current scene transition.
*
* Small note: While the namespace of scene transitions is generally unique, that uniqueness is not a guarantee as it is with other resources like inputs.
*
* @requestField transitionName | String | Name of the transition to make active
*
* @requestType SetCurrentSceneTransition
* @complexity 2
* @rpcVersion -1
* @initialVersion 5.0.0
* @api requests
* @category transitions
*/
RequestResult RequestHandler::SetCurrentSceneTransition(const Request& request)
{
RequestStatus::RequestStatus statusCode;
@ -93,6 +151,18 @@ RequestResult RequestHandler::SetCurrentSceneTransition(const Request& request)
return RequestResult::Success();
}
/**
* Sets the duration of the current scene transition, if it is not fixed.
*
* @requestField transitionDuration | Number | Duration in milliseconds | >= 50, <= 20000
*
* @requestType SetCurrentSceneTransitionDuration
* @complexity 2
* @rpcVersion -1
* @initialVersion 5.0.0
* @api requests
* @category transitions
*/
RequestResult RequestHandler::SetCurrentSceneTransitionDuration(const Request& request)
{
RequestStatus::RequestStatus statusCode;
@ -107,6 +177,19 @@ RequestResult RequestHandler::SetCurrentSceneTransitionDuration(const Request& r
return RequestResult::Success();
}
/**
* Sets the settings of the current scene transition.
*
* @requestField transitionSettings | Object | Settings object to apply to the transition. Can be `{}`
* @requestField ?overlay | Boolean | Whether to overlay over the current settings or replace them | true
*
* @requestType SetCurrentSceneTransitionSettings
* @complexity 3
* @rpcVersion -1
* @initialVersion 5.0.0
* @api requests
* @category transitions
*/
RequestResult RequestHandler::SetCurrentSceneTransitionSettings(const Request& request)
{
RequestStatus::RequestStatus statusCode;
@ -143,6 +226,16 @@ RequestResult RequestHandler::SetCurrentSceneTransitionSettings(const Request& r
return RequestResult::Success();
}
/**
* Triggers the current scene transition. Same functionality as the `Transition` button in studio mode.
*
* @requestType TriggerStudioModeTransition
* @complexity 1
* @rpcVersion -1
* @initialVersion 5.0.0
* @api requests
* @category transitions
*/
RequestResult RequestHandler::TriggerStudioModeTransition(const Request&)
{
if (!obs_frontend_preview_program_mode_active())