mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
request(SetTBarPosition): wip
This commit is contained in:
@ -130,6 +130,7 @@ const QHash<QString, RpcMethodHandler> WSRequestHandler::messageMap {
|
||||
{ "EnableStudioMode", &WSRequestHandler::EnableStudioMode },
|
||||
{ "DisableStudioMode", &WSRequestHandler::DisableStudioMode },
|
||||
{ "ToggleStudioMode", &WSRequestHandler::ToggleStudioMode },
|
||||
{ "SetTBarPosition", &WSRequestHandler::SetTBarPosition },
|
||||
|
||||
{ "SetTextGDIPlusProperties", &WSRequestHandler::SetTextGDIPlusProperties },
|
||||
{ "GetTextGDIPlusProperties", &WSRequestHandler::GetTextGDIPlusProperties },
|
||||
|
@ -148,6 +148,7 @@ class WSRequestHandler {
|
||||
RpcResponse EnableStudioMode(const RpcRequest&);
|
||||
RpcResponse DisableStudioMode(const RpcRequest&);
|
||||
RpcResponse ToggleStudioMode(const RpcRequest&);
|
||||
RpcResponse SetTBarPosition(const RpcRequest&);
|
||||
|
||||
RpcResponse SetTextGDIPlusProperties(const RpcRequest&);
|
||||
RpcResponse GetTextGDIPlusProperties(const RpcRequest&);
|
||||
|
@ -177,3 +177,30 @@ RpcResponse WSRequestHandler::ToggleStudioMode(const RpcRequest& request) {
|
||||
|
||||
return request.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the position of the T-Bar (in Studio Mode) to the specified value. Will return an error if OBS is not in studio mode
|
||||
* or if the current transition doesn't support T-Bar control.
|
||||
*
|
||||
* @param {double} `position` T-Bar position. This value will be clamped between 0.0 and 1.0.
|
||||
*
|
||||
* @api requests
|
||||
* @name TransitionToProgram
|
||||
* @category studio mode
|
||||
* @since 4.8.0
|
||||
*/
|
||||
RpcResponse WSRequestHandler::SetTBarPosition(const RpcRequest& request) {
|
||||
if (!obs_frontend_preview_program_mode_active()) {
|
||||
return request.failed("studio mode not enabled");
|
||||
}
|
||||
|
||||
OBSSourceAutoRelease currentTransition = obs_frontend_get_current_transition();
|
||||
if (obs_transition_fixed(currentTransition)) {
|
||||
return request.failed("current transition doesn't support t-bar control");
|
||||
}
|
||||
|
||||
double position = obs_data_get_double(request.parameters(), "position");
|
||||
obs_transition_set_manual_time(currentTransition, position);
|
||||
|
||||
return request.success();
|
||||
}
|
||||
|
Reference in New Issue
Block a user