Skip to content

Commit

Permalink
requesthandler: Add cropToBounds to scene item
Browse files Browse the repository at this point in the history
  • Loading branch information
exeldro authored and tt2468 committed Jun 6, 2024
1 parent acd1af1 commit 36f50ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/requesthandler/RequestHandler_SceneItems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.");

Expand Down
2 changes: 2 additions & 0 deletions src/utils/Obs_ObjectHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 36f50ad

Please sign in to comment.