mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Merge pull request #297 from Palakis/bugfix/242-getsceneitemproperties-item-size
GetSceneItemProperties: add width & height values
This commit is contained in:
commit
92938d2c35
@ -592,8 +592,20 @@ bool Utils::SetFilenameFormatting(const char* filenameFormatting) {
|
||||
* @property {int} `bounds.alignment` Alignment of the bounding box.
|
||||
* @property {double} `bounds.x` Width of the bounding box.
|
||||
* @property {double} `bounds.y` Height of the bounding box.
|
||||
* @property {int} `sourceWidth` Base width (without scaling) of the source
|
||||
* @property {int} `sourceHeight` Base source (without scaling) of the source
|
||||
* @property {double} `width` Scene item width (base source width multiplied by the horizontal scaling factor)
|
||||
* @property {double} `height` Scene item height (base source height multiplied by the vertical scaling factor)
|
||||
*/
|
||||
obs_data_t* Utils::GetSceneItemPropertiesData(obs_sceneitem_t* sceneItem) {
|
||||
if (!sceneItem) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OBSSource source = obs_sceneitem_get_source(sceneItem);
|
||||
uint32_t baseSourceWidth = obs_source_get_width(source);
|
||||
uint32_t baseSourceHeight = obs_source_get_height(source);
|
||||
|
||||
vec2 pos, scale, bounds;
|
||||
obs_sceneitem_crop crop;
|
||||
|
||||
@ -639,5 +651,10 @@ obs_data_t* Utils::GetSceneItemPropertiesData(obs_sceneitem_t* sceneItem) {
|
||||
obs_data_set_bool(data, "visible", isVisible);
|
||||
obs_data_set_obj(data, "bounds", boundsData);
|
||||
|
||||
obs_data_set_int(data, "sourceWidth", baseSourceWidth);
|
||||
obs_data_set_int(data, "sourceHeight", baseSourceHeight);
|
||||
obs_data_set_double(data, "width", baseSourceWidth * scale.x);
|
||||
obs_data_set_double(data, "height", baseSourceHeight * scale.y);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -25,6 +25,10 @@
|
||||
* @return {int} `bounds.alignment` Alignment of the bounding box.
|
||||
* @return {double} `bounds.x` Width of the bounding box.
|
||||
* @return {double} `bounds.y` Height of the bounding box.
|
||||
* @return {int} `sourceWidth` Base width (without scaling) of the source
|
||||
* @return {int} `sourceHeight` Base source (without scaling) of the source
|
||||
* @return {double} `width` Scene item width (base source width multiplied by the horizontal scaling factor)
|
||||
* @return {double} `height` Scene item height (base source height multiplied by the vertical scaling factor)
|
||||
*
|
||||
* @api requests
|
||||
* @name GetSceneItemProperties
|
||||
|
Loading…
x
Reference in New Issue
Block a user