mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Remove deprecated requests
This commit is contained in:
parent
04304ecf94
commit
e95d8d36aa
@ -57,9 +57,6 @@ const QHash<QString, RpcMethodHandler> WSRequestHandler::messageMap{
|
||||
{ "SetSourceRender", &WSRequestHandler::SetSceneItemRender }, // Retrocompat
|
||||
{ "GetSceneItemList", &WSRequestHandler::GetSceneItemList },
|
||||
{ "SetSceneItemRender", &WSRequestHandler::SetSceneItemRender },
|
||||
{ "SetSceneItemPosition", &WSRequestHandler::SetSceneItemPosition },
|
||||
{ "SetSceneItemTransform", &WSRequestHandler::SetSceneItemTransform },
|
||||
{ "SetSceneItemCrop", &WSRequestHandler::SetSceneItemCrop },
|
||||
{ "GetSceneItemProperties", &WSRequestHandler::GetSceneItemProperties },
|
||||
{ "SetSceneItemProperties", &WSRequestHandler::SetSceneItemProperties },
|
||||
{ "ResetSceneItem", &WSRequestHandler::ResetSceneItem },
|
||||
|
@ -74,9 +74,6 @@ class WSRequestHandler {
|
||||
|
||||
RpcResponse GetSceneItemList(const RpcRequest&);
|
||||
RpcResponse SetSceneItemRender(const RpcRequest&);
|
||||
RpcResponse SetSceneItemPosition(const RpcRequest&);
|
||||
RpcResponse SetSceneItemTransform(const RpcRequest&);
|
||||
RpcResponse SetSceneItemCrop(const RpcRequest&);
|
||||
RpcResponse GetSceneItemProperties(const RpcRequest&);
|
||||
RpcResponse SetSceneItemProperties(const RpcRequest&);
|
||||
RpcResponse ResetSceneItem(const RpcRequest&);
|
||||
|
@ -391,6 +391,7 @@ RpcResponse WSRequestHandler::ResetSceneItem(const RpcRequest& request) {
|
||||
|
||||
/**
|
||||
* Show or hide a specified source item in a specified scene.
|
||||
* Note: This request was previously deprecated, but has been kept because it is better when changing scene item render at a fast rate.
|
||||
*
|
||||
* @param {String (optional)} `scene-name` Name of the scene the scene item belongs to. Defaults to the currently active scene.
|
||||
* @param {String (optional)} `source` Scene Item name.
|
||||
@ -440,154 +441,6 @@ RpcResponse WSRequestHandler::SetSceneItemRender(const RpcRequest& request) {
|
||||
return request.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the coordinates of a specified source item.
|
||||
*
|
||||
* @param {String (optional)} `scene-name` Name of the scene the scene item belongs to. Defaults to the current scene.
|
||||
* @param {String} `item` Scene Item name.
|
||||
* @param {double} `x` X coordinate.
|
||||
* @param {double} `y` Y coordinate.
|
||||
|
||||
*
|
||||
* @api requests
|
||||
* @name SetSceneItemPosition
|
||||
* @category scene items
|
||||
* @since 4.0.0
|
||||
* @deprecated Since 4.3.0. Prefer the use of SetSceneItemProperties.
|
||||
*/
|
||||
RpcResponse WSRequestHandler::SetSceneItemPosition(const RpcRequest& request) {
|
||||
if (!request.hasField("item") ||
|
||||
!request.hasField("x") || !request.hasField("y")) {
|
||||
return request.failed("missing request parameters");
|
||||
}
|
||||
|
||||
QString itemName = obs_data_get_string(request.parameters(), "item");
|
||||
if (itemName.isEmpty()) {
|
||||
return request.failed("invalid request parameters");
|
||||
}
|
||||
|
||||
QString sceneName = obs_data_get_string(request.parameters(), "scene-name");
|
||||
OBSScene scene = Utils::GetSceneFromNameOrCurrent(sceneName);
|
||||
if (!scene) {
|
||||
return request.failed("requested scene could not be found");
|
||||
}
|
||||
|
||||
OBSSceneItem sceneItem = Utils::GetSceneItemFromName(scene, itemName);
|
||||
if (!sceneItem) {
|
||||
return request.failed("specified scene item doesn't exist");
|
||||
}
|
||||
|
||||
vec2 item_position = { 0 };
|
||||
item_position.x = obs_data_get_double(request.parameters(), "x");
|
||||
item_position.y = obs_data_get_double(request.parameters(), "y");
|
||||
obs_sceneitem_set_pos(sceneItem, &item_position);
|
||||
|
||||
return request.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the transform of the specified source item.
|
||||
*
|
||||
* @param {String (optional)} `scene-name` Name of the scene the scene item belongs to. Defaults to the current scene.
|
||||
* @param {String} `item` Scene Item name.
|
||||
* @param {double} `x-scale` Width scale factor.
|
||||
* @param {double} `y-scale` Height scale factor.
|
||||
* @param {double} `rotation` Source item rotation (in degrees).
|
||||
*
|
||||
* @api requests
|
||||
* @name SetSceneItemTransform
|
||||
* @category scene items
|
||||
* @since 4.0.0
|
||||
* @deprecated Since 4.3.0. Prefer the use of SetSceneItemProperties.
|
||||
*/
|
||||
RpcResponse WSRequestHandler::SetSceneItemTransform(const RpcRequest& request) {
|
||||
if (!request.hasField("item") ||
|
||||
!request.hasField("x-scale") ||
|
||||
!request.hasField("y-scale") ||
|
||||
!request.hasField("rotation"))
|
||||
{
|
||||
return request.failed("missing request parameters");
|
||||
}
|
||||
|
||||
QString itemName = obs_data_get_string(request.parameters(), "item");
|
||||
if (itemName.isEmpty()) {
|
||||
return request.failed("invalid request parameters");
|
||||
}
|
||||
|
||||
QString sceneName = obs_data_get_string(request.parameters(), "scene-name");
|
||||
OBSScene scene = Utils::GetSceneFromNameOrCurrent(sceneName);
|
||||
if (!scene) {
|
||||
return request.failed("requested scene doesn't exist");
|
||||
}
|
||||
|
||||
vec2 scale;
|
||||
scale.x = obs_data_get_double(request.parameters(), "x-scale");
|
||||
scale.y = obs_data_get_double(request.parameters(), "y-scale");
|
||||
float rotation = obs_data_get_double(request.parameters(), "rotation");
|
||||
|
||||
OBSSceneItemAutoRelease sceneItem = Utils::GetSceneItemFromName(scene, itemName);
|
||||
if (!sceneItem) {
|
||||
return request.failed("specified scene item doesn't exist");
|
||||
}
|
||||
|
||||
obs_sceneitem_defer_update_begin(sceneItem);
|
||||
|
||||
obs_sceneitem_set_scale(sceneItem, &scale);
|
||||
obs_sceneitem_set_rot(sceneItem, rotation);
|
||||
|
||||
obs_sceneitem_defer_update_end(sceneItem);
|
||||
|
||||
return request.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the crop coordinates of the specified source item.
|
||||
*
|
||||
* @param {String (optional)} `scene-name` Name of the scene the scene item belongs to. Defaults to the current scene.
|
||||
* @param {String} `item` Scene Item name.
|
||||
* @param {int} `top` Pixel position of the top of the source item.
|
||||
* @param {int} `bottom` Pixel position of the bottom of the source item.
|
||||
* @param {int} `left` Pixel position of the left of the source item.
|
||||
* @param {int} `right` Pixel position of the right of the source item.
|
||||
*
|
||||
* @api requests
|
||||
* @name SetSceneItemCrop
|
||||
* @category scene items
|
||||
* @since 4.1.0
|
||||
* @deprecated Since 4.3.0. Prefer the use of SetSceneItemProperties.
|
||||
*/
|
||||
RpcResponse WSRequestHandler::SetSceneItemCrop(const RpcRequest& request) {
|
||||
if (!request.hasField("item")) {
|
||||
return request.failed("missing request parameters");
|
||||
}
|
||||
|
||||
QString itemName = obs_data_get_string(request.parameters(), "item");
|
||||
if (itemName.isEmpty()) {
|
||||
return request.failed("invalid request parameters");
|
||||
}
|
||||
|
||||
QString sceneName = obs_data_get_string(request.parameters(), "scene-name");
|
||||
OBSScene scene = Utils::GetSceneFromNameOrCurrent(sceneName);
|
||||
if (!scene) {
|
||||
return request.failed("requested scene doesn't exist");
|
||||
}
|
||||
|
||||
OBSSceneItemAutoRelease sceneItem = Utils::GetSceneItemFromName(scene, itemName);
|
||||
if (!sceneItem) {
|
||||
return request.failed("specified scene item doesn't exist");
|
||||
}
|
||||
|
||||
struct obs_sceneitem_crop crop = { 0 };
|
||||
crop.top = obs_data_get_int(request.parameters(), "top");
|
||||
crop.bottom = obs_data_get_int(request.parameters(), "bottom");
|
||||
crop.left = obs_data_get_int(request.parameters(), "left");
|
||||
crop.right = obs_data_get_int(request.parameters(), "right");
|
||||
|
||||
obs_sceneitem_set_crop(sceneItem, &crop);
|
||||
|
||||
return request.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a scene item.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user