From 36f50adf8a32ef4c374978a6b3bd8a78fbcbac90 Mon Sep 17 00:00:00 2001 From: Exeldro Date: Fri, 17 May 2024 08:30:11 +0200 Subject: [PATCH] requesthandler: Add `cropToBounds` to scene item --- src/requesthandler/RequestHandler_SceneItems.cpp | 7 +++++++ src/utils/Obs_ObjectHelper.cpp | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/requesthandler/RequestHandler_SceneItems.cpp b/src/requesthandler/RequestHandler_SceneItems.cpp index 67c5333a..146fb654 100644 --- a/src/requesthandler/RequestHandler_SceneItems.cpp +++ b/src/requesthandler/RequestHandler_SceneItems.cpp @@ -502,6 +502,13 @@ RequestResult RequestHandler::SetSceneItemTransform(const Request &request) cropChanged = true; } + if (r.Contains("cropToBounds")) { + if (!r.ValidateOptionalBoolean("cropToBounds", statusCode, comment)) + return RequestResult::Error(statusCode, comment); + sceneItemTransform.crop_to_bounds = r.RequestData["cropToBounds"]; + transformChanged = true; + } + if (!transformChanged && !cropChanged) return RequestResult::Error(RequestStatus::CannotAct, "You have not provided any valid transform changes."); diff --git a/src/utils/Obs_ObjectHelper.cpp b/src/utils/Obs_ObjectHelper.cpp index e35c28bf..10f207e5 100644 --- a/src/utils/Obs_ObjectHelper.cpp +++ b/src/utils/Obs_ObjectHelper.cpp @@ -83,5 +83,7 @@ json Utils::Obs::ObjectHelper::GetSceneItemTransform(obs_sceneitem_t *item) ret["cropTop"] = (int)crop.top; ret["cropBottom"] = (int)crop.bottom; + ret["cropToBounds"] = osi.crop_to_bounds; + return ret; }