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 committed May 17, 2024
1 parent 5b4aa9d commit df5fead
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 df5fead

Please sign in to comment.